Posted July 31, 20196 yr I created an item "Copper Ingot" whose tag is "forge:ingots/copper". I made a constant which contains that tag. public final class ForgeItemTags { public static final Tag<Item> COPPER_INGOT = ItemTags.getCollection().getOrCreate(new ResourceLocation("forge", "ingots/copper")); private ForgeItemTags() {} } And I used Ingredient.fromTag() method to set all copper ingots, including my copper ingot, to be repair materials of copper tools. public enum BiomeOreItemTier implements IItemTier { COPPER(2, 223, 5.7F, 2.0F, 15, Ingredient.fromTag(ForgeItemTags.COPPER_INGOT)); private final int harvestLevel; private final int maxUses; private final float efficiency; private final float attackDamage; private final int enchantability; private final Ingredient repairMaterial; BiomeOreItemTier(int harvestLevel, int maxUses, float efficiency, float attackDamage, int enchantability, Ingredient repairMaterial) { this.harvestLevel = harvestLevel; this.maxUses = maxUses; this.efficiency = efficiency; this.attackDamage = attackDamage; this.enchantability = enchantability; this.repairMaterial = repairMaterial; } /... } Then I used the COPPER ItemTier to make my copper sword. public static final Item COPPER_SWORD = register("copper_sword", new SwordItem(BiomeOreItemTier.COPPER, 3, -2.4F, new Item.Properties().group(BiomeOreItemGroup.BIOME_ORE_TOOL))); But in the game, I cannot repair my sword using my copper ingot. I can't figure out what is wrong with my codes. When I printed the item tag of my copper ingot using onItemRightClick() method in Item class the ingot had the tag "forge:ingots/copper". But it cannot repair my copper tools. How can I fix it?
July 31, 20196 yr while you created the tag, the tag is not filled with anything. For that you must create this json "resources/forge/tags/items/ingots/copper.json" and fill it with { "replace": false, "values": [ "modid:yourCopperIngot" ] } Edited July 31, 20196 yr by cheaterpaul Vampirism
July 31, 20196 yr Author 58 minutes ago, cheaterpaul said: while you created the tag, the tag is not filled with anything. For that you must create this json "resources/forge/tags/items/ingots/copper.json" and fill it with { "replace": false, "values": [ "modid:yourCopperIngot" ] } Of course I made that file, but it didn't work.
July 31, 20196 yr you need to call super() inBiomeOreItemTag and extends TieredItem Edited July 31, 20196 yr by cheaterpaul Vampirism
July 31, 20196 yr while i cant see your whole code, this works for me: package com.example.examplemod; *imports @Mod("examplemod") public class ExampleMod { public static Tag<Item> coppertag = new ItemTags.Wrapper(new ResourceLocation("forge", "ingots/copper")); public ExampleMod() { } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> blockRegistryEvent) { blockRegistryEvent.getRegistry().register(new Item(new Item.Properties().group(ItemGroup.BREWING)).setRegistryName("examplemod:copper")); blockRegistryEvent.getRegistry().register(new SwordItem(new Tier(),4,1,new Item.Properties().group(ItemGroup.BREWING)).setRegistryName("examplemod:coppersword")); } } public static class Tier implements IItemTier{ @Override public int getMaxUses() { return 100; } @Override public float getEfficiency() { return 4; } @Override public float getAttackDamage() { return 2; } @Override public int getHarvestLevel() { return 1; } @Override public int getEnchantability() { return 50; } @Override public Ingredient getRepairMaterial() { return Ingredient.fromTag(coppertag); } public Tier() { } } } but i think the problem is that you need public static final Tag<Item> COPPER_INGOT = new ItemTags.Wrapper(new ResourceLocation("forge", "ingots/copper")); not public static final Tag<Item> COPPER_INGOT = ItemTags.getCollection().getOrCreate(new ResourceLocation("forge", "ingots/copper")); otherwise your copper.json is in a wrong directory Edited July 31, 20196 yr by cheaterpaul Vampirism
July 31, 20196 yr Author 43 minutes ago, cheaterpaul said: while i cant see your whole code, this works for me: package com.example.examplemod; *imports @Mod("examplemod") public class ExampleMod { public static Tag<Item> coppertag = new ItemTags.Wrapper(new ResourceLocation("forge", "ingots/copper")); public ExampleMod() { } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> blockRegistryEvent) { blockRegistryEvent.getRegistry().register(new Item(new Item.Properties().group(ItemGroup.BREWING)).setRegistryName("examplemod:copper")); blockRegistryEvent.getRegistry().register(new SwordItem(new Tier(),4,1,new Item.Properties().group(ItemGroup.BREWING)).setRegistryName("examplemod:coppersword")); } } public static class Tier implements IItemTier{ @Override public int getMaxUses() { return 100; } @Override public float getEfficiency() { return 4; } @Override public float getAttackDamage() { return 2; } @Override public int getHarvestLevel() { return 1; } @Override public int getEnchantability() { return 50; } @Override public Ingredient getRepairMaterial() { return Ingredient.fromTag(coppertag); } public Tier() { } } } but i think the problem is that you need public static final Tag<Item> COPPER_INGOT = new ItemTags.Wrapper(new ResourceLocation("forge", "ingots/copper")); not public static final Tag<Item> COPPER_INGOT = ItemTags.getCollection().getOrCreate(new ResourceLocation("forge", "ingots/copper")); otherwise your copper.json is in a wrong directory It finally works! Thank you very much.
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.