Posted March 11, 201312 yr Hey guys, I am basically making a series of wands so I need to be able to make them spawn in entities. I managed to get my ender pearl wand working quite easily, but my TNT wand doesn't seem to spawn in the TNT entity on right click. It plays the fuse sound but no entity is spawned Here is my code: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par2World.playSoundAtEntity(par3EntityPlayer, "random.fuse", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityTNTPrimed(par2World)); par1ItemStack.damageItem(1, par3EntityPlayer); } return par1ItemStack; } If anyone could help out that would be great.
March 12, 201312 yr you need to setRotation and angles... take a look how ItemMonsterPlace spawns an entity.
March 12, 201312 yr Man, you aren't setting coordinates of TNT. par2World.spawnEntityInWorld( new EntityTNTPrimed(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ) ); mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
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.