Search in sources :

Example 26 with ModelBiped

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

the class IEBipedLayerRenderer method doRenderLayer.

@Override
public void doRenderLayer(EntityLivingBase living, float limbSwing, float prevLimbSwing, float partialTicks, float rotation, float yaw, float pitch, float scale) {
    if (!living.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty() && ItemNBTHelper.hasKey(living.getItemStackFromSlot(EntityEquipmentSlot.HEAD), "IE:Earmuffs")) {
        ItemStack earmuffs = ItemNBTHelper.getItemStack(living.getItemStackFromSlot(EntityEquipmentSlot.HEAD), Lib.NBT_Earmuffs);
        if (!earmuffs.isEmpty()) {
            GlStateManager.pushMatrix();
            ModelBiped model = IEContent.itemEarmuffs.getArmorModel(living, earmuffs, EntityEquipmentSlot.HEAD, null);
            ClientUtils.bindTexture(IEContent.itemEarmuffs.getArmorTexture(earmuffs, living, EntityEquipmentSlot.HEAD, "overlay"));
            model.render(living, limbSwing, prevLimbSwing, rotation, yaw, pitch, scale);
            int colour = ((IColouredItem) earmuffs.getItem()).getColourForIEItem(earmuffs, 0);
            GlStateManager.color((colour >> 16 & 255) / 255f, (colour >> 8 & 255) / 255f, (colour & 255) / 255f);
            ClientUtils.bindTexture(IEContent.itemEarmuffs.getArmorTexture(earmuffs, living, EntityEquipmentSlot.HEAD, null));
            model.render(living, limbSwing, prevLimbSwing, rotation, yaw, pitch, scale);
            GlStateManager.popMatrix();
        }
    }
    if (!living.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty() && ItemNBTHelper.hasKey(living.getItemStackFromSlot(EntityEquipmentSlot.CHEST), "IE:Powerpack")) {
        ItemStack powerpack = ItemNBTHelper.getItemStack(living.getItemStackFromSlot(EntityEquipmentSlot.CHEST), Lib.NBT_Powerpack);
        addWornPowerpack(living, powerpack);
    }
    if (POWERPACK_PLAYERS.containsKey(living.getUniqueID())) {
        Pair<ItemStack, Integer> entry = POWERPACK_PLAYERS.get(living.getUniqueID());
        renderPowerpack(entry.getLeft(), living, limbSwing, prevLimbSwing, partialTicks, rotation, yaw, pitch, scale);
        int time = entry.getValue() - 1;
        if (time <= 0)
            POWERPACK_PLAYERS.remove(living.getUniqueID());
        else
            POWERPACK_PLAYERS.put(living.getUniqueID(), Pair.of(entry.getLeft(), time));
    }
}
Also used : ModelBiped(net.minecraft.client.model.ModelBiped) ItemStack(net.minecraft.item.ItemStack) IColouredItem(blusunrize.immersiveengineering.common.items.IEItemInterfaces.IColouredItem)

Example 27 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project BetterStorage by copygirl.

the class RenderFrienderman method shouldRenderPass.

@Override
protected int shouldRenderPass(EntityEnderman entity, int slot, float partialTicks) {
    if (slot == 0) {
        setRenderPassModel(mainModel);
        return super.shouldRenderPass(entity, slot, partialTicks);
    } else if (slot != 1)
        return -1;
    ItemStack stack = entity.getEquipmentInSlot(EquipmentSlot.CHEST);
    if (stack == null)
        return -1;
    Item item = stack.getItem();
    if (!(item instanceof ItemArmor))
        return -1;
    ItemArmor itemarmor = (ItemArmor) item;
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    textureManager.bindTexture(RenderBiped.getArmorResource(entity, stack, slot, null));
    ModelBiped modelBiped = ForgeHooksClient.getArmorModel(entity, stack, slot, null);
    setRenderPassModel(modelBiped);
    if (modelBiped != null) {
        modelBiped.onGround = mainModel.onGround;
        modelBiped.isRiding = mainModel.isRiding;
        modelBiped.isChild = mainModel.isChild;
    }
    int color = itemarmor.getColor(stack);
    if (color != -1) {
        RenderUtils.setColorFromInt(color);
        if (stack.isItemEnchanted())
            return 31;
        return 16;
    }
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    return (stack.isItemEnchanted() ? 15 : 1);
}
Also used : Item(net.minecraft.item.Item) TextureManager(net.minecraft.client.renderer.texture.TextureManager) ModelBiped(net.minecraft.client.model.ModelBiped) ItemArmor(net.minecraft.item.ItemArmor) ItemStack(net.minecraft.item.ItemStack)

Example 28 with ModelBiped

use of net.minecraft.client.model.ModelBiped in project Hyperium by HyperiumClient.

the class TwoPartLayerBipedArmor method initArmor.

protected void initArmor() {
    modelLeggings = new ModelBiped(0.5F);
    modelArmor = new ModelBiped(1.0F);
}
Also used : IMixinModelBiped(cc.hyperium.mixinsimp.client.model.IMixinModelBiped) 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