Jump to content

Recommended Posts

Posted

Hey everyone, I have a tool that extends ItemTool since it is a custom tool that does custom things.

 

however since it is custom I have made a custom damage function and custom break function and custom sound on break, this is due to my tool use doesn't destroy any blocks but now I have the problem that when I do use the tool to destroy a block it revers back to the normal onitemuse functions etc.

 

basically since onitemuse does things like damage items and breaks items already the only thing I would like to override is the sound animation of a particular tool (or if possible a ToolMaterial since I am making a custom sound for each material)

 

any help? thanks.

Posted
  On 9/30/2015 at 8:48 PM, diesieben07 said:

This is all very abstract. Could you please show your code?

 

this is my event handlers (onPlayerClickEvent is where I call my 'attemptToDamage' method and in there is where i do my checking and playing sounds etc):

 

  Reveal hidden contents

 

 

and this is my Tool Class (though probably not needed):

 

  Reveal hidden contents

 

Posted

i 'rake' through grass, turning grass to dirt, doing this i also damage my item and play a sound when it breaks, however if i damage the item till it destroyes by 'breaking' blocks it wont play my sound since it uses its own methods to damage on block break. i would like my sound to be played when the tool breaks from block breaking.

Posted
  On 10/1/2015 at 12:39 PM, diesieben07 said:

Listen for

PlaySoundAtEntityEvent

. Check if

event.name

is

random.break

. If so and the entity is living (

instanceof EntityLivingBase

) and holding your Item (

entity.getHeldItem()

), change

event.name

to whatever you wish the sound to be instead.

 

Thanks, no idea there was an event for that.

Posted
  On 10/1/2015 at 12:39 PM, diesieben07 said:

Listen for

PlaySoundAtEntityEvent

. Check if

event.name

is

random.break

. If so and the entity is living (

instanceof EntityLivingBase

) and holding your Item (

entity.getHeldItem()

), change

event.name

to whatever you wish the sound to be instead.

 

what is the exact name of random.break to check against? can't seem to find it at all :(

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.