Jump to content

Is there any way to modify a vanilla ItemGroup/Tab? [1.16.5]


Recommended Posts

I am in the process of creating a food mod and I'm wondering if it's possible to change the icon of the vanilla Food tab as well as remove certain vanilla items from that tab. I have changed it's name to "Food - Misc" in my mod's en_us.lang so that isn't a problem.


Edited by OrenjiAo64
Missed out version number in title
Link to comment
Share on other sites

  • OrenjiAo64 changed the title to Is there any way to modify a vanilla ItemGroup/Tab? [1.16.5]
On 5/16/2021 at 8:39 PM, diesieben07 said:

using reflection

I'm not exactly sure how to use reflection. I've tried looking it up but I haven't been able to find anything about the newer ObfuscationReflectionHelper in 1.16. I currently have this:

Field field = ObfuscationReflectionHelper.findField(ItemGroup.class, "iconItemStack");
field.set(ItemGroup.TAB_FOOD, new ItemStack(Items.COOKIE));

I have also tried replacing "iconItemStack" with "field_151245_t" but I'm still not sure how to do this.

EDIT: I'm getting the error:

IllegalAccessException – if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final


Edited by OrenjiAo64
Added the error at the bottom.
Link to comment
Share on other sites

I get when I try to run it:

error: unreported exception IllegalAccessException; must be caught or declared to be thrown
        field.set(ItemGroup.TAB_FOOD, Items.COOKIE);

In the IDE I have:

Unhandled exception: java.lang.IllegalAccessException

That's everything.

Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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