Override ranged weapon hit sound

Started by Devilkin1987 on Tue, 03/19/2019 - 02:21

Topic category: Advanced modding

Last seen on 02:15, 30. Mar 2019
Joined Sep 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Override ranged weapon hit sound
Tue, 03/19/2019 - 03:15 (edited)

Does anyone know how to disable the hit sound when a ranged weapon bullet hits a block or entity? I have a mod that uses guns and I uploaded a sound for when the gun is fired. However, it makes an arrow hit sound whenever it hits an entity or block and sounds pretty lame.

 

Any help would be appreciated!

 

Edit: I found where all that information is located in the minecraft source files, but have no idea what the syntax would be to disable it.

Edited by Devilkin1987 on Tue, 03/19/2019 - 03:15
Last seen on 18:18, 25. Jun 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
You don't need to search for…
Tue, 03/19/2019 - 11:59

You don't need to search for the code. You have CODE tab for this with a proper editor.

Last seen on 02:15, 30. Mar 2019
Joined Sep 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I found the source…
Tue, 03/19/2019 - 15:11

I found the source information in the CODE tab :). Just trying to figure out the syntax to disable the sound or redirect it to something really quiet. I found a video where someone changed the hit sound to be the shears which is nice and quiet. The guy didn't show how he did it though haha.

Last seen on 18:18, 25. Jun 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
I have checked and playing…
Tue, 03/19/2019 - 16:24

I have checked and playing the arrow hit sound is part of the EntityArrow#onHit method. There is quite a lot of code to be changed to change this, unfortunately, and without some Java knowledge this won't be easy.

Last seen on 02:15, 30. Mar 2019
Joined Sep 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Ok, thanks for looking it up…
Tue, 03/19/2019 - 16:56

Ok, thanks for looking it up. If you have any suggestions of a good resource where I can get started on learning Java code for minecraft I'd love to learn. I have experience scripting in Linux so I have a slight background.

Mcreator is such an awesome program and I'd love to dive into minecraft modding a bit more. :)

Last seen on 18:18, 25. Jun 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
In fact, to change this, you…
Tue, 03/19/2019 - 17:00

In fact, to change this, you only need to understand how Java works. The idea is to copy EntityArrow#onHit method in your EntityArrow class inside ranged item mod element code but without the line for the sound. Based on your experience you might be able to pull this off :)

Last seen on 02:15, 30. Mar 2019
Joined Sep 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Do I need to put this in as…
Wed, 03/20/2019 - 15:39

Do I need to put this in as a @Override? I've seen this in all the mod elements to change things from minecraft source code.

Last seen on 18:18, 25. Jun 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Yes, this is a method…
Wed, 03/20/2019 - 18:55

Yes, this is a method override.