Posted May 17, 20169 yr How to craft villager spawn eggs? I using the entity id as the id type (like salmon) but this does not work. GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, 1, 120), new Object[] {"BBB", "VAE", "BBB", Character.valueOf('B'), MoDropsItems.biomatter, Character.valueOf('A'), MoDropsItems.adaptive_biomatter, Character.valueOf('V'), MoDropsBlocks.villager_nose, Character.valueOf('E'), Items.emerald});
May 20, 20169 yr Author So like this? GameRegistry.addRecipe(new ItemStack(Items.spawn_egg, "EntityVillager") or net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); nbt.setString("EntityVillager", "120"); GameRegistry.addRecipe(new ItemStack(Items.spawn_egg.setTagCompound(nbt)) I don't really know nbt...
May 20, 20169 yr Author Yes, I looked at it. Okay I got to this, but eclipse says that for "new ItemStack(Items.spawn_egg).setTagCompound(nbt))" it cannot convert from ItemStack to void. net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); nbt.setString("EntityVillager", "120"); ItemStack VillagerEgg = new ItemStack(Items.spawn_egg).setTagCompound(nbt)); GameRegistry.addRecipe(VillagerEgg); new Object[] {"BBB", "VAE", "BBB", Character.valueOf('B'), MoDropsItems.biomatter, Character.valueOf('A'), MoDropsItems.adaptive_biomatter, Character.valueOf('V'), MoDropsBlocks.villager_nose, Character.valueOf('E'), Items.emerald}++;
May 20, 20169 yr Author nbt.string requires two strings. So nbt.setString("120"); (120 is the villager's entity id) wouldn't work. What do I use as a second string?
May 20, 20169 yr That code makes no sense. You need to set the key "entity_name". To the entity string ID. And yes, setTagCompound returns void. nbt.setString("entity_name","EntityVillager");
May 20, 20169 yr This works for me: //Villager Egg GameRegistry.addRecipe(new ItemStack (Items.spawn_egg, 1, 120), new Object [] { "BBB", "BBB", "BBB", 'B', Items.diamond, }); https://scontent-lhr3-1.xx.fbcdn.net/v/t34.0-12/13228057_1001880076528542_159516703_n.png?oh=512a75d717e904d4380aced963874eff&oe=57411A8F[/img] I don't think it's the best way for it and it might have a problem when using it outside your work space but hopefully will work.
May 20, 20169 yr Author Yeah... with some work and wonkiness I can get (Items.spawn_egg, 1, 120) to work, but it is not really a good way. Anyhow, if .setTagCompound(nbt)) returns a void, is there alternative or I convert it?
May 20, 20169 yr Yeah... with some work and wonkiness I can get (Items.spawn_egg, 1, 120) to work, but it is not really a good way. Anyhow, if .setTagCompound(nbt)) returns a void, is there alternative or I convert it? Create the ItemStack , call ItemStack#setTagCompound then pass the ItemStack to GameRegistry.addRecipe . 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.
May 22, 20169 yr Author The number-IDs will not work in 1.9. You should update now. Yes, I'm aware of this so I'm not using number IDs and why do I need to update to 1.9?
May 22, 20169 yr Author My next issue is that the spawn egg is labeled entity.EntityVillager.name. What is the problem now? net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); nbt.setString("entity_name", "EntityVillager"); ItemStack VillagerEgg = new ItemStack(Items.spawn_egg); VillagerEgg.setTagCompound(nbt); GameRegistry.addRecipe((VillagerEgg), new Object[]
May 22, 20169 yr Author Thank you! It works, it doesn't have the brown texture... but everything works!
May 22, 20169 yr Author Yeah... I'll update soon. I'll live with it for now. I want to finish my 1.8.9 version before updating... Thanks diesieben07! Final question: why is forge for 1.9 better than 1.8.9 forge?
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.