mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Prepare for PR
This commit is contained in:
parent
9e03c9b93a
commit
7993f38437
2 changed files with 13 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue