[SPIGOT-7648] Goat Horn NBT data should allow empty string value for "instrument" Created: 29/Apr/24 Updated: 25/Dec/24 Resolved: 10/Dec/24 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Athar42 | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | Horn, NBT, instrument |
Attachments: |
![]() |
||||
Issue Links: |
|
||||
Version: | This server is running CraftBukkit version 4090-Spigot-b754dcc-38b1f49 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) | ||||
Guidelines Read: | Yes |
Description |
Hi,
First of all, sorry if not opened in the correct project (might be build tools as this is more related to Craftbukkit itself).
I'm trying to achieve the following : alter the NBT data of a goat horn to set the key tag "instrument" to an empty value.
On Craftbukkit and Spigot : The client will just disconnect
"Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: Input string must not be empty or null"
or
Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "org.bukkit.NamespacedKey.getNamespace()" because "key" is null
On PaperMC, which fork Spigot, we aren't kicked from the server, but the whole key "instrument" got removed from the NBT tags.
On Vanilla server and Fabric, this behavior is working just fine.
Why I need this ? ==> The need of an empty string value allow to have a goat horn that didn't emit any sound/music. Doing so, a plugin like Audio Player (Fabric) can play of specific audio file through Simple Voice Chat.
I'm also willing to add the "player head" sound ability for Spigot/PaperMC, but didn't looked at it yet on how it work for Fabric.
On my research, the error seems to be triggered by the class "NamespacedKey" / "org.bukkit.NamespacedKey.getNamespace()", and could also be related to this specific one too : "CraftMetaMusicInstrument.java".
Here are some commands to reproduce the error :
This command will work (instrument tag have a value, lowercase) :
/give @p minecraft:goat_horn{HideFlags:255,instrument:"t",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}}
This one will fail (using an uppercase in the "instrument" key value) /give @p minecraft:goat_horn{HideFlags:255,instrument:"T",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}}
And this one will fail (because empty "instrument" value) : /give @p minecraft:goat_horn{HideFlags:255,instrument:"",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}}
PS : On Craftbukkit server, the command will always work (you get the horn), but as soon as you open the player inventory or run the below command (with the goat horn in your main hand), you'll be disconnected : /data get entity @s SelectedItem |
Comments |
Comment by Watermelon_Sir [ 09/Dec/24 ] |
This bug still exists in the current version of 1.21.4. Custom instruments that are defined in the item NBT instead of a datapack also kick the player, but work fine in vanilla server software. |
Comment by Marvin Rieple [ 24/May/24 ] |
In vanilla you can use a custom instrument with a custom sound effect which is not present for an empty sound. This will however not work on spigot since spigot expects instruments to be registered to the server. Example command: /give @p minecraft:goat_horn[minecraft:instrument={sound_event:{sound_id:"not:present"},use_duration:100,range:10}]
|
Comment by Athar42 [ 29/Apr/24 ] |
Yeah, I found the correct command (by the way, you can shorten it from >minecraft:instrument="minecraft:feel_goat_horn"< to >minecraft:instrument=feel_goat_horn<
I wasn't able to reply due to Cloudflare 502 bad gateway until now :'D
Anyways, what I was trying to say is yes, we need to find another way to achieve that (if even possible, which is unsure. Don't know if a plugin can stop the horn playing).
Also, in 1.20.4 on Vanilla and Fabric, this data wasn't wipped, this was Bukkit specific really
As such, we can cancel this ticket as this is not relevant anymore (unless you have some clues on how to achieve that :'D ) |
Comment by md_5 [ 29/Apr/24 ] |
The correct command is /give @p minecraft:goat_horn[minecraft:instrument="minecraft:feel_goat_horn"]
Something like /give @p minecraft:goat_horn[minecraft:instrument="minecraft:test"]
fails. So yeah, you will need a different approach for 1.20.5/6. Furthermore, even if this was fixed for 1.20.4, it would just be fixed to not disconnect - the custom data would be wiped. |
Comment by Athar42 [ 29/Apr/24 ] |
So yeah, did a quick test, and indeed, they seems to check what values you put in there now.
So even if this was changed, that would only apply for 1.20.4 (and yeah, I didn't find, yet, how to give myself a correct horn with a specific sound, even while looking at a correct one |
Comment by Athar42 [ 29/Apr/24 ] |
1.20.6 (hotfix) just got released, I'm gonna try on it (but, I think I'll have to change the way the command is wrote, as this is more "component" based than NBT tag) |
Comment by md_5 [ 29/Apr/24 ] |
Suggest you try 1.20.5 — I'm not sure Vanilla allows this/ invalid instruments in 1.20.5. |