Jump to content

Recommended Posts

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

 

 

Posted

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.

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

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

Posted

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.

Posted (edited)

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
Posted

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

Posted

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.

Posted

Completely breaks the minecraft aesthetic.

  • Like 1

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

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