Search in sources :

Example 1 with KeyPlugGate

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]));
}
Also used : GateMaterial(buildcraft.transport.gates.GateDefinition.GateMaterial) IGateExpansion(buildcraft.api.gates.IGateExpansion) KeyPlugGate(buildcraft.transport.client.model.key.KeyPlugGate) GateLogic(buildcraft.transport.gates.GateDefinition.GateLogic)

Example 2 with KeyPlugGate

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);
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Matrix4f(javax.vecmath.Matrix4f) Vector3f(javax.vecmath.Vector3f) KeyPlugGate(buildcraft.transport.client.model.key.KeyPlugGate) MutableQuad(buildcraft.lib.client.model.MutableQuad)

Aggregations

KeyPlugGate (buildcraft.transport.client.model.key.KeyPlugGate)2 IGateExpansion (buildcraft.api.gates.IGateExpansion)1 MutableQuad (buildcraft.lib.client.model.MutableQuad)1 GateLogic (buildcraft.transport.gates.GateDefinition.GateLogic)1 GateMaterial (buildcraft.transport.gates.GateDefinition.GateMaterial)1 Matrix4f (javax.vecmath.Matrix4f)1 Vector3f (javax.vecmath.Vector3f)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1