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

I am searching now for ages, how to get a specified spawn egg.

What ever i try, i only get a white spawn egg, that can't spawn anything.

Here's what i've tried at last.

Spoiler

	public static Item spawnEgg = getSpawnEgg();
	public static Item getSpawnEgg()
	{
		ItemStack stack = new ItemStack(Items.SPAWN_EGG, 1);
        ItemMonsterPlacer.applyEntityIdToItemStack(stack, "thewizardmod.MiniZombie");
		return stack.getItem();
	}

 

 

An Item instance only represents an item type, in this case the spawn egg. To store any more data (e.g. the entity spawned by the egg), you need the metadata/NBT of an ItemStack.

 

You create an ItemStack with the NBT data required to spawn a "thewizardmod.MiniZombie" entity but then immediately discard it by returning the Item from the method rather than the ItemStack.

 

Which version of Minecraft are you using?

 

If you're using 1.9-1.11.2, ItemMonsterPlacer.applyEntityIdToItemStack is a client-only method that can't be used from common code.

 

If you're using 1.11+, "thewizardmod.MiniZombie" is in the wrong format for a mod entity's registry name; it's a ResourceLocation so it should be lowercase and in the format "modid:entity_name".

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

It's MC 1.10.2

I don't need the ItemStack. I need the Item it self. What else to do, then stack,getItem() to get it?

 

8 minutes ago, Dustpuppy said:

It's MC 1.10.2

I don't need the ItemStack. I need the Item it self. What else to do, then stack,getItem() to get it?

 

The Item is just "Spawn Egg". If you want "Spawn Egg of Mini Zombie", you need an ItemStack.

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

Shit. Then i have to find another way to give player an item he can use to spawn the entity. Don't want to rewrite the whole crafting code, i have.

 

  • Author

Is there a way to make an item from an entity? Then i could give the player this to spawn the entity.

 

Just now, Dustpuppy said:

Is there a way to make an item from an entity? Then i could give the player this to spawn the entity.

 

You'd have to make your own Item like the spawn egg that only spawns one entity type rather than whatever's specified in the NBT.

 

I'd recommend reworking your code to use an ItemStack rather than just an Item.

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.

Yes, it's an ItemStack(SpawnEgg) with NBT data indicating what entity to spawn.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

You could try either making your own spawn egg and look at my code. if you copy and paste give me credit.

https://github.com/jredfox/silkspawners/tree/master/src/main/java/com/EvilNotch/silkspawners

 

Or you could download silk spawners mod which already adds in eggs to the creative tab for missing eggs your choice. Note it might add eggs for 1.9+ that are not there as it's not fully tested with the new egg system but, still should work.

https://minecraft.curseforge.com/projects/silk-spawners-forge-edition

Edited by jredfox
adding text

  • Author

Too late. Have made an item, that can be crafted on the altar and used to spawn the zombie. This little zombies are like golems. They can do stupid work, but have no brain for more. Like politics xD

wJOosx2.png

4TlNQXM.png

INkV4mi.png

Why does its inventory icon look rotated?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Completely breaks the minecraft aesthetic.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.