Jump to content

[1.11.2] Crafting NBT


OIWeirdo

Recommended Posts

So I was bored and decided to make a mod that would allow me to craft spawn eggs. The only issue I have is that I have no clue how to edit the NBT of the output so it sets the egg to spawn a specified mob.

 

GameRegistry.addShapedRecipe(new ItemStack(Items.SPAWN_EGG, 1, 93), new Object[] { "FEF", "EIE", "FEF", 'E', Items.EGG, 'F', Items.EMERALD, 'I', Items.FEATHER });

 

The recipe is registered and works but I end up with a blank spawn egg. (The above is supposed to allow me to craft a chicken egg)

Link to comment
Share on other sites

8 minutes ago, diesieben07 said:

To apply the entity ID to the stack use ItemMonterPlacer::applyEntityIdToItemStack.

 

This method is marked as client-only in 1.11.2, so you can't call it directly. Instead, you need to create your own method that does the same thing.

 

It's no longer client-only in 1.12 (because Forge patches Item#getSubItems and the methods used by it to be available on both sides), so you can use it directly.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.