Jump to content

[1.15.2] Adding vanilla items with NBT data to a new Creative Tab


squidlex

Recommended Posts

Hi there,

I'm trying to add existing vanilla items to a new Creative Tab.

I've already created my tab, but I don't know how to add vanilla items, let alone with NBT data stored in them.

 

Say for example I want to add a chest with NBT data to a new tab.

 

Any help would be greatly appreciated!

Link to comment
Share on other sites

8 hours ago, diesieben07 said:

Override fill in your ItemGroup class and add whatever stacks you desire to the provided list.

 

8 hours ago, TheGreyGhost said:

A working example is here

Thank you both for you replies!

 

Would you be able to explain why this won't show up? It worked with modded items but not when using the override method.

public class ModItemGroup extends ItemGroup {

	public ModItemGroup(int index, String label) {
		super(index, label);
	}

	@Override
	public ItemStack createIcon() {
		return new ItemStack(Items.DRAGON_EGG);
	}

	@Override
	public void fill(NonNullList<ItemStack> items) {
		items.add(new ItemStack(Items.DRAGON_EGG));
	}
}

 

I fixed it, it was an error with me hardcoding an index like an idiot.

Thanks for all your help!

Edited by squidlex
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.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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