diff --git a/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java b/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java index 393d7f0f60..4618d5a8b3 100644 --- a/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java +++ b/src/main/java/net/minecraftforge/client/model/techne/TechneModel.java @@ -1,5 +1,6 @@ package net.minecraftforge.client.model.techne; +import java.awt.Dimension; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -49,6 +50,7 @@ public class TechneModel extends ModelBase implements IModelCustom { private Map parts = new LinkedHashMap(); private String texture = null; + private Dimension textureDims = null; private int textureName; private boolean textureNameSet = false; @@ -119,6 +121,23 @@ public class TechneModel extends ModelBase implements IModelCustom { { texture = modelTexture.getTextContent(); } + + NodeList textureDim = document.getElementsByTagName("TextureSize"); + if (textureDim.getLength() > 0) + { + try + { + String[] tmp = textureDim.item(0).getTextContent().split(","); + if (tmp.length == 2) + { + this.textureDims = new Dimension(Integer.parseInt(tmp[0]), Integer.parseInt(tmp[1])); + } + } + catch (NumberFormatException e) + { + throw new ModelFormatException("Model " + fileName + " contains a TextureSize tag with invalid data"); + } + } NodeList shapes = document.getElementsByTagName("Shape"); for (int i = 0; i < shapes.getLength(); i++) @@ -210,6 +229,11 @@ public class TechneModel extends ModelBase implements IModelCustom { cube.rotateAngleY = (float)Math.toRadians(Float.parseFloat(rotation[1])); cube.rotateAngleZ = (float)Math.toRadians(Float.parseFloat(rotation[2])); + if (this.textureDims != null) + { + cube.setTextureSize((int)textureDims.getWidth(), (int)textureDims.getHeight()); + } + parts.put(shapeName, cube); } catch (NumberFormatException e)