mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Read sound event objects properly in jukebox song
This commit is contained in:
parent
1efb633723
commit
036e0270f0
1 changed files with 7 additions and 1 deletions
|
|
@ -33,7 +33,13 @@ public record JukeboxSong(String soundEvent, String description) {
|
||||||
|
|
||||||
public static JukeboxSong read(RegistryEntry entry) {
|
public static JukeboxSong read(RegistryEntry entry) {
|
||||||
NbtMap data = entry.getData();
|
NbtMap data = entry.getData();
|
||||||
String soundEvent = data.getString("sound_event");
|
Object soundEventObject = data.get("sound_event");
|
||||||
|
String soundEvent = "";
|
||||||
|
if (soundEventObject instanceof NbtMap map) {
|
||||||
|
soundEvent = map.getString("sound_id");
|
||||||
|
} else if (soundEventObject instanceof String string){
|
||||||
|
soundEvent = string;
|
||||||
|
}
|
||||||
String description = MessageTranslator.deserializeDescription(data);
|
String description = MessageTranslator.deserializeDescription(data);
|
||||||
return new JukeboxSong(soundEvent, description);
|
return new JukeboxSong(soundEvent, description);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue