Jump to content

Dwar

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Dwar

  1. Hmm, no, I think I haven't done that. Is that what's the "@Mod.EventBusSubscriber" annotation is for? Edit: Hah, I figured it out now that you pointed it out. I have forgotten that I registered my handler class for the GUI bar that I had made, what a fool... Thanks anyways
  2. Hello, I am new to Minecraft modding, though I have been programming with Java for about a year now. I fired up forge and created a new GUI bar which works fine, I used a bunch of @SubscribeEvent annotations: from destroying blocks to player eating an item and they worked fine. I am using Forge 1.12 Today I wanted to add a new block and checked out the Forge docs, it is said: However, it seems the RegistryEvent.Register event won't fire for me. I tried this both for the Block, Item class. I looked at this thread but didn't figure out what's wrong. Here's a code snippet of my block - related classes: Blocks.java public final class Blocks { public static Block rock; public static void init() { //this method is called at FMLPreInitializationEvent rock = new RockBlock("rock_block"); } @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { System.out.println("registry event test"); // put a break point here but debugging mode won't stop it when starting minecraft or entering a world event.getRegistry().registerAll(Blocks.rock); } // public static void registerRenders() { // registerRender(rock); // } // private static void registerRender(Block block) { // System.out.println(block.getRegistryName()); // Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, // new ModelResourceLocation(block.getRegistryName(), "inventory")); // } } RockBlock.java public class RockBlock extends Block { public RockBlock(String unlocalizedName, Material material, float hardness, float resistance){ super(material); this.setRegistryName("rock_block"); this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); this.setHardness(hardness); this.setResistance(resistance); } public RockBlock(String unlocalizedName, float hardness, float resistance){ this(unlocalizedName, Material.ROCK, hardness, resistance); } public RockBlock(String unlocalizedName){ this(unlocalizedName, 2.0f, 10.0f); } } Does anyone have any ideas how I could fix this issue? Thanks in advance for answers.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.