Jump to content

[1.7.10]spawing entities create ghost entities


deathsiroj

Recommended Posts

Hi,

 

I am trying to spawn an entity on the right click of an item with this code:

@Override
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) 
{
	if(!world.isRemote)
	{
		Entity entity = new EntityZombie(Minecraft.getMinecraft().theWorld);
		entity.setPosition(player.posX, player.posY, player.posZ);
		world.spawnEntityInWorld(entity);
	}
	return item;

}

 

and then when the entity spawns it just stands there and does nothing. I have also tried going into survival, pushing it around and even trying to hit it but it doesnt work.

Link to comment
Share on other sites

Why are you using

Minecraft.getMinecraft().theWorld

?  This is both client side only and unnecessary as a world object was passed to the method already:

onItemRightClick(ItemStack item, World world, EntityPlayer player)

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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