CustomDiscs icon indicating copy to clipboard operation
CustomDiscs copied to clipboard

[Request] Goat Horns

Open YueTaken opened this issue 1 year ago • 10 comments

Similar to the original AudioPlayer mod, please add custom goat horn sounds aswell, using the same method done with the music discs. This would be awesome.

YueTaken avatar Oct 01 '23 10:10 YueTaken

I agree this would be a excellent addition to the plugin

ItsmagmaMan09 avatar Oct 10 '23 20:10 ItsmagmaMan09

I'll throw my hat in the ring, this would be great.

mmsheeks avatar Jan 08 '24 05:01 mmsheeks

Following Hermitcraft series, I saw that the original plugin was able to add custom audio on Goat Horns and Players Head (as well as setting a distance).

Sadly, not supported there.

Hopefully, someone made a PR for the audio distance (which seems to work great) and I'm trying to make the goat horn implementation now, with some success I think (I let you judge by it :D ). It's still in early stage, trying stuff here and there, but I think I may get it working someday (even though, I never develop any Java stuff)

https://github.com/Navoei/CustomDiscs/assets/44590042/a6a3c15c-0ec4-4538-9f96-b344dfac9fd0

Athar42 avatar Apr 20 '24 19:04 Athar42

A little update on the progress I made for those who want to know, I made some kind of "beta" version of it. It's working, it's not perfect (due to, apparently, Craftbukkit limitation on manipulating a specific NBT tag, the "instrument" of the horn), and I found a little "glitch" on the horn naming that I need to fix to avoid plugin errors :D

But all in all, it's working so far (Edit : Oh, and the horn sound is on a different voice channel, so you can mute Horn sound and keep the music discs active (and vice-versa)) The two issues right now :

  • If you name it this way : /cd create AUDIO_FILE "name"some_text ==> The command will work, but the double quote isn't escaped and so, is not correct for naming the horn.
  • To make a workaround on the NBT tag issue (you can't create PDC (Persistent Data Container) stuff with the horn, if doing so, the "instrument" tag just got deleted, and the horn will sound it's default music + the sound you put in), I had to first delete the horn you hold, then recreate a new one with the "/give" command. Doing so, you'll get a log in the server console which can't be suppressed. Also, this workaround lead to a "non critical" issue, the newly generated item is dropped on the first empty slot on your hotbar (not an issue if your hotbar is full).

A little example video showcasing this version, and also including the "range" modifier from this PR : https://github.com/Navoei/CustomDiscs/pull/49

==> https://www.youtube.com/watch?v=OMhWHM0eagY (It has to be a Youtube video. 200MB, can't get it down to 10MB file limit in here)

So, next steps :

  • Fix the known issue(s)
  • Make a "beta build" for anyone that want to test it
  • Cleanup my mess ('cause, it's a mess right now in the code :'D )
  • Make some research on the Player head modification (to allow a playerhead to have a music attached to it, while on top of a noteblock)

Athar42 avatar Apr 23 '24 22:04 Athar42

Interesting, thanks

YueTaken avatar Apr 24 '24 16:04 YueTaken

Little (sad) update : I found a big flaw in my implementation. While moving the goat horn from one slot to another one, the "instrument" key is removed from the NBT data.

That's the same issue as I talk earlier, due to how Craftbukkit/Spigot handle the goat horn NBT data, which doesn't allow to create an horn without a value set in it. This is allowed on Fabric and also on Vanilla, but not on those server's type.

I'm reporting this on the Bukkit Discord server to see if we can get this sorted out (and then, will need to get Paper updated, if fixed first).

So right now, I'm stopping to work on this as it's not possible to implement it in a good way :'(

Edit : I could also look to a way to detect when a goat horn is in the main hand and have a specific NBT tag. If that's the case, I could regen the horn (delete and recreate it), but that'll not be optimized at all...

Edit 2 : "Bug reporting" (if they consider it as a bug at least) on Spigot bug tracker (as they handle Craftbukkit too, from what I'm aware of). Now, finger crossed that they take this into account and change the behavior back to the Vanilla one (https://hub.spigotmc.org/jira/browse/SPIGOT-7648) Sad thing is, even if they take this into account, it "could" be fixed for 1.20.4+, but PaperMC will probably already moved to 1.20.5+ releases (and, my best guess so far, is that this plugin will not function in 1.20.5 without fixes).

Edit 3 : I confirm, 1.20.5 and 1.20.6 ==>As the NBT tag is replaced by components now, we can get an horn WITHOUT an instrument attached to it (from what I tested so far). This feature in Audio Player might get removed (or replaced in some way), so I'll wait to see if they find a nice way to bypass this :D

Edit 4 : I tested Audio Player in both version 1.20.5 and 1.20.6 : The default goat horn sound is now played :( I don't think they (yet) found a way to bypass this too. I'll keep an eye on it (and this plugin, like I said, will need a "big" update to support 1.20.5+)

Athar42 avatar Apr 27 '24 21:04 Athar42

item components exists now and you can use custom_data

lowercasebtw avatar Jun 13 '24 13:06 lowercasebtw

Yeah, I already tried to work on this new "NBT change" with components, but this require quite a lot of work (+ paper which change the way relocation work (Craftbukkit and so on)).

I'm not a pro developper, so as I saw that @Navoei is going to support 1.21, I'll wait this update to come out first, then see (if not done at that time) how to add the goat horn support to it 🙂

Athar42 avatar Jun 13 '24 15:06 Athar42

Thanks for the effort, excited for the Goat horns

YueTaken avatar Jun 27 '24 16:06 YueTaken

Hey there, it's me again 😊

I know, I was quite pessimist in my last statement, but hey, this was in the 1.20.x branch !

Now, let celebrate the 1.21 release with this big hope :

https://github.com/user-attachments/assets/1f5d86cb-a0cf-4c4b-aeb8-c2049dc9d26b

In the end, the "custom_data" is already the place where we store all the song properties, so that's not the fix here 😋

But I found a way to get rid of the horn sound and this seems to work perfectly fine.

For now, I kept my "old way" : Delete the horn in your main hand then recreate a special horn. This is working, but I give myself a few day to experiment some stuff and maybe find a way to just rewrite the data of the horn in hand (if possible, which I'm still unsure at that moment).

Ongoing task will be to make this functioning without issue as is in the video + range setting modification (yeah, right now I use the console for this test, to give myself the correct horn, the plugin isn't yet updated x') ). Once done, I'll try a few stuff if I can improve the implementation (if not, I'll still do a PR of it).

Next step : Player's head custom sound (might be harder, or not, don't know yet).

Athar42 avatar Aug 07 '24 00:08 Athar42