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
|
||||
if (packet.getEvent() == LevelEvent.RECORD) {
|
||||
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();
|
||||
Vector3f pos = Vector3f.from(origin.getX() + 0.5f, origin.getY() + 0.5f, origin.getZ() + 0.5f);
|
||||
|
||||
|
@ -69,7 +72,6 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
levelSoundEvent.setBabySound(false);
|
||||
session.sendUpstreamPacket(levelSoundEvent);
|
||||
|
||||
if (soundEvent != SoundEvent.STOP_RECORD) {
|
||||
// Send text packet as it seems to be handled in Java Edition client-side.
|
||||
TextPacket textPacket = new TextPacket();
|
||||
textPacket.setType(TextPacket.Type.JUKEBOX_POPUP);
|
||||
|
@ -81,7 +83,6 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc";
|
||||
textPacket.setParameters(Collections.singletonList(MinecraftLocale.getLocaleString(recordString, session.locale())));
|
||||
session.sendUpstreamPacket(textPacket);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -310,6 +311,17 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
session.sendUpstreamPacket(soundEventPacket);
|
||||
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 -> {
|
||||
GeyserImpl.getInstance().getLogger().debug("Unhandled level event: " + packet.getEvent());
|
||||
return;
|
||||
|
|
|
@ -13,7 +13,7 @@ protocol = "3.0.0.Beta1-20230424.095344-69"
|
|||
protocol-connection = "3.0.0.Beta1-20230424.095344-68"
|
||||
raknet = "1.0.0.CR1-20230311.162635-3"
|
||||
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-platform = "4.1.2"
|
||||
junit = "5.9.2"
|
||||
|
|
Loading…
Reference in a new issue