Jeuxt Posted November 26, 2023 Posted November 26, 2023 Here is my code public static final RegistryObject<Item> Example = Items.register("example",() -> new Item(new Item.Properties().food(Example).tab(CreativeModeTab.TAB_FOOD))); anyone know how to put it after apple in minecraft CreativeModeTab.TAB_FOOD? Quote
JimiIT92 Posted December 26, 2023 Posted December 26, 2023 I don't think that's possible easily without accessing the vanilla classes (using an AT and some Mixins). If 1.18 is not a requirement (quick note: 1.18 is no longer supported), you can upgrade to 1.20.x and listen for the BuildCreativeModeTabContentsEvent. In this event you can check when a Creative Tab is being "constructed" (either a Vanilla Tab or a Modded Tab) and decide if you want to do something with it (tipically add an Item to that tab). In your case you could add your Item before the vanilla Apple using the putBefore / putAfter methods. For instance, here I'm adding an Apple before the Bone Meal in the Ingredients Tab @SubscribeEvent public static void onTabBuildContents(final BuildCreativeModeTabContentsEvent event) { final ResourceKey<CreativeModeTab> tab = event.getTabKey(); if(tab.equals(CreativeModeTabs.INGREDIENTS)) { event.getEntries().putBefore(Items.BONE_MEAL.getDefaultInstance(), Items.APPLE.getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS); } } And in game, if we open the Ingredients tab, we get this result Quote Don't blame me if i always ask for your help. I just want to learn to be better
Jeuxt Posted January 7 Author Posted January 7 oh thats impressive! I was thinking how to do it for hours! Thanks for help JimilT92 Quote
Recommended Posts
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.