From 62734a92e533d69b29c94923ae9a8de261879796 Mon Sep 17 00:00:00 2001 From: covers1624 Date: Sun, 22 Sep 2024 23:46:01 +0930 Subject: [PATCH] Ensure folder exists when dumping item renders. --- src/main/java/codechicken/lib/internal/ItemFileRenderer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/codechicken/lib/internal/ItemFileRenderer.java b/src/main/java/codechicken/lib/internal/ItemFileRenderer.java index 972981b3..024d17e2 100644 --- a/src/main/java/codechicken/lib/internal/ItemFileRenderer.java +++ b/src/main/java/codechicken/lib/internal/ItemFileRenderer.java @@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexSorting; import net.covers1624.quack.image.AnimatedGifEncoder; +import net.covers1624.quack.io.IOUtils; import net.covers1624.quack.platform.OperatingSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; @@ -162,7 +163,7 @@ private StaticRenderTask(ItemStack stack, int resolution, Path path) { protected boolean render() throws IOException { try (NativeImage image = takeItemScreenshot()) { image.flipY(); - image.writeToFile(path); + image.writeToFile(IOUtils.makeParents(path)); } return true; } @@ -228,7 +229,7 @@ private GifRenderTask(ItemStack stack, int resolution, Path path, int fps, int d @Override protected void serialize() throws IOException { - try (OutputStream os = Files.newOutputStream(path)) { + try (OutputStream os = Files.newOutputStream(IOUtils.makeParents(path))) { AnimatedGifEncoder encoder = new AnimatedGifEncoder(); encoder.start(os); encoder.setDelay((int) frameDelay);