Search in sources :

Example 21 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project Armourers-Workshop by RiskyKen.

the class RenderBlockMannequinItems method renderHeadStack.

public void renderHeadStack(MannequinFakePlayer fakePlayer, ItemStack stack, ModelBiped targetBiped, RenderManager rm, byte[] extraColours, double distance) {
    Item targetItem = stack.getItem();
    if (SkinNBTHelper.stackHasSkinData(stack)) {
        SkinModelRenderer.INSTANCE.renderEquipmentPartFromStack(stack, targetBiped, extraColours, distance, true);
        return;
    }
    if (targetItem instanceof ItemBlock) {
        float blockScale = 0.5F;
        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleZ), 0, 0, 1);
        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleY), 0, 1, 0);
        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleX), 1, 0, 0);
        GL11.glTranslatef(0, -4 * scale, 0);
        GL11.glScalef(-blockScale, -blockScale, blockScale);
        GL11.glRotatef(90F, 0F, 1F, 0F);
        rm.itemRenderer.renderItem(fakePlayer, stack, stack.getItemDamage());
    } else {
        if (targetItem instanceof ItemArmor) {
            int passes = targetItem.getRenderPasses(stack.getItemDamage());
            for (int i = 0; i < passes; i++) {
                ModelBiped armourBiped = ForgeHooksClient.getArmorModel(fakePlayer, stack, 0, renderPlayer.modelArmorChestplate);
                if (i == 0) {
                    bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 0, null));
                } else {
                    bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 0, "overlay"));
                }
                Color c = new Color(targetItem.getColorFromItemStack(stack, i));
                GL11.glColor3f((float) c.getRed() / 255, (float) c.getGreen() / 255, (float) c.getBlue() / 255);
                armourBiped.isChild = false;
                if (armourBiped == renderPlayer.modelArmorChestplate) {
                    setRotations(targetBiped.bipedHead, armourBiped.bipedHead);
                    armourBiped.bipedHead.showModel = true;
                    armourBiped.bipedHead.render(scale);
                    resetRotations(targetBiped.bipedHead);
                } else {
                    try {
                        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleZ), 0, 0, 1);
                        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleY), 0, 1, 0);
                        GL11.glRotated(Math.toDegrees(targetBiped.bipedHead.rotateAngleX), 1, 0, 0);
                        armourBiped.render(null, 0, 0, 0, 0, 0, scale);
                    } catch (Exception e) {
                    // ModLogger.log(e);
                    }
                }
            }
        }
    }
}
Also used : Item(net.minecraft.item.Item) ModelBiped(net.minecraft.client.model.ModelBiped) ItemArmor(net.minecraft.item.ItemArmor) Color(java.awt.Color) ItemBlock(net.minecraft.item.ItemBlock)

Example 22 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project Armourers-Workshop by RiskyKen.

the class RenderBlockMannequinItems method renderFeetStack.

public void renderFeetStack(MannequinFakePlayer fakePlayer, ItemStack stack, ModelBiped targetBiped, RenderManager rm, byte[] extraColours, double distance) {
    Item targetItem = stack.getItem();
    if (SkinNBTHelper.stackHasSkinData(stack)) {
        SkinModelRenderer.INSTANCE.renderEquipmentPartFromStack(stack, targetBiped, extraColours, distance, true);
        return;
    }
    if (targetItem instanceof ItemArmor) {
        int passes = targetItem.getRenderPasses(stack.getItemDamage());
        for (int i = 0; i < passes; i++) {
            ModelBiped armourBiped = ForgeHooksClient.getArmorModel(fakePlayer, stack, 3, renderPlayer.modelArmorChestplate);
            if (i == 0) {
                bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 3, null));
            } else {
                bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 3, "overlay"));
            }
            Color c = new Color(targetItem.getColorFromItemStack(stack, i));
            GL11.glColor3f((float) c.getRed() / 255, (float) c.getGreen() / 255, (float) c.getBlue() / 255);
            armourBiped.isChild = false;
            if (armourBiped == renderPlayer.modelArmorChestplate) {
                setRotations(targetBiped.bipedLeftLeg, armourBiped.bipedLeftLeg);
                setRotations(targetBiped.bipedRightLeg, armourBiped.bipedRightLeg);
                armourBiped.bipedLeftLeg.showModel = true;
                armourBiped.bipedRightLeg.showModel = true;
                armourBiped.bipedLeftLeg.render(scale);
                armourBiped.bipedRightLeg.render(scale);
                resetRotations(armourBiped.bipedLeftLeg);
                resetRotations(armourBiped.bipedRightLeg);
            } else {
                try {
                    armourBiped.render(fakePlayer, 0, 0, 0, 0, 0, scale);
                } catch (Exception e) {
                // ModLogger.log(e);
                }
            }
        }
    }
}
Also used : Item(net.minecraft.item.Item) ModelBiped(net.minecraft.client.model.ModelBiped) ItemArmor(net.minecraft.item.ItemArmor) Color(java.awt.Color)

Example 23 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project Armourers-Workshop by RiskyKen.

the class RenderBlockMannequinItems method renderLegsStack.

