use of buildcraft.lib.client.model.ModelUtil.TexturedFace in project BuildCraft by BuildCraft.
the class JsonVariableFaceUV method evaluate.
public VariableFaceData evaluate(ITextureGetter spriteLookup) {
VariableFaceData data = new VariableFaceData();
TexturedFace face = spriteLookup.get(texture.evaluate());
data.sprite = face.sprite;
data.rotations = (int) textureRotation.evaluate();
data.uvs.minU = (float) (uv[0].evaluate() / 16.0);
data.uvs.minV = (float) (uv[1].evaluate() / 16.0);
data.uvs.maxU = (float) (uv[2].evaluate() / 16.0);
data.uvs.maxV = (float) (uv[3].evaluate() / 16.0);
data.uvs = data.uvs.inParent(face.faceData);
data.invertNormal = invert.evaluate();
data.bothSides = bothSides.evaluate();
return data;
}
use of buildcraft.lib.client.model.ModelUtil.TexturedFace in project BuildCraft by BuildCraft.
the class ModelHolderVariable method lookupTexture.
private TexturedFace lookupTexture(String lookup) {
int attempts = 0;
JsonTexture texture = new JsonTexture(lookup);
TextureAtlasSprite sprite;
while (texture.location.startsWith("#") && attempts < 10) {
JsonTexture tex = rawModel.textures.get(texture.location);
if (tex == null)
break;
else
texture = texture.inParent(tex);
attempts++;
}
lookup = texture.location;
if (lookup.startsWith("~")) {
sprite = customSprites.get(lookup.substring(1));
if (sprite == null) {
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
} else {
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(lookup);
}
TexturedFace face = new TexturedFace();
face.sprite = sprite;
face.faceData = texture.faceData;
return face;
}
use of buildcraft.lib.client.model.ModelUtil.TexturedFace in project BuildCraft by BuildCraft.
the class JsonVariableModel method lookupTexture.
private TexturedFace lookupTexture(String lookup) {
int attempts = 0;
JsonTexture texture = new JsonTexture(lookup);
TextureAtlasSprite sprite;
while (texture.location.startsWith("#") && attempts < 10) {
JsonTexture tex = textures.get(texture.location);
if (tex == null)
break;
else
texture = texture.inParent(tex);
attempts++;
}
lookup = texture.location;
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(lookup);
TexturedFace face = new TexturedFace();
face.sprite = sprite;
face.faceData = texture.faceData;
return face;
}
Aggregations