ModItems.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package me.km.items;
  2. import me.km.KajetansMod;
  3. import net.minecraft.creativetab.CreativeTabs;
  4. import net.minecraft.init.SoundEvents;
  5. import net.minecraft.inventory.EntityEquipmentSlot;
  6. import net.minecraft.item.Item;
  7. import net.minecraft.item.ItemArmor.ArmorMaterial;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraftforge.common.util.EnumHelper;
  10. import net.minecraftforge.fml.common.registry.GameRegistry;
  11. public class ModItems
  12. {
  13. /*
  14. harvestLevel, maxUses, efficiency, damageVsEntity, enchantability
  15. WOOD(0, 59, 2.0F, 0.0F, 15),
  16. STONE(1, 131, 4.0F, 1.0F, 5),
  17. IRON(2, 250, 6.0F, 2.0F, 14),
  18. DIAMOND(3, 1561, 8.0F, 3.0F, 10),
  19. GOLD(0, 32, 12.0F, 0.0F, 22);
  20. ATTACK_DAMAGES {6.0F, 8.0F, 8.0F, 8.0F, 6.0F}
  21. ATTACK_SPEEDS { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F}
  22. */
  23. public static final Item.ToolMaterial TOOL_COPPER =
  24. EnumHelper.addToolMaterial("COPPER", 1, 168, 8, 1, 18);
  25. /*
  26. String nameIn, int maxDamageFactorIn, int[] damageReductionAmountArrayIn,
  27. int enchantabilityIn, SoundEvent soundEventIn, float toughnessIn
  28. LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F),
  29. CHAIN("chainmail", 15, new int[]{1, 4, 5, 2}, 12, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN, 0.0F),
  30. IRON("iron", 15, new int[]{2, 5, 6, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F),
  31. GOLD("gold", 7, new int[]{1, 3, 5, 2}, 25, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F),
  32. DIAMOND("diamond", 33, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2.0F);
  33. */
  34. public static final ArmorMaterial ARMOR_COPPER =
  35. EnumHelper.addArmorMaterial("COPPER", KajetansMod.MODID + ":copper", 10,
  36. new int[]{1, 4, 5, 2}, 20, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN, 0);
  37. public static ItemBase copperIngot;
  38. public static ItemBase copperNugget;
  39. public static ItemSword copperSword;
  40. public static ItemSpade copperShovel;
  41. public static ItemPickaxe copperPickaxe;
  42. public static ItemAxe copperAxe;
  43. public static ItemHoe copperHoe;
  44. public static ItemArmor copperHelmet;
  45. public static ItemArmor copperChestplate;
  46. public static ItemArmor copperLeggings;
  47. public static ItemArmor copperBoots;
  48. public static ItemWand woodenWand;
  49. public static ItemScroll scroll;
  50. public static void init()
  51. {
  52. copperIngot = register(new ItemBase("copper_ingot", "ingotCopper").setCreativeTab(CreativeTabs.MATERIALS));
  53. copperNugget = register(new ItemBase("copper_nugget", "copperNugget").setCreativeTab(CreativeTabs.MATERIALS));
  54. copperSword = register(new ItemSword(TOOL_COPPER, "copper_sword", "swordCopper"));
  55. copperShovel = register(new ItemSpade(TOOL_COPPER, "copper_shovel", "shovelCopper"));
  56. copperPickaxe = register(new ItemPickaxe(TOOL_COPPER, "copper_pickaxe", "pickaxeCopper"));
  57. copperAxe = register(new ItemAxe(TOOL_COPPER, 7, -3.1f, "copper_axe", "hatchetCopper"));
  58. copperHoe = register(new ItemHoe(TOOL_COPPER, "copper_hoe", "hoeCopper"));
  59. copperHelmet = register(new ItemArmor(ARMOR_COPPER, EntityEquipmentSlot.HEAD, "copper_helmet", "helmetCopper"));
  60. copperChestplate = register(new ItemArmor(ARMOR_COPPER, EntityEquipmentSlot.CHEST, "copper_chestplate", "chestplateCopper"));
  61. copperLeggings = register(new ItemArmor(ARMOR_COPPER, EntityEquipmentSlot.LEGS, "copper_leggings", "leggingsCopper"));
  62. copperBoots = register(new ItemArmor(ARMOR_COPPER, EntityEquipmentSlot.FEET, "copper_boots", "bootsCopper"));
  63. woodenWand = register(new ItemWand("wood_wand", "wandWood", Item.ToolMaterial.WOOD, 1));
  64. scroll = register((ItemScroll) new ItemScroll("scroll", "scroll").setCreativeTab(CreativeTabs.MISC));
  65. }
  66. public static void lateInit()
  67. {
  68. TOOL_COPPER.setRepairItem(new ItemStack(copperIngot));
  69. ARMOR_COPPER.setRepairItem(new ItemStack(copperIngot));
  70. }
  71. private static <T extends Item> T register(T item)
  72. {
  73. GameRegistry.register(item);
  74. if(item instanceof ItemModelProvider)
  75. {
  76. ((ItemModelProvider) item).registerItemModel(item);
  77. }
  78. return item;
  79. }
  80. }