Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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});

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

  • 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}++;

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");

This works for me:

 

//Villager Egg
	GameRegistry.addRecipe(new ItemStack (Items.spawn_egg, 1, 120),
					new Object [] {
							"BBB",
							"BBB",
							"BBB",
							'B', Items.diamond,
			});

 

width=428 height=158https://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.

  • 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?

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.

  • 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[]

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.