shirtandtieler Posted July 15, 2016 Posted July 15, 2016 Hello all, I've thoroughly scoured the internet to the best of my abilities as to how to add vanilla spawn eggs to crafting recipes, but can't seem to figure it out - most results are concerning just adding custom spawn eggs to the game, which is not what I'm trying to do; other results that were semi-helpful mostly were incomplete answers or for a much earlier version. I've tried adding the data value to the ItemStack object, for example: ItemStack spawnEgg_zombie = new ItemStack(Items.SPAWN_EGG, 1, 54); But all that gives me is a generic spawn egg. I know giving a player a zombie spawn egg in game requires the command: /give <PLAYER> minecraft:spawn_egg 1 0 {EntityTag:{id:Zombie}} So I figure I need to make use of the initializer for an ItemStack object that requires an "NBTTagCompound". However the part that I'm confused at is nesting the tags to produce a result similar to the in-game command (assuming that this is the correct way to go about this). I've tried various different things using NBTTagCompound variables, but none of them seemed to give me anything but a generic spawn egg. If any help could be given, I'd greatly appreciate it! Quote
Choonster Posted July 15, 2016 Posted July 15, 2016 Create the ItemStack of Items.SPAWN_EGG , then call ItemMonsterPlacer.applyEntityIdToItemStack to set the ItemStack 's spawned entity ID. Look at the implementation of this method to see how it produces the same NBT structure as you'd use in the command. Quote 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.
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.