Posted December 18, 20213 yr I am trying to create custom armor. I've extended ArmorItem and head, body and legs work just fine. But Feet item renders as pants but with boots scale. I'm a bit confused... My item classes public static class Helmet extends BlackChitinArmorItem{ public Helmet() { super(EquipmentSlot.HEAD, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } } public static class Chest extends BlackChitinArmorItem{ public Chest() { super(EquipmentSlot.CHEST, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } } public static class Pants extends BlackChitinArmorItem{ public Pants() { super(EquipmentSlot.LEGS, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } } public static class Boots extends BlackChitinArmorItem{ public Boots() { super(EquipmentSlot.FEET, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } } My registry public static final RegistryObject<ArmorItem> CHITIN_HOOD = ITEMS.register("chitin_hood", () -> new ChitinArmorItem.Helmet()); public static final RegistryObject<ArmorItem> CHITIN_JACKET = ITEMS.register("chitin_jacket", () -> new ChitinArmorItem.Chest()); public static final RegistryObject<ArmorItem> CHITIN_PANTS = ITEMS.register("chitin_pants", () -> new ChitinArmorItem.Pants()); public static final RegistryObject<ArmorItem> CHITIN_BOOTS = ITEMS.register("chitin_boots", () -> new ChitinArmorItem.Boots());
December 18, 20213 yr Author 1 hour ago, diesieben07 said: Why did you make these all separate classes? Show more of your code, specifically BlackChitinArmorItem. that's because each item has it's own brhaviour, but it does nothing with rendering. public abstract class ChitinArmorItem extends ArmorItem { public ChitinArmorItem(EquipmentSlot slot, Properties properties) { super(new ArmorMaterial() { @Override public int getDurabilityForSlot(EquipmentSlot slot) { return new int[]{13, 15, 16, 11}[slot.getIndex()] * 25; } @Override public int getDefenseForSlot(EquipmentSlot slot) { return new int[]{2, 5, 6, 2}[slot.getIndex()]; } @Override public int getEnchantmentValue() { return 9; } @Override public SoundEvent getEquipSound() { return null; } @Override public Ingredient getRepairIngredient() { return Ingredient.of(new ItemStack(EItems.SCORPION_HUSK.get())); } @Override public String getName() { return "chitin_armor"; } @Override public float getToughness() { return 0; } @Override public float getKnockbackResistance() { return 0; } }, slot, properties); } @Override public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) { super.appendHoverText(p_41421_,p_41422_,p_41423_,p_41424_); p_41423_.add(new TextComponent("Decreases poison duration")); p_41423_.add(new TextComponent(" ")); p_41423_.add(new TextComponent("Wearing full set grants immunity to tier I poison effect")); } public static class Helmet extends ChitinArmorItem{ public Helmet() { super(EquipmentSlot.HEAD, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "evolved_rpg:textures/models/armor/chitin__layer_1.png"; } @Override public void onArmorTick(ItemStack itemstack, Level world, Player entity) { if(entity.getEffect(MobEffects.POISON) != null){ MobEffectInstance poison = entity.getEffect(MobEffects.POISON); entity.removeEffect(MobEffects.POISON); entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1)); } } } public static class Chest extends ChitinArmorItem{ public Chest() { super(EquipmentSlot.CHEST, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "evolved_rpg:textures/models/armor/chitin__layer_1.png"; } @Override public void onArmorTick(ItemStack itemstack, Level world, Player entity) { if(entity.getEffect(MobEffects.POISON) != null){ MobEffectInstance poison = entity.getEffect(MobEffects.POISON); entity.removeEffect(MobEffects.POISON); entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1)); if(entity.getItemBySlot(EquipmentSlot.HEAD).getItem() == EItems.CHITIN_HOOD.get() && entity.getItemBySlot(EquipmentSlot.LEGS).getItem() == EItems.CHITIN_PANTS.get() && entity.getItemBySlot(EquipmentSlot.FEET).getItem() == EItems.CHITIN_BOOTS.get()){ if (poison.getAmplifier() == 1){ entity.removeEffect(MobEffects.POISON); } } } } } public static class Pants extends ChitinArmorItem{ public Pants() { super(EquipmentSlot.LEGS, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "evolved_rpg:textures/models/armor/chitin__layer_2.png"; } @Override public void onArmorTick(ItemStack itemstack, Level world, Player entity) { if(entity.getEffect(MobEffects.POISON) != null){ MobEffectInstance poison = entity.getEffect(MobEffects.POISON); entity.removeEffect(MobEffects.POISON); entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1)); } } } public static class Boots extends ChitinArmorItem{ public Boots() { super(EquipmentSlot.FEET, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "evolved_rpg:textures/models/armor/chitin__layer_1.png"; } @Override public void onArmorTick(ItemStack itemstack, Level world, Player entity) { if(entity.getEffect(MobEffects.POISON) != null){ MobEffectInstance poison = entity.getEffect(MobEffects.POISON); entity.removeEffect(MobEffects.POISON); entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1)); } } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.