From 875d2392b586e041afdb055f4beeff844ff986a9 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Wed, 27 Nov 2019 16:38:42 -0300 Subject: [PATCH] Fix position shifting, fix two layers of item copy --- .../ViaVersion/api/type/types/minecraft/Position1_14Type.java | 2 +- .../ViaVersion/api/type/types/minecraft/PositionType.java | 2 +- .../protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Position1_14Type.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Position1_14Type.java index 0dfa6e437..9014c7dc9 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Position1_14Type.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/Position1_14Type.java @@ -24,6 +24,6 @@ public class Position1_14Type extends Type { public void write(ByteBuf buffer, Position object) { buffer.writeLong((((long) object.getX() & 0x3ffffff) << 38) | (object.getY() & 0xfff) - | ((object.getZ() & 0x3ffffff) << 12)); + | ((((long) object.getZ()) & 0x3ffffff) << 12)); } } diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/PositionType.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/PositionType.java index 9606c4bb7..7df0f75da 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/PositionType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/PositionType.java @@ -23,7 +23,7 @@ public class PositionType extends Type { @Override public void write(ByteBuf buffer, Position object) { buffer.writeLong((((long) object.getX() & 0x3ffffff) << 38) - | ((object.getY() & 0xfff) << 26) + | ((((long) object.getY()) & 0xfff) << 26) | (object.getZ() & 0x3ffffff)); } } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java index f83926d5f..008b95e5d 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java @@ -515,7 +515,7 @@ public class Protocol1_13To1_12_2 extends Protocol { Item[] clone = ingredient.clone(); // Clone because array and item is mutable for (int i = 0; i < clone.length; i++) { if (clone[i] == null) continue; - clone[i] = new Item(new Item(clone[i])); + clone[i] = new Item(clone[i]); } wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone); } @@ -530,7 +530,7 @@ public class Protocol1_13To1_12_2 extends Protocol { Item[] clone = ingredient.clone(); // Clone because array and item is mutable for (int i = 0; i < clone.length; i++) { if (clone[i] == null) continue; - clone[i] = new Item(new Item(clone[i])); + clone[i] = new Item(clone[i]); } wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone); }