Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package eu.tetrabyte.contentmod.items;
- import eu.tetrabyte.contentmod.ContentMod;
- import net.minecraft.client.model.ModelBiped;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.EnumAction;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemStack;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class Armor extends ItemArmor {
- private static float scale = 0.125F;
- static ModelBiped armorModel = null;
- private ItemStack heldItem = null;
- public Armor(ArmorMaterial material, int renderIndex, int armorType) {
- super(material, renderIndex, armorType);
- this.setMaxStackSize(1);
- this.setCreativeTab(ContentMod.tabContent);
- }
- public static void init() {
- armorModel = new ModelBiped(scale);
- }
- @Override
- @SideOnly(Side.CLIENT)
- public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
- scale = 0.5F;
- //All below could be replaced by armorModel.setModelAttributes(_default);
- if (itemStack != null) {
- armorModel.isSneak = entityLiving.isSneaking();
- armorModel.isRiding = entityLiving.isRiding();
- armorModel.isChild = entityLiving.isChild();
- armorModel.heldItemRight = 0;
- armorModel.aimedBow = false;
- heldItem = entityLiving.getHeldItem();
- if (heldItem != null) {
- armorModel.heldItemRight = 1;
- if (entityLiving instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer) entityLiving;
- if (player.getItemInUseCount() > 0 && entityLiving instanceof EntityPlayer) {
- EnumAction enumaction = heldItem.getItemUseAction();
- if (enumaction == EnumAction.BOW) {
- armorModel.aimedBow = true;
- } else if (enumaction == EnumAction.BLOCK) {
- armorModel.heldItemRight = 3;
- }
- }
- }
- }
- }
- return armorModel;
- }
- public int getColor(ItemStack itemstack) {
- return 0xFFFFFF;
- }
- public int getColorFromItemStack(ItemStack itemstack, int renderpass) {
- return 0xFFFFFF;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment