diff --git a/src/main/java/dev/latvian/mods/kubejs/web/local/client/ImageGenerator.java b/src/main/java/dev/latvian/mods/kubejs/web/local/client/ImageGenerator.java index 5c386d880..151432168 100644 --- a/src/main/java/dev/latvian/mods/kubejs/web/local/client/ImageGenerator.java +++ b/src/main/java/dev/latvian/mods/kubejs/web/local/client/ImageGenerator.java @@ -44,7 +44,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.biome.Biomes; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; @@ -194,9 +193,11 @@ private static HTTPResponse renderCanvas(KJSHTTPRequest req, int canvasSize, Str Files.write(cachePath, bytes); } catch (Exception ignore) { } + + return HTTPResponse.ok().content(bytes, "image/png").header("X-KubeJS-Cache-Key", cacheUUIDStr); } - return HTTPResponse.ok().content(bytes, "image/png").header("X-KubeJS-Cache-Key", cacheUUIDStr); + return HTTPResponse.ok().content(bytes, "image/png"); } private static HTTPResponse renderAnimated(KJSHTTPRequest req, String dir, @Nullable ByteBuf cacheBuf, List responses) throws Exception { @@ -252,6 +253,8 @@ private static HTTPResponse renderAnimated(KJSHTTPRequest req, String dir, @Null Files.write(cachePath, bytes); } catch (Exception ignore) { } + + return HTTPResponse.ok().content(bytes, "image/gif").header("X-KubeJS-Cache-Key", cacheUUIDStr); } return HTTPResponse.ok().content(bytes, "image/gif"); @@ -455,13 +458,4 @@ public void setBody(ResponseContent body) { } } } - - public static HTTPResponse testGIF(KJSHTTPRequest req) throws Exception { - return renderAnimated(req, "test", null, List.of( - renderItem(req, Items.RED_STAINED_GLASS.getDefaultInstance(), true), - renderItem(req, Items.CARROT.getDefaultInstance(), true), - renderBlock(req, Blocks.NETHER_PORTAL.defaultBlockState(), true), - renderFluid(req, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME), true) - )); - } } diff --git a/src/main/java/dev/latvian/mods/kubejs/web/local/client/KubeJSClientWeb.java b/src/main/java/dev/latvian/mods/kubejs/web/local/client/KubeJSClientWeb.java index c58fe1db2..90e4ca14e 100644 --- a/src/main/java/dev/latvian/mods/kubejs/web/local/client/KubeJSClientWeb.java +++ b/src/main/java/dev/latvian/mods/kubejs/web/local/client/KubeJSClientWeb.java @@ -67,7 +67,6 @@ public static void register(LocalWebServerRegistry registry) { registry.get("/img/{size}/item-tag/{namespace}/{path}", ImageGenerator::itemTag); registry.get("/img/{size}/block-tag/{namespace}/{path}", ImageGenerator::blockTag); registry.get("/img/{size}/fluid-tag/{namespace}/{path}", ImageGenerator::fluidTag); - registry.get("/img/{size}/test-gif", ImageGenerator::testGIF); } private static HTTPResponse getScreenshot(KJSHTTPRequest req) {