public void renderLegsStack(MannequinFakePlayer fakePlayer, ItemStack stack, ModelBiped targetBiped, RenderManager rm, byte[] extraColours, double distance) {
    Item targetItem = stack.getItem();
    if (SkinNBTHelper.stackHasSkinData(stack)) {
        SkinModelRenderer.INSTANCE.renderEquipmentPartFromStack(stack, targetBiped, extraColours, distance, true);
        return;
    }
    if (targetItem instanceof ItemArmor) {
        int passes = targetItem.getRenderPasses(stack.getItemDamage());
        for (int i = 0; i < passes; i++) {
            ModelBiped armourBiped = ForgeHooksClient.getArmorModel(fakePlayer, stack, 2, renderPlayer.modelArmor);
            if (i == 0) {
                bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 2, null));
            } else {
                bindTexture(RenderBiped.getArmorResource(fakePlayer, stack, 2, "overlay"));
            }
            Color c = new Color(targetItem.getColorFromItemStack(stack, i));
            GL11.glColor3f((float) c.getRed() / 255, (float) c.getGreen() / 255, (float) c.getBlue() / 255);
            armourBiped.isChild = false;
            if (armourBiped == renderPlayer.modelArmor) {
                setRotations(targetBiped.bipedLeftLeg, armourBiped.bipedLeftLeg);
                setRotations(targetBiped.bipedRightLeg, armourBiped.bipedRightLeg);
                armourBiped.bipedBody.showModel = true;
                armourBiped.bipedLeftLeg.showModel = true;
                armourBiped.bipedRightLeg.showModel = true;
                armourBiped.bipedBody.render(scale);
                armourBiped.bipedLeftLeg.render(scale);
                armourBiped.bipedRightLeg.render(scale);
                resetRotations(armourBiped.bipedLeftLeg);
                resetRotations(armourBiped.bipedRightLeg);
            } else {
                try {
                    armourBiped.render(fakePlayer, 0, 0, 0, 0, 0, scale);
                } catch (Exception e) {
                // ModLogger.log(e);
                }
            }
        }
    }
}
Also used : Item(net.minecraft.item.Item) ModelBiped(net.minecraft.client.model.ModelBiped) ItemArmor(net.minecraft.item.ItemArmor) Color(java.awt.Color)

Example 24 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project PneumaticCraft by MineMaarten.

the class ItemPneumaticArmor method getArmorModel.

/**
 * Override this method to have an item handle its own armor rendering.
 *
 * @param  entityLiving  The entity wearing the armor
 * @param  itemStack  The itemStack to render the model of
 * @param  armorSlot  0=head, 1=torso, 2=legs, 3=feet
 *
 * @return  A ModelBiped to render instead of the default
 */
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
    if (armorSlot == 0 && (Config.useHelmetModel || DateEventHandler.isIronManEvent())) {
        RenderItemPneumaticHelmet.INSTANCE.render(entityLiving);
        RenderPlayer render = (RenderPlayer) RenderManager.instance.entityRenderMap.get(EntityPlayer.class);
        ModelBiped model = armorSlot == 2 ? render.modelArmor : render.modelArmorChestplate;
        model.bipedHead.showModel = false;
        return model;
    }
    return null;
}
Also used : ModelBiped(net.minecraft.client.model.ModelBiped) EntityPlayer(net.minecraft.entity.player.EntityPlayer) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 25 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project ImmersiveEngineering by BluSunrize.

the class IEBipedLayerRenderer method renderPowerpack.

private void renderPowerpack(ItemStack powerpack, EntityLivingBase living, float limbSwing, float prevLimbSwing, float partialTicks, float rotation, float yaw, float pitch, float scale) {
    if (!powerpack.isEmpty()) {
        GlStateManager.pushMatrix();
        ModelBiped model = IEContent.itemPowerpack.getArmorModel(living, powerpack, EntityEquipmentSlot.CHEST, null);
        ClientUtils.bindTexture(IEContent.itemPowerpack.getArmorTexture(powerpack, living, EntityEquipmentSlot.CHEST, null));
        model.render(living, limbSwing, prevLimbSwing, rotation, yaw, pitch, scale);
        GlStateManager.popMatrix();
    }
}
Also used : ModelBiped(net.minecraft.client.model.ModelBiped)

Aggregations

ModelBiped (net.minecraft.client.model.ModelBiped)28 ItemStack (net.minecraft.item.ItemStack)7 Item (net.minecraft.item.Item)6 ItemArmor (net.minecraft.item.ItemArmor)5 Color (java.awt.Color)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 Render (net.minecraft.client.renderer.entity.Render)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 ModelBase (net.minecraft.client.model.ModelBase)2 ModelRenderer (net.minecraft.client.model.ModelRenderer)2 RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)2 ItemBlock (net.minecraft.item.ItemBlock)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 IColouredItem (blusunrize.immersiveengineering.common.items.IEItemInterfaces.IColouredItem)1 IMixinModelBiped (cc.hyperium.mixinsimp.client.model.IMixinModelBiped)1 MinestuckKeyHandler (com.mraof.minestuck.client.settings.MinestuckKeyHandler)1 EntityBigPart (com.mraof.minestuck.entity.EntityBigPart)1 EntityDecoy (com.mraof.minestuck.entity.EntityDecoy)1 EntityPawn (com.mraof.minestuck.entity.carapacian.EntityPawn)1