use of buildcraft.transport.client.model.key.KeyPlugGate in project BuildCraft by BuildCraft.
the class GateItemModel method getState.
private KeyPlugGate getState(ItemStack stack) {
GateMaterial material = ItemGate.getMaterial(stack);
GateLogic logic = ItemGate.getLogic(stack);
Set<IGateExpansion> expansions = ItemGate.getInstalledExpansions(stack);
// states.add(exp.getRenderState());
return new KeyPlugGate(EnumFacing.UP, material, logic, false, expansions.toArray(new IGateExpansion[0]));
}
use of buildcraft.transport.client.model.key.KeyPlugGate in project BuildCraft by BuildCraft.
the class GateItemModel method handleItemState.
@Override
public GateItemModel handleItemState(ItemStack stack) {
KeyPlugGate key = getState(stack);
if (!map.containsKey(key)) {
List<BakedQuad> quads = Lists.newArrayList();
List<MutableQuad> mutableQuads = GatePluggableModel.INSTANCE.renderGate(key, DefaultVertexFormats.ITEM);
Matrix4f rotation = MatrixUtil.rotateTowardsFace(EnumFacing.SOUTH);
Matrix4f matScale = new Matrix4f();
matScale.setIdentity();
matScale.setScale(2);
matScale.setTranslation(new Vector3f(-0.5f, -0.5f, -0.5f));
Matrix4f translateToItem = new Matrix4f();
translateToItem.setIdentity();
translateToItem.setTranslation(new Vector3f(0, 0, -0.4f));
Matrix4f totalMatrix = new Matrix4f();
totalMatrix.setIdentity();
totalMatrix.mul(translateToItem);
totalMatrix.mul(matScale);
totalMatrix.mul(rotation);
for (MutableQuad quad : mutableQuads) {
quad.transform(totalMatrix);
quad.colouri(0xFF_FF_FF_FF);
quads.add(quad.toUnpacked(DefaultVertexFormats.ITEM));
}
map.put(key, new GateItemModel(ImmutableList.copyOf(quads), null, DefaultVertexFormats.ITEM));
}
return map.get(key);
}
Aggregations