Jump to content

Recommended Posts

Posted

Hello!

 

I've run into a problem when trying to add a fireworks sound to one of my items. Here is the code I'm using:

public ItemStack onItemRightClick(ItemStack par1ItemStack, World world, EntityPlayer par3EntityPlayer)
{
	if (!par3EntityPlayer.capabilities.isCreativeMode)
        {
            --par1ItemStack.stackSize;
        }

	world.playSoundAtEntity(par3EntityPlayer, "fireworks.launch1", 0.5F, 0.4F);

	if (!world.isRemote) 
	{
		Vec3 look = par3EntityPlayer.getLookVec();
		EntitySDRune wskull = new EntitySDRune(world, par3EntityPlayer, 1, 1, 1);
		wskull.setPosition(
				par3EntityPlayer.posX,
				par3EntityPlayer.posY + 1.620,
				par3EntityPlayer.posZ);
		wskull.accelerationX = look.xCoord * 0.1;
		wskull.accelerationY = look.yCoord * 0.1;
		wskull.accelerationZ = look.zCoord * 0.1;
		world.spawnEntityInWorld(wskull);
	}

	return par1ItemStack;
}

 

This is the line that should add the sound:

world.playSoundAtEntity(par3EntityPlayer, "fireworks.launch1", 0.5F, 0.4F);

 

fireworks.launch1 is a default minecraft sound (the sound when you launch a fireworks rocket). But for some reason this doesn't work.

Whenever I replace the fireworks.launch1 with random.bow it does play a bowsound.

 

Does anyone know what I did wrong here? I've been stuck on this londer than I'd like to admit :P

Posted

Nevermind this question. I realised how much of an idiot I was since I could just look at the EntityFireworkRocket and see how they did it there...

 

For the people wondering, it has to be fireworks.launch instead of fireworks.launch1

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.