From 765f92bfe58588577d6bb45b96d58b5a8add7ff2 Mon Sep 17 00:00:00 2001 From: RK_01 <50594595+RaphiMC@users.noreply.github.com> Date: Sun, 18 Oct 2020 22:37:30 +0200 Subject: [PATCH] Correct 1.9.x -> 1.10 sound pitch adjustments (#2139) --- .../Protocol1_10To1_9_3_4.java | 2 +- .../Protocol1_9_3To1_9_1_2.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java index 2646513d4..d11e90337 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java @@ -22,7 +22,7 @@ public class Protocol1_10To1_9_3_4 extends Protocol TO_NEW_PITCH = new ValueTransformer(Type.FLOAT) { @Override public Float transform(PacketWrapper wrapper, Short inputValue) throws Exception { - return inputValue / 63.5F; + return inputValue / 63.0F; } }; public static final ValueTransformer, List> TRANSFORM_METADATA = new ValueTransformer, List>(Types1_9.METADATA_LIST) { diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java index 6aa668c1b..ba3b46878 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java @@ -12,6 +12,7 @@ import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.remapper.ValueTransformer; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.chunks.FakeTileEntity; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; @@ -23,6 +24,13 @@ import java.util.List; public class Protocol1_9_3To1_9_1_2 extends Protocol { + public static final ValueTransformer ADJUST_PITCH = new ValueTransformer(Type.UNSIGNED_BYTE, Type.UNSIGNED_BYTE) { + @Override + public Short transform(PacketWrapper wrapper, Short inputValue) throws Exception { + return (short) Math.round(inputValue / 63.5F * 63.0F); + } + }; + public Protocol1_9_3To1_9_1_2() { super(ClientboundPackets1_9.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9.class, ServerboundPackets1_9_3.class); } @@ -134,6 +142,20 @@ public class Protocol1_9_3To1_9_1_2 extends Protocol