Posted July 8, 20205 yr What exactly is the danger of doing the following: public static final Block MOD_BLOCK = new ModBlock(); @SubscribeEvent public static void onRegisterBlocks(Register<Block> event) { MOD_BLOCK.setRegistryName("mod_block"); event.getRegistry().register(MOD_BLOCK); } instead of: public static Block MOD_BLOCK; @SubscribeEvent public static void onRegisterBlocks(Register<Block> event) { MOD_BLOCK = new ModBlock(); MOD_BLOCK.setRegistryName("mod_block"); event.getRegistry().register(MOD_BLOCK); } The Forge documentation is somewhat unclear on this topic, mainly just implying that it causes issues when introducing DeferredRegisters.
July 8, 20205 yr Because you never know when a static block will execute, and if it executes too early, Forge can't insure that it has full control over the object. (Forge does lots of lots of behind the scenes magic and dangerous sorcery that you, as a modder, don't need to worry about, but that if it isn't done in order, things break) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.