package net.vlados.advanced_armor.item;
import net.vlados.advanced_armor.ElementsAdvancedArmor;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraft.util.ResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.Item;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBase;
@ElementsAdvancedArmor.ModElement.Tag
public class ItemInfantryArmorRed extends ElementsAdvancedArmor.ModElement {
@GameRegistry.ObjectHolder("advanced_armor:infantryarmorredhelmet")
public static final Item helmet = null;
@GameRegistry.ObjectHolder("advanced_armor:infantryarmorredbody")
public static final Item body = null;
@GameRegistry.ObjectHolder("advanced_armor:infantryarmorredlegs")
public static final Item legs = null;
@GameRegistry.ObjectHolder("advanced_armor:infantryarmorredboots")
public static final Item boots = null;
public ItemInfantryArmorRed(ElementsAdvancedArmor instance) {
super(instance, 1);
}
@Override
public void initElements() {
ItemArmor.ArmorMaterial enuma = EnumHelper.addArmorMaterial("INFANTRYARMORRED", "advanced_armor:knightleather_armor", 25,
new int[]{2, 9, 4, 2}, 9,
(net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("item.armor.equip_chain")), 0f);
elements.items.add(() -> new ItemArmor(enuma, 0, EntityEquipmentSlot.LEGS) {
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase living, ItemStack stack, EntityEquipmentSlot slot, ModelBiped defaultModel) {
ModelBiped armorModel = new ModelBiped();
armorModel.bipedBody = new Modelinfantryarmor_chaintunic().Body;
armorModel.bipedRightLeg = new Modelinfantryarmor_chaintunic().RightArm;
armorModel.bipedLeftLeg = new Modelinfantryarmor_chaintunic().LeftArm;
armorModel.bipedLeftLeg = new Modelinfantryarmor_chaintunic().LeftLeg;
armorModel.bipedRightLeg = new Modelinfantryarmor_chaintunic().RightLeg;
armorModel.isSneak = living.isSneaking();
armorModel.isRiding = living.isRiding();
armorModel.isChild = living.isChild();
return armorModel;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
return "advanced_armor:textures/infantruarmor_chaintunic_red.png";
}
}.setUnlocalizedName("infantryarmorredlegs").setRegistryName("infantryarmorredlegs").setCreativeTab(CreativeTabs.COMBAT));
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels(ModelRegistryEvent event) {
ModelLoader.setCustomModelResourceLocation(legs, 0, new ModelResourceLocation("advanced_armor:infantryarmorredlegs", "inventory"));
}
public static class Modelinfantryarmor_chaintunic extends ModelBase {
private final ModelRenderer Body;
private final ModelRenderer RightArm;
private final ModelRenderer LeftArm;
private final ModelRenderer RightLeg;
private final ModelRenderer LeftLeg;
public Modelinfantryarmor_chaintunic() {
textureWidth = 128;
textureHeight = 128;
Body = new ModelRenderer(this);
Body.setRotationPoint(0.0F, 0.0F, 0.0F);
Body.cubeList.add(new ModelBox(Body, 0, 2, -4.5F, 0.0F, -2.5F, 9, 12, 5, 0.0F, false));
RightArm = new ModelRenderer(this);
RightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
RightArm.cubeList.add(new ModelBox(RightArm, 0, 19, -3.5F, -2.0F, -2.5F, 5, 12, 5, 0.0F, false));
RightArm.cubeList.add(new ModelBox(RightArm, 0, 53, -4.5F, 3.0F, -2.0F, 1, 5, 4, 0.0F, false));
LeftArm = new ModelRenderer(this);
LeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
LeftArm.cubeList.add(new ModelBox(LeftArm, 20, 19, -1.5F, -2.0F, -2.5F, 5, 12, 5, 0.0F, false));
LeftArm.cubeList.add(new ModelBox(LeftArm, 11, 53, 3.5F, 3.0F, -2.0F, 1, 5, 4, 0.0F, false));
RightLeg = new ModelRenderer(this);
RightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
RightLeg.cubeList.add(new ModelBox(RightLeg, 81, 13, -2.5F, 0.0F, -2.5F, 5, 12, 5, 0.0F, false));
LeftLeg = new ModelRenderer(this);
LeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
LeftLeg.cubeList.add(new ModelBox(LeftLeg, 101, 13, -2.3F, 0.0F, -2.5F, 5, 12, 5, 0.0F, false));
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
Body.render(f5);
RightArm.render(f5);
LeftArm.render(f5);
RightLeg.render(f5);
LeftLeg.render(f5);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
}
}
}