Skip to content

Commit

Permalink
The fucks happening here...
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed May 17, 2024
1 parent c183a5c commit 5d343e4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public record FolderMeta(Path icon, String description, List<Path> packs, boolea
public static final Codec<FolderMeta> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.STRING.xmap(Path::of, Path::toString).fieldOf("icon").forGetter(FolderMeta::icon),
Codec.STRING.fieldOf("description").forGetter(FolderMeta::description),
Codec.STRING.xmap(Path::of, Path::toString).listOf().fieldOf("packs").forGetter(FolderMeta::packs),
Codec.STRING.xmap(Path::of, Path::toString).listOf().fieldOf("packs").forGetter(FolderMeta::packs), // TODO only add packs that arent in any other meta automatically
Codec.BOOL.fieldOf("hidden").forGetter(FolderMeta::hidden)
).apply(instance, FolderMeta::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public void addPack(File fileOrFolder, Consumer<ResourcePackProfile> profileAdde

if (fileOrFolder.isDirectory()) {
info = ResourcePackProfile.create(
new ResourcePackInfo(name, Text.literal(displayName), ResourcePackSource.BUILTIN, Optional.empty()),
new ResourcePackInfo(name, Text.literal(displayName), ResourcePackSource.NONE, Optional.empty()),
new DirectoryResourcePack.DirectoryBackedFactory(fileOrFolder.toPath()),
ResourceType.CLIENT_RESOURCES,
new ResourcePackPosition(false, InsertionPosition.TOP, false)
);
} else {
info = ResourcePackProfile.create(
new ResourcePackInfo(name, Text.literal(displayName), ResourcePackSource.BUILTIN, Optional.empty()),
new ResourcePackInfo(name, Text.literal(displayName), ResourcePackSource.NONE, Optional.empty()),
new ZipResourcePack.ZipBackedFactory(fileOrFolder),
ResourceType.CLIENT_RESOURCES,
new ResourcePackPosition(false, InsertionPosition.TOP, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public static Path determinePackFolder(ResourcePack pack) {
} else if (pack instanceof ZipResourcePack zipResourcePack) {
return ((ZipFileWrapperAccessor) ((ZipResourcePackAccessor) zipResourcePack).getZipFileWrapper()).getFile().toPath();
} else if (pack instanceof ModNioResourcePack modResourcePack) {
return Path.of(modResourcePack.toString().replaceAll(UNSAFE_PATH_REGEX, "_"));
return Path.of(modResourcePack.getId().replaceAll(UNSAFE_PATH_REGEX, "_"));
} else {
RecursiveResources.LOGGER.warn("Failed to determine source folder for pack: " + pack.toString() + ", unknown pack type: " + pack.getClass().getName());
RecursiveResources.LOGGER.warn("Failed to determine source folder for pack: " + pack.getId() + ", unknown pack type: " + pack.getClass().getName());
return null;
}
} catch (Exception e) {
RecursiveResources.LOGGER.error("Error determining source folder for pack: " + pack.toString(), e);
RecursiveResources.LOGGER.error("Error determining source folder for pack: " + pack.getId(), e);
return null;
}
}
Expand Down

0 comments on commit 5d343e4

Please sign in to comment.