Jump to content

Item spawning in Entities onRightClick


milogold

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.