File size: 2,104 Bytes
d517dc9 | 1 2 3 4 5 | {"type": "session", "harness": "opencode", "id": "mc-0045", "name": "Tool Tiers"}
{"type": "message", "message": {"role": "system", "content": "You are an expert Fabric mod developer. You write idiomatic Minecraft Fabric mods using Java, Fabric API, and Yarn mappings."}}
{"type": "message", "message": {"role": "user", "content": "How do I create custom tool materials and armor materials in Fabric?"}}
{"type": "message", "message": {"role": "assistant", "content": "```java\npackage com.example.mymod;\n\nimport net.minecraft.item.ArmorItem;\nimport net.minecraft.item.ArmorMaterial;\nimport net.minecraft.item.ToolMaterial;\nimport net.minecraft.recipe.Ingredient;\nimport net.minecraft.sound.SoundEvents;\n\npublic class MyToolMaterials {\n public static final ToolMaterial CUSTOM_TOOL = new ToolMaterial(\n 4, 1500, 8.0f, 4.0f, 15\n );\n\n public static final ToolItem CUSTOM_PICKAXE = new PickaxeItem(\n CUSTOM_TOOL,\n new Item.Settings().attributeModifiers(PickaxeItem.createAttributeModifiers(CUSTOM_TOOL, 1, -2.8f))\n );\n\n public static final ToolItem CUSTOM_AXE = new AxeItem(\n CUSTOM_TOOL,\n new Item.Settings().attributeModifiers(AxeItem.createAttributeModifiers(CUSTOM_TOOL, 5.0f, -3.0f))\n );\n\n public static final ToolItem CUSTOM_SWORD = new SwordItem(\n CUSTOM_TOOL,\n new Item.Settings().attributeModifiers(SwordItem.createAttributeModifiers(CUSTOM_TOOL, 3, -2.4f))\n );\n\n public static final ArmorMaterial CUSTOM_ARMOR = new ArmorMaterial(\n 15, 0.8f, 18, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE,\n 3.0f, 0.1f, Ingredient.ofItems(MyItems.CUSTOM_INGOT)\n );\n\n public static final ArmorItem CUSTOM_HELMET = new ArmorItem(\n CUSTOM_ARMOR, ArmorItem.Type.HELMET,\n new Item.Settings().maxDamage(ArmorItem.Type.HELMET.getMaxDamage(15))\n );\n\n public static final ArmorItem CUSTOM_CHESTPLATE = new ArmorItem(\n CUSTOM_ARMOR, ArmorItem.Type.CHESTPLATE,\n new Item.Settings().maxDamage(ArmorItem.Type.CHESTPLATE.getMaxDamage(15))\n );\n}\n```"}}
|