mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-14 14:45:37 +01:00
Fix tall non-animated textures getting cut off (#472)
This commit is contained in:
parent
155f56e62a
commit
aff64294af
@ -374,7 +374,7 @@ private void loadTextures(Path root) throws IOException {
|
|||||||
if (!usedTextures.contains(resourcePath)) return null; // don't load unused textures
|
if (!usedTextures.contains(resourcePath)) return null; // don't load unused textures
|
||||||
|
|
||||||
try (InputStream in = Files.newInputStream(file)) {
|
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));
|
}, textures));
|
||||||
|
|
||||||
|
@ -99,8 +99,12 @@ public void unloadImageData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Texture from(ResourcePath<Texture> resourcePath, BufferedImage image) throws IOException {
|
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
|
//crop off animation frames
|
||||||
if (image.getHeight() > image.getWidth()){
|
if (animated && image.getHeight() > image.getWidth()){
|
||||||
image = image.getSubimage(0, 0, image.getWidth(), image.getWidth());
|
image = image.getSubimage(0, 0, image.getWidth(), image.getWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user