Skip to content

Instantly share code, notes, and snippets.

@kwpugh kwpugh/gobber2_java
Created Jun 20, 2019

Embed
What would you like to do?
My source code
package com.kwpugh.gobber2;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.kwpugh.gobber2.items.armor.ItemCustomBoots;
import com.kwpugh.gobber2.items.armor.ItemCustomChestplate;
import com.kwpugh.gobber2.items.armor.ItemCustomHelmet;
import com.kwpugh.gobber2.items.armor.ItemCustomLeggings;
import com.kwpugh.gobber2.items.fuels.ItemCustomFoo;
import com.kwpugh.gobber2.items.rings.ItemRingAttraction;
import com.kwpugh.gobber2.items.rings.ItemRingEndermen;
import com.kwpugh.gobber2.items.rings.ItemRingLumberjack;
import com.kwpugh.gobber2.items.rings.ItemRingMiner;
import com.kwpugh.gobber2.items.staffs.ItemStaffSniper;
import com.kwpugh.gobber2.items.staffs.ItemStaffStars;
import com.kwpugh.gobber2.items.tools.ItemCustomAxe;
import com.kwpugh.gobber2.items.tools.ItemCustomHammer;
import com.kwpugh.gobber2.items.tools.ItemCustomPickaxe;
import com.kwpugh.gobber2.items.tools.ItemCustomSword;
import com.kwpugh.gobber2.lists.ArmourMaterialList;
import com.kwpugh.gobber2.lists.BlockList;
import com.kwpugh.gobber2.lists.ItemList;
import com.kwpugh.gobber2.lists.ToolMaterialList;
import com.kwpugh.gobber2.util.Gobber2ItemGroup;
import com.kwpugh.gobber2.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.ItemBlock;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemSpade;
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("gobber2")
public class Gobber2
{
public static Gobber2 instance;
public static final String modid = "gobber2";
private static final Logger logger = LogManager.getLogger(modid);
public static final ItemGroup gobber2 = new Gobber2ItemGroup();
public Gobber2()
{
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)
{
logger.info("clientRegistries method registered.");
}
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents
{
@SubscribeEvent
public static void registerItems(final RegistryEvent.Register<Item> event)
{
event.getRegistry().registerAll
(
ItemList.gobber2_ore = new ItemBlock(BlockList.gobber2_ore, new Item.Properties().group(gobber2)).setRegistryName(BlockList.gobber2_ore.getRegistryName()),
ItemList.gobber2_ore_nether = new ItemBlock(BlockList.gobber2_ore_nether, new Item.Properties().group(gobber2)).setRegistryName(BlockList.gobber2_ore_nether.getRegistryName()),
ItemList.gobber2_ore_end = new ItemBlock(BlockList.gobber2_ore_end, new Item.Properties().group(gobber2)).setRegistryName(BlockList.gobber2_ore_end.getRegistryName()),
ItemList.gobber2_ingot = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ingot")),
ItemList.gobber2_rod = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_rod")),
ItemList.gobber2_block = new ItemBlock(BlockList.gobber2_block, new Item.Properties().group(gobber2)).setRegistryName(BlockList.gobber2_block.getRegistryName()),
ItemList.gobber2_glob = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_glob")),
ItemList.gobber2_sword = new ItemCustomSword(ToolMaterialList.gobber2, 0, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_sword")),
ItemList.gobber2_pickaxe = new ItemCustomPickaxe(ToolMaterialList.gobber2, -12, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_pickaxe")),
ItemList.gobber2_hammer = new ItemCustomHammer(ToolMaterialList.gobber2, -12, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_hammer")),
ItemList.gobber2_shovel = new ItemSpade(ToolMaterialList.gobber2, -12.0f, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_shovel")),
ItemList.gobber2_axe = new ItemCustomAxe(ToolMaterialList.gobber2, -12.0f, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_axe")),
ItemList.gobber2_hoe = new ItemHoe(ToolMaterialList.gobber2, 6.0f, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_hoe")),
ItemList.gobber2_helmet = new ItemCustomHelmet(ArmourMaterialList.gobber2, EntityEquipmentSlot.HEAD, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_helmet")),
ItemList.gobber2_chestplate = new ItemCustomChestplate(ArmourMaterialList.gobber2, EntityEquipmentSlot.CHEST, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_chestplate")),
ItemList.gobber2_leggings = new ItemCustomLeggings(ArmourMaterialList.gobber2, EntityEquipmentSlot.LEGS, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_leggings")),
ItemList.gobber2_boots = new ItemCustomBoots(ArmourMaterialList.gobber2, EntityEquipmentSlot.FEET, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_boots")),
ItemList.gobber2_goo = new ItemFood(8, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_goo")),
ItemList.gobber2_gooey_bread = new ItemFood(9, 1, false, new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_gooey_bread")),
ItemList.gobber2_foo = new ItemCustomFoo(new Item.Properties().group(gobber2), "gobber2_foo", 64000),
ItemList.gobber2_ring = new Item(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ring")),
ItemList.gobber2_ring_endermen = new ItemRingEndermen(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ring_endermen")),
ItemList.gobber2_ring_miner = new ItemRingMiner(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ring_miner")),
ItemList.gobber2_ring_lumberjack = new ItemRingLumberjack(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ring_lumberjack")),
ItemList.gobber2_ring_attraction = new ItemRingAttraction(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_ring_attraction")),
ItemList.gobber2_staff_stars = new ItemStaffStars(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_staff_stars")),
ItemList.gobber2_staff_sniper = new ItemStaffSniper(new Item.Properties().group(gobber2)).setRegistryName(location("gobber2_staff_sniper"))
);
logger.info("Items registered.");
}
@SubscribeEvent
public static void registerBlocks(final RegistryEvent.Register<Block> event)
{
event.getRegistry().registerAll
(
BlockList.gobber2_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(2.0f, 3.0f).lightValue(5).sound(SoundType.METAL)).setRegistryName(location("gobber2_block")),
BlockList.gobber2_ore = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0f, 3.0f).lightValue(15).sound(SoundType.METAL)).setRegistryName(location("gobber2_ore")),
BlockList.gobber2_ore_nether = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0f, 3.0f).lightValue(15).sound(SoundType.METAL)).setRegistryName(location("gobber2_ore_nether")),
BlockList.gobber2_ore_end = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0f, 3.0f).lightValue(15).sound(SoundType.METAL)).setRegistryName(location("gobber2_ore_end"))
);
logger.info("Blocks registered.");
}
private static ResourceLocation location(String name)
{
return new ResourceLocation(modid, name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.