From aff64294af5e0753381074cf9eb3e10cddbdb78a Mon Sep 17 00:00:00 2001 From: YuRaNnNzZZ Date: Wed, 23 Aug 2023 22:55:51 +0300 Subject: [PATCH] Fix tall non-animated textures getting cut off (#472) --- .../bluemap/core/resources/resourcepack/ResourcePack.java | 2 +- .../core/resources/resourcepack/texture/Texture.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/ResourcePack.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/ResourcePack.java index ab643059..bdc13a30 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/ResourcePack.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/ResourcePack.java @@ -374,7 +374,7 @@ private void loadTextures(Path root) throws IOException { if (!usedTextures.contains(resourcePath)) return null; // don't load unused textures try (InputStream in = Files.newInputStream(file)) { - return Texture.from(resourcePath, ImageIO.read(in)); + return Texture.from(resourcePath, ImageIO.read(in), Files.exists(file.resolveSibling(file.getFileName() + ".mcmeta"))); } }, textures)); diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java index 40b5f9f7..5061ff05 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java @@ -99,8 +99,12 @@ public void unloadImageData() { } public static Texture from(ResourcePath resourcePath, BufferedImage image) throws IOException { + return from(resourcePath, image, true); + } + + public static Texture from(ResourcePath resourcePath, BufferedImage image, boolean animated) throws IOException { //crop off animation frames - if (image.getHeight() > image.getWidth()){ + if (animated && image.getHeight() > image.getWidth()){ image = image.getSubimage(0, 0, image.getWidth(), image.getWidth()); }