Fix tall non-animated textures getting cut off

This commit is contained in:
YuRaNnNzZZ 2023-08-23 22:02:39 +03:00
parent 155f56e62a
commit 7211c0ad91
No known key found for this signature in database
GPG Key ID: 5F71738C85A6006D
2 changed files with 6 additions and 2 deletions

View File

@ -374,7 +374,7 @@ public class ResourcePack {
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));

View File

@ -99,8 +99,12 @@ public class Texture {
}
public static Texture from(ResourcePath<Texture> resourcePath, BufferedImage image) throws IOException {
return from(resourcePath, image, true);
}
public static Texture from(ResourcePath<Texture> 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());
}