I've registered the Block (or at least, I think I did) using this code:
@SubscribeEvent
public void onRegistryRegisterBlock(RegistryEvent.Register<Block> event) {
event.getRegistry().register(MyMainModClass.creepyFace01);
}
@SubscribeEvent
public void onRegistryRegisterItem(RegistryEvent.Register<Item> event) {
event.getRegistry().register(MyMainModClass.itemCreepyFace01);
}
The unlocalized name of the Block I'm trying to register is "creepy_face_01". Here's how I created the references in my main mod class:
public static Block creepyFace01 = new CreepyFace01();
public static ItemBlock itemCreepyFace01 = new ItemBlock(creepyFace01);
And here's the Block class:
String unlocalizedName = "creepy_face_01";
float hardness = 60f;
float resistance = 4000f;
public CreepyFace01() {
super(Material.ROCK);
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(MinecraftStoryMod.modID, this.unlocalizedName);
this.setHardness(hardness);
this.setResistance(resistance);
this.setHarvestLevel("axe", 3);
this.setCreativeTab(CreativeTabs.DECORATIONS);
}
And yes, the class extends Block. I think I registered the event handlers correctly since I included @Mod.EventBusSubscriber in my code. I'm also using proxies. I'm using Minecraft Forge 1.12.1 14.22.0.2469.
If you're using
@Mod.EventBusSubscriber
to register your event handler class, the handler methods (onRegistryRegisterBlock
andonRegistryRegisterItem
for you) need to be static, otherwise they will not be called.