cjcj55

Main

Jul 11th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. package chris.chrispymod;
  2.  
  3. import org.apache.logging.log4j.LogManager;
  4. import org.apache.logging.log4j.Logger;
  5.  
  6. import chris.chrispymod.items.ItemCustomAxe;
  7. import chris.chrispymod.items.ItemCustomPickaxe;
  8. import chris.chrispymod.lists.ArmorMaterialList;
  9. import chris.chrispymod.lists.BlockList;
  10. import chris.chrispymod.lists.ItemList;
  11. import chris.chrispymod.lists.ToolMaterialList;
  12. import chris.chrispymod.world.OreGeneration;
  13. import net.minecraft.block.Block;
  14. import net.minecraft.block.SoundType;
  15. import net.minecraft.block.material.Material;
  16. import net.minecraft.inventory.EntityEquipmentSlot;
  17. import net.minecraft.item.Item;
  18. import net.minecraft.item.ItemArmor;
  19. import net.minecraft.item.ItemBlock;
  20. import net.minecraft.item.ItemGroup;
  21. import net.minecraft.item.ItemHoe;
  22. import net.minecraft.item.ItemSpade;
  23. import net.minecraft.item.ItemSword;
  24. import net.minecraft.util.ResourceLocation;
  25. import net.minecraftforge.common.MinecraftForge;
  26. import net.minecraftforge.event.RegistryEvent;
  27. import net.minecraftforge.eventbus.api.SubscribeEvent;
  28. import net.minecraftforge.fml.common.Mod;
  29. import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
  30. import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
  31. import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
  32.  
  33. @Mod("chrispymod")
  34. public class ChrispyMod
  35. {
  36. public static ChrispyMod instance;
  37. public static final String modid = "chrispymod";
  38. private static final Logger logger = LogManager.getLogger(modid);
  39.  
  40. public static final ItemGroup chrispy = new ChrispyItemGroup();
  41.  
  42. public ChrispyMod()
  43. {
  44. instance = this;
  45.  
  46. FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
  47. FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);
  48.  
  49. MinecraftForge.EVENT_BUS.register(this);
  50. }
  51.  
  52. private void setup(final FMLCommonSetupEvent event)
  53. {
  54. OreGeneration.setupOreGeneration();
  55. logger.info("Setup method registered.");
  56. }
  57.  
  58. private void clientRegistries(final FMLClientSetupEvent event)
  59. {
  60.  
  61. }
  62.  
  63. @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
  64. public static class RegistryEvents
  65. {
  66. @SubscribeEvent
  67. public static void registerItems(final RegistryEvent.Register<Item> event)
  68. {
  69. event.getRegistry().registerAll
  70. (
  71. // ITEMS
  72. ItemList.ruby = new Item(new Item.Properties().group(chrispy)).setRegistryName(location("ruby")),
  73.  
  74. // TOOLS
  75. // First # is how much +/- damage each specific tool does. Second # is attack speed.
  76. ItemList.ruby_pickaxe = new ItemCustomPickaxe(ToolMaterialList.ruby, -2, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_pickaxe")),
  77. ItemList.ruby_sword = new ItemSword(ToolMaterialList.ruby, 0, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_sword")),
  78. ItemList.ruby_axe = new ItemCustomAxe(ToolMaterialList.ruby, -1.0f, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_axe")),
  79. ItemList.ruby_spade = new ItemSpade(ToolMaterialList.ruby, -3.0f, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_spade")),
  80. ItemList.ruby_hoe = new ItemHoe(ToolMaterialList.ruby, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_hoe")),
  81.  
  82. // ARMOR
  83. ItemList.ruby_helmet = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.HEAD, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_helmet")),
  84. ItemList.ruby_chestplate = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.CHEST, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_chestplate")),
  85. ItemList.ruby_leggings = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.LEGS, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_leggings")),
  86. ItemList.ruby_boots = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.FEET, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_boots")),
  87.  
  88. // BLOCKS
  89. ItemList.ruby_block = new ItemBlock(BlockList.ruby_block, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_block.getRegistryName()),
  90.  
  91. // ORES
  92. ItemList.ruby_ore = new ItemBlock(BlockList.ruby_ore, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_ore.getRegistryName()),
  93.  
  94. // NETHER ORES
  95. ItemList.ruby_ore_nether = new ItemBlock(BlockList.ruby_ore_nether, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_ore_nether.getRegistryName())
  96.  
  97. );
  98.  
  99. logger.info("Items registered.");
  100. }
  101.  
  102. @SubscribeEvent
  103. public static void registerBlocks(final RegistryEvent.Register<Block> event)
  104. {
  105. event.getRegistry().registerAll
  106. (
  107. BlockList.ruby_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.1f, 31.0f).sound(SoundType.METAL)).setRegistryName(location("ruby_block"))
  108.  
  109. );
  110.  
  111. logger.info("Blocks registered.");
  112. }
  113. }
  114.  
  115. private static ResourceLocation location(String name)
  116. {
  117. return new ResourceLocation(modid, name);
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment