Posted September 6, 20223 yr I have code for 1.18.2: Spoiler public abstract class HeadItem extends ArmorItem { public HeadItem(EquipmentSlot slot, Item.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 ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("")); } @Override public Ingredient getRepairIngredient() { return Ingredient.EMPTY; } @Override public String getName() { return "head"; } @Override public float getToughness() { return 0f; } @Override public float getKnockbackResistance() { return 0f; } }, slot, properties); } public static class Helmet extends HeadItem { public Helmet() { super(EquipmentSlot.HEAD, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT)); } public void initializeClient(java.util.function.Consumer<net.minecraftforge.client.IItemRenderProperties> consumer) { consumer.accept(new IItemRenderProperties() { @Override public HumanoidModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlot slot, HumanoidModel defaultModel) { HumanoidModel armorModel = new HumanoidModel(new ModelPart(Collections.emptyList(), Map.of("head", new Modelcustom_model(Minecraft.getInstance().getEntityModels().bakeLayer(Modelcustom_model.LAYER_LOCATION)).Head, "hat", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "body", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_arm", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "right_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap()), "left_leg", new ModelPart(Collections.emptyList(), Collections.emptyMap())))); armorModel.crouching = living.isShiftKeyDown(); armorModel.riding = defaultModel.riding; armorModel.young = living.isBaby(); return armorModel; } }); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return "main:textures/entities/balaclava.png"; } } } Looks like 1.19 doesn't have IItemRenderProperties. Does anyone have an example or advice?
September 7, 20223 yr The class was renamed in 1.19 in the client refactors. Look for and override the initializeClient method from Item. As some side-notes; What is up with that ArmorMaterial? At the very least, store that in a constant field somewhere, and reference it from your item. You don't need the HeadItem class. If you follow my first recommendation, you can reference the ArmorMaterial from your Helmet class' constructor.
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.