Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

  • 4 weeks later...

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

spacer.png

 

Don't blame me if i always ask for your help. I just want to learn to be better :)

  • 2 weeks later...
  • Author

oh thats impressive!

I was thinking how to do it for hours!

Thanks for help JimilT92

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.