Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chris.chrispymod;
- import org.apache.logging.log4j.LogManager;
- import org.apache.logging.log4j.Logger;
- import chris.chrispymod.items.ItemCustomAxe;
- import chris.chrispymod.items.ItemCustomPickaxe;
- import chris.chrispymod.lists.ArmorMaterialList;
- import chris.chrispymod.lists.BlockList;
- import chris.chrispymod.lists.ItemList;
- import chris.chrispymod.lists.ToolMaterialList;
- import chris.chrispymod.world.OreGeneration;
- import net.minecraft.block.Block;
- import net.minecraft.block.SoundType;
- import net.minecraft.block.material.Material;
- import net.minecraft.inventory.EntityEquipmentSlot;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemBlock;
- import net.minecraft.item.ItemGroup;
- import net.minecraft.item.ItemHoe;
- import net.minecraft.item.ItemSpade;
- import net.minecraft.item.ItemSword;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.common.MinecraftForge;
- import net.minecraftforge.event.RegistryEvent;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
- import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
- import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
- @Mod("chrispymod")
- public class ChrispyMod
- {
- public static ChrispyMod instance;
- public static final String modid = "chrispymod";
- private static final Logger logger = LogManager.getLogger(modid);
- public static final ItemGroup chrispy = new ChrispyItemGroup();
- public ChrispyMod()
- {
- instance = this;
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);
- MinecraftForge.EVENT_BUS.register(this);
- }
- private void setup(final FMLCommonSetupEvent event)
- {
- OreGeneration.setupOreGeneration();
- logger.info("Setup method registered.");
- }
- private void clientRegistries(final FMLClientSetupEvent event)
- {
- }
- @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
- public static class RegistryEvents
- {
- @SubscribeEvent
- public static void registerItems(final RegistryEvent.Register<Item> event)
- {
- event.getRegistry().registerAll
- (
- // ITEMS
- ItemList.ruby = new Item(new Item.Properties().group(chrispy)).setRegistryName(location("ruby")),
- // TOOLS
- // First # is how much +/- damage each specific tool does. Second # is attack speed.
- ItemList.ruby_pickaxe = new ItemCustomPickaxe(ToolMaterialList.ruby, -2, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_pickaxe")),
- ItemList.ruby_sword = new ItemSword(ToolMaterialList.ruby, 0, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_sword")),
- ItemList.ruby_axe = new ItemCustomAxe(ToolMaterialList.ruby, -1.0f, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_axe")),
- ItemList.ruby_spade = new ItemSpade(ToolMaterialList.ruby, -3.0f, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_spade")),
- ItemList.ruby_hoe = new ItemHoe(ToolMaterialList.ruby, 1.0f, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_hoe")),
- // ARMOR
- ItemList.ruby_helmet = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.HEAD, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_helmet")),
- ItemList.ruby_chestplate = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.CHEST, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_chestplate")),
- ItemList.ruby_leggings = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.LEGS, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_leggings")),
- ItemList.ruby_boots = new ItemArmor(ArmorMaterialList.ruby, EntityEquipmentSlot.FEET, new Item.Properties().group(chrispy)).setRegistryName(location("ruby_boots")),
- // BLOCKS
- ItemList.ruby_block = new ItemBlock(BlockList.ruby_block, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_block.getRegistryName()),
- // ORES
- ItemList.ruby_ore = new ItemBlock(BlockList.ruby_ore, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_ore.getRegistryName()),
- // NETHER ORES
- ItemList.ruby_ore_nether = new ItemBlock(BlockList.ruby_ore_nether, new Item.Properties().group(chrispy)).setRegistryName(BlockList.ruby_ore_nether.getRegistryName())
- );
- logger.info("Items registered.");
- }
- @SubscribeEvent
- public static void registerBlocks(final RegistryEvent.Register<Block> event)
- {
- event.getRegistry().registerAll
- (
- BlockList.ruby_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.1f, 31.0f).sound(SoundType.METAL)).setRegistryName(location("ruby_block"))
- );
- logger.info("Blocks registered.");
- }
- }
- private static ResourceLocation location(String name)
- {
- return new ResourceLocation(modid, name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment