Jump to content

[SOLVED]Adding a humming noise to item when being held in hand


Taji34

Recommended Posts

It is NOT only called in the hotbar. I am testing this as we speak with a shield and it constantly updates as long as it is in your inventory, any slot.

 

 

Javadoc:

Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and update it's contents.

Link to comment
Share on other sites

Hey, so in case anyone was looking at this thread and wanted to know the working code I used, here it is:

public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
     if (par5){
          par2World.playSoundAtEntity(par3Entity, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); //"random.bow" just used as a test
     }
}

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.