I'm currently attempting to add a custom armor to a mod that i am creating and i seem to be having problems making the model arms, legs and head to follow the player
this is my client proxy class
package com.turcanu.tfam.Proxy;
import com.turcanu.tfam.Init.ModArmors;
import com.turcanu.tfam.Init.ModBlocks;
import com.turcanu.tfam.Init.ModItems;
public class ClientProxy extends CommonProxy {
@Override
public void init() {
ModItems.registerRenders();
ModBlocks.registerRenders();
ModArmors.registerRenders();
ModArmors.registerModelRenders();
}
}
model class (WARNING:lots of code in this class)
armor class
package com.turcanu.tfam.Armor;
import com.turcanu.tfam.Init.ModArmors;
import com.turcanu.tfam.Main;
import com.turcanu.tfam.Utils.Refrances;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public class DragonMarcherSet extends ItemArmor {
public DragonMarcherSet(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, String UnlocalizedName, String RegistryNames) {
super(materialIn, renderIndexIn, equipmentSlotIn);
this.setUnlocalizedName(UnlocalizedName);
this.setRegistryName(RegistryNames);
this.setCreativeTab(Main.TABS);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
return Refrances.MODID + ":textures/models/armor/DragonMarchersArmorSet.png";
}
@Override
@SideOnly(Side.CLIENT)
@Nullable
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) {
if (itemStack != null) {
if (itemStack.getItem() instanceof ItemArmor) {
ModelBiped armorModel = ModArmors.armorModel.get(this);
armorModel.bipedRightLeg.showModel = armorSlot == EntityEquipmentSlot.FEET;
armorModel.bipedLeftLeg.showModel = armorSlot == EntityEquipmentSlot.FEET;
armorModel.isSneak = _default.isSneak;
armorModel.isRiding = _default.isRiding;
armorModel.isChild = _default.isChild;
armorModel.rightArmPose = _default.rightArmPose;
armorModel.leftArmPose = _default.leftArmPose;
return armorModel;
}
}
return null;
}
}
this is the class i register the armor and stuff
package com.turcanu.tfam.Init;
import com.turcanu.tfam.Armor.ArmorModels.ModelDragonMarchersArmorSet;
import com.turcanu.tfam.Armor.DragonMarcherSet;
import com.turcanu.tfam.Armor.TestSet;
import com.turcanu.tfam.Utils.Refrances;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.HashMap;
import java.util.Map;
public class ModArmors {
//Materials
public static ItemArmor.ArmorMaterial testMaterial = EnumHelper.addArmorMaterial("testMaterial",Refrances.MODID + ":testMaterial", 30, new int[] {2,6,5,2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 2.0F);
public static ItemArmor.ArmorMaterial dragonMetal = EnumHelper.addArmorMaterial("dragonMetalIngot", Refrances.MODID + ":dragonMetalIngot", 0, new int[] {2,6, 5, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 10.0F);
//Test Set
public static ItemArmor TestHead;
public static ItemArmor TestChest;
public static ItemArmor TestLegs;
public static ItemArmor TestFeet;
//Dragon Marcher Set
public static ItemArmor dragonMarchersSetHead;
public static ItemArmor dragonMarchersSetChest;
public static ItemArmor dragonMarchersSetLegs;
public static ItemArmor dragonMarchersSetFeet;
public static void init(){
TestHead = new TestSet(testMaterial, 1, EntityEquipmentSlot.HEAD, "ArmorTestHead", "Test_Armor_Head");
TestChest = new TestSet(testMaterial, 1, EntityEquipmentSlot.CHEST, "ArmorTestChest", "Test_Armor_Chest");
TestLegs = new TestSet(testMaterial, 2, EntityEquipmentSlot.LEGS, "ArmorTestLegs", "Test_Armor_Legs");
TestFeet = new TestSet(testMaterial, 1, EntityEquipmentSlot.FEET, "ArmorTestFeet", "Test_Armor_Feet");
dragonMarchersSetHead = new DragonMarcherSet(dragonMetal, 1 , EntityEquipmentSlot.HEAD,"DragonMarcherSetHead","Dragon_Marcher_Set_Head");
dragonMarchersSetChest = new DragonMarcherSet(dragonMetal, 1 , EntityEquipmentSlot.CHEST,"DragonMarcherSetChest","Dragon_Marcher_Set_Chest");
dragonMarchersSetLegs = new DragonMarcherSet(dragonMetal, 1 , EntityEquipmentSlot.LEGS,"DragonMarcherSetLegs","Dragon_Marcher_Set_Legs");
dragonMarchersSetFeet = new DragonMarcherSet(dragonMetal, 1 , EntityEquipmentSlot.FEET,"DragonMarcherSetFeet","Dragon_Marcher_Set_Feet");
}
public static void register(){
registerArmor(TestHead);
registerArmor(TestChest);
registerArmor(TestLegs);
registerArmor(TestFeet);
registerArmor(dragonMarchersSetHead);
registerArmor(dragonMarchersSetChest);
registerArmor(dragonMarchersSetLegs);
registerArmor(dragonMarchersSetFeet);
}
public static void registerArmor(Item armor){
GameRegistry.register(armor);
}
public static void registerRenders(){
registerRenders(TestHead);
registerRenders(TestChest);
registerRenders(TestLegs);
registerRenders(TestFeet);
registerRenders(dragonMarchersSetHead);
registerRenders(dragonMarchersSetChest);
registerRenders(dragonMarchersSetLegs);
registerRenders(dragonMarchersSetFeet);
}
private static void registerRenders(Item item){
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));
}
private static final ModelDragonMarchersArmorSet dragonMarchersArmorSetChest = new ModelDragonMarchersArmorSet(1F);
private static final ModelDragonMarchersArmorSet dragonMarchersArmorSetLegs = new ModelDragonMarchersArmorSet(0.5F);
public static final Map<Item, ModelBiped> armorModel = new HashMap<Item, ModelBiped>();
public static void registerModelRenders(){
armorModel.put(dragonMarchersSetHead, dragonMarchersArmorSetChest);
armorModel.put(dragonMarchersSetChest, dragonMarchersArmorSetChest);
armorModel.put(dragonMarchersSetLegs, dragonMarchersArmorSetLegs);
armorModel.put(dragonMarchersSetFeet, dragonMarchersArmorSetChest);
}
}
This is my problem.