Search in sources :

Example 1 with IAssemblyRenderOverriding

use of pneumaticCraft.api.client.assemblymachine.AssemblyRenderOverriding.IAssemblyRenderOverriding in project PneumaticCraft by MineMaarten.

the class ModelAssemblyIOUnit method renderModel.

public void renderModel(float size, float[] angles, float clawProgress, EntityItem carriedItem) {
    float clawTrans;
    float scaleFactor = 0.7F;
    IAssemblyRenderOverriding renderOverride = null;
    if (carriedItem != null) {
        renderOverride = AssemblyRenderOverriding.renderOverrides.get(carriedItem.getEntityItem());
        if (renderOverride != null) {
            clawTrans = renderOverride.getIOUnitClawShift(carriedItem.getEntityItem());
        } else {
            if (carriedItem.getEntityItem().getItem() instanceof ItemBlock) {
                clawTrans = 1.5F / 16F - clawProgress * 0.1F / 16F;
            } else {
                clawTrans = 1.5F / 16F - clawProgress * 1.4F / 16F;
                scaleFactor = 0.4F;
            }
        }
    } else {
        clawTrans = 1.5F / 16F - clawProgress * 1.5F / 16F;
    }
    Base.render(size);
    GL11.glPushMatrix();
    GL11.glRotatef(angles[0], 0, 1, 0);
    BaseTurn.render(size);
    BaseTurn2.render(size);
    GL11.glTranslated(0, 18 / 16F, 0);
    GL11.glRotatef(angles[1], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, 0);
    ArmBase1.render(size);
    ArmBase2.render(size);
    SupportMiddle.render(size);
    GL11.glTranslated(0, 18 / 16F, 6 / 16F);
    GL11.glRotatef(angles[2], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, -6 / 16F);
    ArmMiddle1.render(size);
    ArmMiddle2.render(size);
    GL11.glTranslated(0, 3 / 16F, 6 / 16F);
    GL11.glRotatef(angles[3], 1, 0, 0);
    GL11.glTranslated(0, -3 / 16F, -6 / 16F);
    ClawBase.render(size);
    GL11.glTranslated(0, 3 / 16F, 0);
    GL11.glRotatef(angles[4], 0, 0, 1);
    GL11.glTranslated(0, -3 / 16F, 0);
    ClawAxil.render(size);
    ClawTurn.render(size);
    GL11.glPushMatrix();
    GL11.glTranslated(clawTrans, 0, 0);
    Claw1.render(size);
    GL11.glTranslated(-2 * clawTrans, 0, 0);
    Claw2.render(size);
    GL11.glPopMatrix();
    if (carriedItem != null) {
        if (renderOverride == null || renderOverride.applyRenderChangeIOUnit(carriedItem.getEntityItem())) {
            GL11.glRotated(90, 1, 0, 0);
            GL11.glTranslated(0, carriedItem.getEntityItem().getItem() instanceof ItemBlock ? 1.5 / 16D : 0.5 / 16D, -3 / 16D);
            GL11.glRotated(-90, 0, 1, 0);
            GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
            customRenderItem.doRender(carriedItem, 0, 0, 0, 0, 0);
        }
    }
    GL11.glPopMatrix();
}
Also used : IAssemblyRenderOverriding(pneumaticCraft.api.client.assemblymachine.AssemblyRenderOverriding.IAssemblyRenderOverriding) ItemBlock(net.minecraft.item.ItemBlock)

Example 2 with IAssemblyRenderOverriding

use of pneumaticCraft.api.client.assemblymachine.AssemblyRenderOverriding.IAssemblyRenderOverriding in project PneumaticCraft by MineMaarten.

the class ModelAssemblyPlatform method renderModel.

public void renderModel(float size, float progress, EntityItem carriedItem) {
    float clawTrans;
    float scaleFactor = 0.7F;
    IAssemblyRenderOverriding renderOverride = null;
    if (carriedItem != null) {
        renderOverride = AssemblyRenderOverriding.renderOverrides.get(carriedItem.getEntityItem());
        if (renderOverride != null) {
            clawTrans = renderOverride.getPlatformClawShift(carriedItem.getEntityItem());
        } else {
            if (carriedItem.getEntityItem().getItem() instanceof ItemBlock) {
                clawTrans = 1.5F / 16F - progress * 0.1F / 16F;
            } else {
                clawTrans = 1.5F / 16F - progress * 1.4F / 16F;
                scaleFactor = 0.4F;
            }
        }
    } else {
        clawTrans = 1.5F / 16F - progress * 1.5F / 16F;
    }
    Base.render(size);
    Platform.render(size);
    Leg1.render(size);
    Leg2.render(size);
    Leg3.render(size);
    Leg4.render(size);
    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, clawTrans);
    Claw1.render(size);
    GL11.glTranslated(0, 0, -2 * clawTrans);
    Claw2.render(size);
    GL11.glPopMatrix();
    if (carriedItem != null) {
        if (renderOverride == null || renderOverride.applyRenderChangePlatform(carriedItem.getEntityItem())) {
            GL11.glRotated(180, 1, 0, 0);
            GL11.glTranslated(0, carriedItem.getEntityItem().getItem() instanceof ItemBlock ? -16.5 / 16F : -17.5 / 16F, 0);
            // GL11.glRotated(-90, 0, 1, 0);
            GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
            customRenderItem.doRender(carriedItem, 0, 0, 0, 0, 0);
        }
    }
}
Also used : IAssemblyRenderOverriding(pneumaticCraft.api.client.assemblymachine.AssemblyRenderOverriding.IAssemblyRenderOverriding) ItemBlock(net.minecraft.item.ItemBlock)

Aggregations

ItemBlock (net.minecraft.item.ItemBlock)2 IAssemblyRenderOverriding (pneumaticCraft.api.client.assemblymachine.AssemblyRenderOverriding.IAssemblyRenderOverriding)2