Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Prepare for PR
Dieser Commit ist enthalten in:
Ursprung
9e03c9b93a
Commit
7993f38437
@ -47,7 +47,14 @@ public class JavaPlayBuiltinSoundTranslator extends PacketTranslator<ServerPlayB
|
||||
|
||||
soundPacket.setSound(sound);
|
||||
soundPacket.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ()));
|
||||
soundPacket.setExtraData(-1);
|
||||
if (sound == SoundEvent.NOTE) {
|
||||
// Minecraft Wiki: 2^(x/12) = Java pitch where x is -12 to 12
|
||||
// Java sends the note value as above starting with -12 and ending at 12
|
||||
// Bedrock has a number for each type of note, then proceeds up the scale by adding to that number
|
||||
soundPacket.setExtraData(soundMapping.getExtraData() + (int)(Math.round((Math.log10(packet.getPitch()) / Math.log10(2)) * 12)) + 12);
|
||||
} else {
|
||||
soundPacket.setExtraData(soundMapping.getExtraData());
|
||||
}
|
||||
soundPacket.setIdentifier(":"); // ???
|
||||
soundPacket.setBabySound(false); // might need to adjust this in the future
|
||||
soundPacket.setRelativeVolumeDisabled(false);
|
||||
|
@ -43,7 +43,8 @@ public class SoundMap {
|
||||
new SoundMapping(
|
||||
next.getKey(),
|
||||
brMap.has("bedrock_mapping") && brMap.get("bedrock_mapping").isTextual() ? brMap.get("bedrock_mapping").asText() : null,
|
||||
brMap.has("playsound_mapping") && brMap.get("playsound_mapping").isTextual() ? brMap.get("playsound_mapping").asText() : null
|
||||
brMap.has("playsound_mapping") && brMap.get("playsound_mapping").isTextual() ? brMap.get("playsound_mapping").asText() : null,
|
||||
brMap.has("extra_data") && brMap.get("extra_data").isInt() ? brMap.get("extra_data").asInt() : -1
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -98,11 +99,13 @@ public class SoundMap {
|
||||
private final String java;
|
||||
private final String bedrock;
|
||||
private final String playsound;
|
||||
private final int extraData;
|
||||
|
||||
public SoundMapping(String java, String bedrock, String playsound) {
|
||||
public SoundMapping(String java, String bedrock, String playsound, int extraData) {
|
||||
this.java = java;
|
||||
this.bedrock = bedrock == null || bedrock.equalsIgnoreCase("") ? null : bedrock;
|
||||
this.playsound = playsound == null || playsound.equalsIgnoreCase("") ? null : playsound;
|
||||
this.extraData = extraData;
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren