Need help making an Entity play a sound when it sets an attack target.

Started by _ShadowLink_ on

Topic category: Help with modding (Java Edition)

Last seen on 00:24, 15. Nov 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need help making an Entity play a sound when it sets an attack target.

I'm looking for some help, or possibly an example of how to make an entity play a custom sound when it sets an attack target. I have the sound I plan to use and the entity already created, I'm just trying to figure out how I can implement this into my entity properly. The sound I want the entity to play gets spammed for each tick that the entity is chasing its target, and that, of course, is not what I want. I'm aware of a method involving NBT data tags, though I'm not exactly sure how to set it up properly. Any guidance or examples would be very much appreciated, as I am still a bit of a new MCreator user, and not very experienced in Java code. Thank you! ^-^