From 797791c2af4add7d0947e4286d51e790014ec766 Mon Sep 17 00:00:00 2001 From: Cyborgmas Date: Fri, 21 Aug 2020 13:24:49 -0400 Subject: [PATCH] Fix small logging issues with loading pack.png for mods (#7265) --- .../fml/loading/moddiscovery/ExplodedDirectoryLocator.java | 2 +- .../java/net/minecraftforge/fml/packs/ModFileResourcePack.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java index 60e7d8c22..29bda6c50 100644 --- a/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java +++ b/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ExplodedDirectoryLocator.java @@ -79,7 +79,7 @@ public class ExplodedDirectoryLocator implements IModLocator { if (Files.exists(found)) return found; // then try left path (classes) return mods.get(modFile).getRight().stream().map(p->p.resolve(target)).filter(Files::exists). - findFirst().orElse(found.resolve(target)); + findFirst().orElse(found); } @Override diff --git a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java index 69daa155c..bdde12715 100644 --- a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java @@ -19,6 +19,7 @@ package net.minecraftforge.fml.packs; +import net.minecraft.resources.ResourcePackFileNotFoundException; import net.minecraft.resources.ResourcePackInfo; import net.minecraft.resources.ResourcePackType; import net.minecraft.util.ResourceLocation; @@ -63,6 +64,8 @@ public class ModFileResourcePack extends DelegatableResourcePack public InputStream getInputStream(String name) throws IOException { final Path path = modFile.getLocator().findPath(modFile, name); + if(!Files.exists(path)) + throw new ResourcePackFileNotFoundException(path.toFile(), name); return Files.newInputStream(path, StandardOpenOption.READ); }