Posted February 26, 20187 yr Hey! So I recently updated my mod to 1.12.2. Now, I know there is this new efficient way of registering Items and Blocks via the Registry Events, but I'm not too sure how you do that... This is what I currently have: public static void registerItem(Item item) { item.setCreativeTab(Dinocraft.ITEMS); ForgeRegistries.ITEMS.register(item); Utils.getLogger().info("Registered item: " + item.getUnlocalizedName().substring(5)); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, item.getUnlocalizedName().substring(5)), "inventory")); Utils.getLogger().info("Registered render for " + item.getUnlocalizedName().substring(5)); } public static void register() { //Food registerItem(POTATOSHROOM_PIE); registerItem(CHUNKY_FLESH); //Material registerItem(CHLOROPHYTE_INGOT); registerItem(FLOBBER_INGOT); registerItem(SHEEPLITE_INGOT); registerItem(PEBBLES); registerItem(CRACKED_PEBBLES); registerItem(LEAF); registerItem(BLEVENT_INGOT); registerItem(RANIUM); registerItem(PEBBELONEUM); //? registerItem(TUSKERERS_HEART); registerItem(TUSKERERS_CHARM); //WIP registerItem(VINE_BALL); registerItem(SLINGSHOT); registerItem(VINE_BALL_BUNDLE); registerItem(POISON_BALL); registerItem(POISON_BEATLER); registerItem(RAY_BULLET); registerItem(RAY_GUN); } public static void registerRenders() { //Food registerRender(POTATOSHROOM_PIE); registerRender(CHUNKY_FLESH); //Material registerRender(CHLOROPHYTE_INGOT); registerRender(FLOBBER_INGOT); registerRender(SHEEPLITE_INGOT); registerRender(PEBBLES); registerRender(CRACKED_PEBBLES); registerRender(LEAF); registerRender(BLEVENT_INGOT); registerRender(RANIUM); registerRender(PEBBELONEUM); //? registerRender(TUSKERERS_HEART); registerRender(TUSKERERS_CHARM); //WIP registerRender(VINE_BALL); registerRender(SLINGSHOT); registerRender(VINE_BALL_BUNDLE); registerRender(POISON_BALL); registerRender(POISON_BEATLER); registerRender(RAY_BULLET); registerRender(RAY_GUN); } I mean this works and does the job perfectly fine, but I heard that the recommended way of registering it is by using the registry events. Any help is welcome. Thanks! Edited February 26, 20187 yr by Differentiation
February 26, 20187 yr Well, that's wrong, obviously. You want to register with events? Write an event handler. http://mcforge.readthedocs.io/en/latest/concepts/registries/#registering-things 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.
February 26, 20187 yr Author 6 minutes ago, Draco18s said: Well, that's wrong, obviously. You want to register with events? Write an event handler. http://mcforge.readthedocs.io/en/latest/concepts/registries/#registering-things So it's just as simple as this?: @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(block1, block2, ...); }
February 26, 20187 yr Yes 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.