mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add debug log for unexpected sound event type
This commit is contained in:
parent
036e0270f0
commit
05a2257999
1 changed files with 6 additions and 2 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
package org.geysermc.geyser.level;
|
package org.geysermc.geyser.level;
|
||||||
|
|
||||||
import org.cloudburstmc.nbt.NbtMap;
|
import org.cloudburstmc.nbt.NbtMap;
|
||||||
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry;
|
import org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry;
|
||||||
|
|
||||||
|
|
@ -34,11 +35,14 @@ 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();
|
||||||
Object soundEventObject = data.get("sound_event");
|
Object soundEventObject = data.get("sound_event");
|
||||||
String soundEvent = "";
|
String soundEvent;
|
||||||
if (soundEventObject instanceof NbtMap map) {
|
if (soundEventObject instanceof NbtMap map) {
|
||||||
soundEvent = map.getString("sound_id");
|
soundEvent = map.getString("sound_id");
|
||||||
} else if (soundEventObject instanceof String string){
|
} else if (soundEventObject instanceof String string) {
|
||||||
soundEvent = string;
|
soundEvent = string;
|
||||||
|
} else {
|
||||||
|
soundEvent = "";
|
||||||
|
GeyserImpl.getInstance().getLogger().debug("Sound event for " + entry.getId() + " was of an unexpected type! Expected string or NBT map, got " + soundEventObject);
|
||||||
}
|
}
|
||||||
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