Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have made a custom armor piece and have given it a texture for when you hold it. I have also made a custom armor material but I dont know how to make it so that when you where the armor you see a custom texture.

2 minutes ago, awesomedude3595 said:

Is there a way I can get this to work in 1.16.5 I had already set it up as on the website you sent but it doesn't appear to work in 1.16.5

show what you create

  • Author
public class ModItems {
public static final RegistryObject<ArmorItem> Silver_chestplate = Registration.Items.register("silver_chestplate", () ->
        new ArmorItem(ModArmorMaterials.silverMaterial, EquipmentSlotType.CHEST, new Item.Properties().tab(ItemGroup.TAB_COMBAT)));
public static final RegistryObject<ArmorItem> Silver_helmet = Registration.Items.register("silver_helmet", () ->
        new ArmorItem(ModArmorMaterials.silverMaterial, EquipmentSlotType.HEAD, new Item.Properties().tab(ItemGroup.TAB_COMBAT)));
public static final RegistryObject<ArmorItem> Silver_leggings = Registration.Items.register("silver_leggings", () ->
        new ArmorItem(ModArmorMaterials.silverMaterial, EquipmentSlotType.LEGS, new Item.Properties().tab(ItemGroup.TAB_COMBAT)));
public static final RegistryObject<ArmorItem> Silver_boots = Registration.Items.register("silver_boots", () ->
        new ArmorItem(ModArmorMaterials.silverMaterial, EquipmentSlotType.FEET, new Item.Properties().tab(ItemGroup.TAB_COMBAT)));
static void register() {}
}

 

public enum ModArmorMaterials implements IArmorMaterial {
        silverMaterial("silver", 7, new int[]{1, 3, 5, 2}, 25, SoundEvents.ARMOR_EQUIP_GOLD, 0.0F, 0.0F, () -> {
            return Ingredient.of(ModItems.Silver_ingot.get());
        });

        private static final int[] HEALTH_PER_SLOT = new int[]{13, 15, 16, 11};
        private final String name;
        private final int durabilityMultiplier;
        private final int[] slotProtections;
        private final int enchantmentValue;
        private final SoundEvent sound;
        private final float toughness;
        private final float knockbackResistance;
        private final LazyValue<Ingredient> repairIngredient;

        ModArmorMaterials(String p_i231593_3_, int p_i231593_4_, int[] p_i231593_5_, int p_i231593_6_, SoundEvent p_i231593_7_, float p_i231593_8_, float p_i231593_9_, Supplier<Ingredient> p_i231593_10_) {
            this.name = p_i231593_3_;
            this.durabilityMultiplier = p_i231593_4_;
            this.slotProtections = p_i231593_5_;
            this.enchantmentValue = p_i231593_6_;
            this.sound = p_i231593_7_;
            this.toughness = p_i231593_8_;
            this.knockbackResistance = p_i231593_9_;
            this.repairIngredient = new LazyValue<>(p_i231593_10_);
        }

        public int getDurabilityForSlot(EquipmentSlotType p_200896_1_) {
            return HEALTH_PER_SLOT[p_200896_1_.getIndex()] * this.durabilityMultiplier;
        }

        public int getDefenseForSlot(EquipmentSlotType p_200902_1_) {
            return this.slotProtections[p_200902_1_.getIndex()];
        }

        public int getEnchantmentValue() {
            return this.enchantmentValue;
        }

        public SoundEvent getEquipSound() {
            return this.sound;
        }

        public Ingredient getRepairIngredient() {
            return this.repairIngredient.get();
        }

        @OnlyIn(Dist.CLIENT)
        public String getName() {
            return this.name;
        }

        public float getToughness() {
            return this.toughness;
        }

        public float getKnockbackResistance() {
            return this.knockbackResistance;
        }
}

 

6 minutes ago, awesomedude3595 said:

Is there a way I can get this to work in 1.16.5 I had already set it up as on the website you sent but it doesn't appear to work in 1.16.5

1.16.5 uses mojmap mappings and as such the method names are different compared to mcp when this tutorial was written. You will need to use either the forge bot on discord or linkie to find the translations. Eventually, I'll get around to updating this as there are a few better things to do in the current code like instead of sticking it in an interface to use DistExecutor and call somewhere else.

 

1 minute ago, awesomedude3595 said:

"silver"

You should specify the modid in the string name; otherwise, this will conflict with other mods adding silver armor.

2 minutes ago, awesomedude3595 said:

@OnlyIn(Dist.CLIENT)

Never use OnlyIn. It is for forge internal use only.

  • Author
9 minutes ago, ChampionAsh5357 said:

1.16.5 uses mojmap mappings and as such the method names are different compared to mcp when this tutorial was written. You will need to use either the forge bot on discord or linkie to find the translations. Eventually, I'll get around to updating this as there are a few better things to do in the current code like instead of sticking it in an interface to use DistExecutor and call somewhere else.

 

You should specify the modid in the string name; otherwise, this will conflict with other mods adding silver armor.

Never use OnlyIn. It is for forge internal use only.

thx I made these changes and now it works!!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.