mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix #3683
This commit is contained in:
parent
97e91ef962
commit
1f18e4fe4f
2 changed files with 27 additions and 15 deletions
|
@ -56,7 +56,10 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||||
// Separate case since each RecordEventData in Java is an individual track in Bedrock
|
// Separate case since each RecordEventData in Java is an individual track in Bedrock
|
||||||
if (packet.getEvent() == LevelEvent.RECORD) {
|
if (packet.getEvent() == LevelEvent.RECORD) {
|
||||||
RecordEventData recordEventData = (RecordEventData) packet.getData();
|
RecordEventData recordEventData = (RecordEventData) packet.getData();
|
||||||
SoundEvent soundEvent = Registries.RECORDS.getOrDefault(recordEventData.getRecordId(), SoundEvent.STOP_RECORD);
|
SoundEvent soundEvent = Registries.RECORDS.get(recordEventData.getRecordId());
|
||||||
|
if (soundEvent == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Vector3i origin = packet.getPosition();
|
Vector3i origin = packet.getPosition();
|
||||||
Vector3f pos = Vector3f.from(origin.getX() + 0.5f, origin.getY() + 0.5f, origin.getZ() + 0.5f);
|
Vector3f pos = Vector3f.from(origin.getX() + 0.5f, origin.getY() + 0.5f, origin.getZ() + 0.5f);
|
||||||
|
|
||||||
|
@ -69,19 +72,17 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||||
levelSoundEvent.setBabySound(false);
|
levelSoundEvent.setBabySound(false);
|
||||||
session.sendUpstreamPacket(levelSoundEvent);
|
session.sendUpstreamPacket(levelSoundEvent);
|
||||||
|
|
||||||
if (soundEvent != SoundEvent.STOP_RECORD) {
|
// Send text packet as it seems to be handled in Java Edition client-side.
|
||||||
// Send text packet as it seems to be handled in Java Edition client-side.
|
TextPacket textPacket = new TextPacket();
|
||||||
TextPacket textPacket = new TextPacket();
|
textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
|
||||||
textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
|
textPacket.setNeedsTranslation(true);
|
||||||
textPacket.setNeedsTranslation(true);
|
textPacket.setXuid("");
|
||||||
textPacket.setXuid("");
|
textPacket.setPlatformChatId("");
|
||||||
textPacket.setPlatformChatId("");
|
textPacket.setSourceName(null);
|
||||||
textPacket.setSourceName(null);
|
textPacket.setMessage("record.nowPlaying");
|
||||||
textPacket.setMessage("record.nowPlaying");
|
String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc";
|
||||||
String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc";
|
textPacket.setParameters(Collections.singletonList(MinecraftLocale.getLocaleString(recordString, session.locale())));
|
||||||
textPacket.setParameters(Collections.singletonList(MinecraftLocale.getLocaleString(recordString, session.locale())));
|
session.sendUpstreamPacket(textPacket);
|
||||||
session.sendUpstreamPacket(textPacket);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,6 +311,17 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||||
session.sendUpstreamPacket(soundEventPacket);
|
session.sendUpstreamPacket(soundEventPacket);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
case STOP_RECORD -> {
|
||||||
|
LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket();
|
||||||
|
levelSoundEvent.setIdentifier("");
|
||||||
|
levelSoundEvent.setSound(SoundEvent.STOP_RECORD);
|
||||||
|
levelSoundEvent.setPosition(pos);
|
||||||
|
levelSoundEvent.setRelativeVolumeDisabled(false);
|
||||||
|
levelSoundEvent.setExtraData(-1);
|
||||||
|
levelSoundEvent.setBabySound(false);
|
||||||
|
session.sendUpstreamPacket(levelSoundEvent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
default -> {
|
default -> {
|
||||||
GeyserImpl.getInstance().getLogger().debug("Unhandled level event: " + packet.getEvent());
|
GeyserImpl.getInstance().getLogger().debug("Unhandled level event: " + packet.getEvent());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -13,7 +13,7 @@ protocol = "3.0.0.Beta1-20230424.095344-69"
|
||||||
protocol-connection = "3.0.0.Beta1-20230424.095344-68"
|
protocol-connection = "3.0.0.Beta1-20230424.095344-68"
|
||||||
raknet = "1.0.0.CR1-20230311.162635-3"
|
raknet = "1.0.0.CR1-20230311.162635-3"
|
||||||
mcauthlib = "d9d773e"
|
mcauthlib = "d9d773e"
|
||||||
mcprotocollib = "1.19.4-2-20230426.171506-1"
|
mcprotocollib = "1.19.4-2-20230427.170624-2"
|
||||||
adventure = "4.14.0-20230424.215040-7"
|
adventure = "4.14.0-20230424.215040-7"
|
||||||
adventure-platform = "4.1.2"
|
adventure-platform = "4.1.2"
|
||||||
junit = "5.9.2"
|
junit = "5.9.2"
|
||||||
|
|
Loading…
Reference in a new issue