From 50e55529d93bfa4443312b0785c83e6fbdebbc48 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 19 Oct 2023 21:15:26 +1000 Subject: [PATCH] Rename old position type --- .../metadata/types/MetaType1_12.java | 4 ++-- .../minecraft/metadata/types/MetaType1_9.java | 4 ++-- .../metadata/types/MetaTypes1_13.java | 4 ++-- .../metadata/types/MetaTypes1_13_2.java | 4 ++-- .../viaversion/viaversion/api/type/Type.java | 4 ++-- .../api/type/types/math/PositionType1_8.java | 2 +- .../Protocol1_11To1_10.java | 8 +++---- .../packets/WorldPackets.java | 2 +- .../Protocol1_13To1_12_2.java | 6 ++--- .../blockconnections/ConnectionData.java | 2 +- .../packets/WorldPackets.java | 18 +++++++-------- .../providers/BlockEntityProvider.java | 2 +- .../storage/TabCompleteTracker.java | 2 +- .../packets/EntityPackets.java | 4 ++-- .../packets/PlayerPackets.java | 14 ++++++------ .../packets/WorldPackets.java | 12 +++++----- .../Protocol1_9_3To1_9_1_2.java | 4 ++-- .../packets/SpawnPackets.java | 2 +- .../packets/WorldPackets.java | 22 +++++++++---------- .../viaversion/rewriter/BlockRewriter.java | 2 +- 20 files changed, 61 insertions(+), 61 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java index 4377b20dd..367774e00 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java @@ -34,8 +34,8 @@ public enum MetaType1_12 implements MetaType { Slot(5, Type.ITEM1_8), Boolean(6, Type.BOOLEAN), Vector3F(7, Type.ROTATION), - Position(8, Type.POSITION), - OptPosition(9, Type.OPTIONAL_POSITION), + Position(8, Type.POSITION1_8), + OptPosition(9, Type.OPTIONAL_POSITION1_8), Direction(10, Type.VAR_INT), OptUUID(11, Type.OPTIONAL_UUID), BlockID(12, Type.VAR_INT), diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java index 0a2b8123e..0908fe39f 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java @@ -34,8 +34,8 @@ public enum MetaType1_9 implements MetaType { Slot(5, Type.ITEM1_8), Boolean(6, Type.BOOLEAN), Vector3F(7, Type.ROTATION), - Position(8, Type.POSITION), - OptPosition(9, Type.OPTIONAL_POSITION), + Position(8, Type.POSITION1_8), + OptPosition(9, Type.OPTIONAL_POSITION1_8), Direction(10, Type.VAR_INT), OptUUID(11, Type.OPTIONAL_UUID), BlockID(12, Type.VAR_INT); diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java index 86f012cc1..9bec06f16 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java @@ -37,8 +37,8 @@ public final class MetaTypes1_13 extends AbstractMetaTypes { public final MetaType itemType = add(6, Type.ITEM1_13); public final MetaType booleanType = add(7, Type.BOOLEAN); public final MetaType rotationType = add(8, Type.ROTATION); - public final MetaType positionType = add(9, Type.POSITION); - public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION); + public final MetaType positionType = add(9, Type.POSITION1_8); + public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION1_8); public final MetaType directionType = add(11, Type.VAR_INT); public final MetaType optionalUUIDType = add(12, Type.OPTIONAL_UUID); public final MetaType blockStateType = add(13, Type.VAR_INT); diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java index f5e1c5801..52dffb7f3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java @@ -37,8 +37,8 @@ public final class MetaTypes1_13_2 extends AbstractMetaTypes { public final MetaType itemType = add(6, Type.ITEM1_13_2); public final MetaType booleanType = add(7, Type.BOOLEAN); public final MetaType rotationType = add(8, Type.ROTATION); - public final MetaType positionType = add(9, Type.POSITION); - public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION); + public final MetaType positionType = add(9, Type.POSITION1_8); + public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION1_8); public final MetaType directionType = add(11, Type.VAR_INT); public final MetaType optionalUUIDType = add(12, Type.OPTIONAL_UUID); public final MetaType blockStateType = add(13, Type.VAR_INT); diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/Type.java index 18dcbf18b..4c8d0bb15 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/Type.java @@ -132,8 +132,8 @@ public abstract class Type implements ByteBufReader, ByteBufWriter { public static final VarLongType VAR_LONG = new VarLongType(); /* MC Types */ - public static final Type POSITION = new PositionType1_8(); - public static final Type OPTIONAL_POSITION = new PositionType1_8.OptionalPositionType(); + public static final Type POSITION1_8 = new PositionType1_8(); + public static final Type OPTIONAL_POSITION1_8 = new PositionType1_8.OptionalPositionType(); public static final Type POSITION1_14 = new PositionType1_14(); public static final Type OPTIONAL_POSITION_1_14 = new PositionType1_14.OptionalPosition1_14Type(); public static final Type ROTATION = new EulerAngleType(); diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_8.java index 05307aef7..5c2131c4b 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_8.java @@ -51,7 +51,7 @@ public class PositionType1_8 extends Type { public static final class OptionalPositionType extends OptionalType { public OptionalPositionType() { - super(Type.POSITION); + super(Type.POSITION1_8); } } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java index 7597101cc..c41e51caf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java @@ -168,7 +168,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol { @@ -285,7 +285,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol { int id = wrapper.get(Type.INT, 0); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java index 938d28229..68d2db5de 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java @@ -109,7 +109,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol { - Position position = wrapper.read(Type.POSITION); + Position position = wrapper.read(Type.POSITION1_8); wrapper.write(Type.INT, position.x()); wrapper.write(Type.INT, position.y()); wrapper.write(Type.INT, position.z()); @@ -334,7 +334,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol { int id = wrapper.get(Type.INT, 0); @@ -638,7 +638,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol { wrapper.write(Type.BOOLEAN, false); final Position playerLookTarget = Via.getManager().getProviders().get(PlayerLookTargetProvider.class).getPlayerLookTarget(wrapper.user()); - wrapper.write(Type.OPTIONAL_POSITION, playerLookTarget); + wrapper.write(Type.OPTIONAL_POSITION1_8, playerLookTarget); if (!wrapper.isCancelled() && Via.getConfig().get1_13TabCompleteDelay() > 0) { TabCompleteTracker tracker = wrapper.user().get(TabCompleteTracker.class); wrapper.cancel(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/blockconnections/ConnectionData.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/blockconnections/ConnectionData.java index cc418de7e..e9cfba2f3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/blockconnections/ConnectionData.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/blockconnections/ConnectionData.java @@ -88,7 +88,7 @@ public final class ConnectionData { updateBlockStorage(user, pos.x(), pos.y(), pos.z(), newBlockState); PacketWrapper blockUpdatePacket = PacketWrapper.create(ClientboundPackets1_13.BLOCK_CHANGE, null, user); - blockUpdatePacket.write(Type.POSITION, pos); + blockUpdatePacket.write(Type.POSITION1_8, pos); blockUpdatePacket.write(Type.VAR_INT, newBlockState); blockUpdatePacket.send(Protocol1_13To1_12_2.class); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index b7c469a27..9183d0dac 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -102,12 +102,12 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ENTITY_DATA, new PacketHandlers() { @Override public void register() { - map(Type.POSITION); // 0 - Location + map(Type.POSITION1_8); // 0 - Location map(Type.UNSIGNED_BYTE); // 1 - Action map(Type.NAMED_COMPOUND_TAG); // 2 - NBT data handler(wrapper -> { - Position position = wrapper.get(Type.POSITION, 0); + Position position = wrapper.get(Type.POSITION1_8, 0); short action = wrapper.get(Type.UNSIGNED_BYTE, 0); CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); @@ -132,12 +132,12 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ACTION, new PacketHandlers() { @Override public void register() { - map(Type.POSITION); // Location + map(Type.POSITION1_8); // Location map(Type.UNSIGNED_BYTE); // Action Id map(Type.UNSIGNED_BYTE); // Action param map(Type.VAR_INT); // Block Id - /!\ NOT BLOCK STATE ID handler(wrapper -> { - Position pos = wrapper.get(Type.POSITION, 0); + Position pos = wrapper.get(Type.POSITION1_8, 0); short action = wrapper.get(Type.UNSIGNED_BYTE, 0); short param = wrapper.get(Type.UNSIGNED_BYTE, 1); int blockId = wrapper.get(Type.VAR_INT, 0); @@ -165,7 +165,7 @@ public class WorldPackets { if (blockId == 73) { // Note block PacketWrapper blockChange = wrapper.create(ClientboundPackets1_13.BLOCK_CHANGE); - blockChange.write(Type.POSITION, pos); + blockChange.write(Type.POSITION1_8, pos); blockChange.write(Type.VAR_INT, 249 + (action * 24 * 2) + (param * 2)); blockChange.send(Protocol1_13To1_12_2.class); } @@ -177,10 +177,10 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_CHANGE, new PacketHandlers() { @Override public void register() { - map(Type.POSITION); + map(Type.POSITION1_8); map(Type.VAR_INT); handler(wrapper -> { - Position position = wrapper.get(Type.POSITION, 0); + Position position = wrapper.get(Type.POSITION1_8, 0); int newId = toNewId(wrapper.get(Type.VAR_INT, 0)); UserConnection userConnection = wrapper.user(); @@ -540,7 +540,7 @@ public class WorldPackets { // Incoming Packets protocol.registerServerbound(ServerboundPackets1_13.PLAYER_BLOCK_PLACEMENT, wrapper -> { - Position pos = wrapper.passthrough(Type.POSITION); + Position pos = wrapper.passthrough(Type.POSITION1_8); wrapper.passthrough(Type.VAR_INT); // block face wrapper.passthrough(Type.VAR_INT); // hand wrapper.passthrough(Type.FLOAT); // cursor x @@ -553,7 +553,7 @@ public class WorldPackets { }); protocol.registerServerbound(ServerboundPackets1_13.PLAYER_DIGGING, wrapper -> { int status = wrapper.passthrough(Type.VAR_INT); // Status - Position pos = wrapper.passthrough(Type.POSITION); // Location + Position pos = wrapper.passthrough(Type.POSITION1_8); // Location wrapper.passthrough(Type.UNSIGNED_BYTE); // block face // 0 = Started digging: if in creative this causes the block to break directly diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/providers/BlockEntityProvider.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/providers/BlockEntityProvider.java index 6cf34bdf3..7d77491b3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/providers/BlockEntityProvider.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/providers/BlockEntityProvider.java @@ -82,7 +82,7 @@ public class BlockEntityProvider implements Provider { private void sendBlockChange(UserConnection user, Position position, int blockId) throws Exception { PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_13.BLOCK_CHANGE, null, user); - wrapper.write(Type.POSITION, position); + wrapper.write(Type.POSITION1_8, position); wrapper.write(Type.VAR_INT, blockId); wrapper.send(Protocol1_13To1_12_2.class); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java index c9024ace3..2aabc672d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/storage/TabCompleteTracker.java @@ -39,7 +39,7 @@ public class TabCompleteTracker implements StorableObject { wrapper.write(Type.STRING, lastTabComplete); wrapper.write(Type.BOOLEAN, false); final Position playerLookTarget = Via.getManager().getProviders().get(PlayerLookTargetProvider.class).getPlayerLookTarget(connection); - wrapper.write(Type.OPTIONAL_POSITION, playerLookTarget); + wrapper.write(Type.OPTIONAL_POSITION1_8, playerLookTarget); try { wrapper.scheduleSendToServer(Protocol1_13To1_12_2.class); } catch (Exception e) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java index ba2eff6df..2314cb21f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/EntityPackets.java @@ -142,7 +142,7 @@ public class EntityPackets { map(Type.VAR_INT); map(Type.UUID); map(Type.VAR_INT); - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); map(Type.BYTE); } }); @@ -233,7 +233,7 @@ public class EntityPackets { int entityId = wrapper.get(Type.VAR_INT, 0); tracker.setSleeping(entityId, true); - Position position = wrapper.read(Type.POSITION); + Position position = wrapper.read(Type.POSITION1_8); List metadataList = new LinkedList<>(); metadataList.add(new Metadata(12, Types1_14.META_TYPES.optionalPositionType, position)); if (tracker.clientEntityId() != entityId) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java index c204d77d0..727d3a1fb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java @@ -37,7 +37,7 @@ public class PlayerPackets { protocol.registerClientbound(ClientboundPackets1_13.OPEN_SIGN_EDITOR, new PacketHandlers() { @Override public void register() { - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); } }); @@ -45,7 +45,7 @@ public class PlayerPackets { @Override public void register() { map(Type.VAR_INT); - map(Type.POSITION1_14, Type.POSITION); + map(Type.POSITION1_14, Type.POSITION1_8); } }); @@ -78,7 +78,7 @@ public class PlayerPackets { @Override public void register() { map(Type.VAR_INT); // Action - map(Type.POSITION1_14, Type.POSITION); // Position + map(Type.POSITION1_14, Type.POSITION1_8); // Position } }); @@ -109,19 +109,19 @@ public class PlayerPackets { protocol.registerServerbound(ServerboundPackets1_14.UPDATE_COMMAND_BLOCK, new PacketHandlers() { @Override public void register() { - map(Type.POSITION1_14, Type.POSITION); + map(Type.POSITION1_14, Type.POSITION1_8); } }); protocol.registerServerbound(ServerboundPackets1_14.UPDATE_STRUCTURE_BLOCK, new PacketHandlers() { @Override public void register() { - map(Type.POSITION1_14, Type.POSITION); + map(Type.POSITION1_14, Type.POSITION1_8); } }); protocol.registerServerbound(ServerboundPackets1_14.UPDATE_SIGN, new PacketHandlers() { @Override public void register() { - map(Type.POSITION1_14, Type.POSITION); + map(Type.POSITION1_14, Type.POSITION1_8); } }); @@ -134,7 +134,7 @@ public class PlayerPackets { float z = wrapper.read(Type.FLOAT); wrapper.read(Type.BOOLEAN); // new unknown boolean - wrapper.write(Type.POSITION, position); + wrapper.write(Type.POSITION1_8, position); wrapper.write(Type.VAR_INT, face); wrapper.write(Type.VAR_INT, hand); wrapper.write(Type.FLOAT, x); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java index cf3403b90..f20b403cd 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java @@ -59,20 +59,20 @@ public class WorldPackets { @Override public void register() { map(Type.VAR_INT); - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); map(Type.BYTE); } }); protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketHandlers() { @Override public void register() { - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); } }); protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketHandlers() { @Override public void register() { - map(Type.POSITION, Type.POSITION1_14); // Location + map(Type.POSITION1_8, Type.POSITION1_14); // Location map(Type.UNSIGNED_BYTE); // Action id map(Type.UNSIGNED_BYTE); // Action param map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE @@ -82,7 +82,7 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_13.BLOCK_CHANGE, new PacketHandlers() { @Override public void register() { - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); map(Type.VAR_INT); handler(wrapper -> { int id = wrapper.get(Type.VAR_INT, 0); @@ -251,7 +251,7 @@ public class WorldPackets { @Override public void register() { map(Type.INT); // Effect Id - map(Type.POSITION, Type.POSITION1_14); // Location + map(Type.POSITION1_8, Type.POSITION1_14); // Location map(Type.INT); // Data handler(wrapper -> { int id = wrapper.get(Type.INT, 0); @@ -308,7 +308,7 @@ public class WorldPackets { protocol.registerClientbound(ClientboundPackets1_13.SPAWN_POSITION, new PacketHandlers() { @Override public void register() { - map(Type.POSITION, Type.POSITION1_14); + map(Type.POSITION1_8, Type.POSITION1_14); } }); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java index d9db62449..a17eb77b9 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java @@ -58,7 +58,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol { //read data - Position position = wrapper.read(Type.POSITION); + Position position = wrapper.read(Type.POSITION1_8); JsonElement[] lines = new JsonElement[4]; for (int i = 0; i < 4; i++) { lines[i] = wrapper.read(Type.COMPONENT); @@ -68,7 +68,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol { @@ -229,7 +229,7 @@ public class WorldPackets { } if (action == 2) { // Update Command Block CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class); - provider.addOrUpdateBlock(wrapper.user(), wrapper.get(Type.POSITION, 0), wrapper.get(Type.NAMED_COMPOUND_TAG, 0)); + provider.addOrUpdateBlock(wrapper.user(), wrapper.get(Type.POSITION1_8, 0), wrapper.get(Type.NAMED_COMPOUND_TAG, 0)); // To prevent window issues don't send updates wrapper.cancel(); @@ -243,7 +243,7 @@ public class WorldPackets { protocol.registerServerbound(ServerboundPackets1_9.UPDATE_SIGN, new PacketHandlers() { @Override public void register() { - map(Type.POSITION); // 0 - Sign Position + map(Type.POSITION1_8); // 0 - Sign Position map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 1 - Sign Line (json) map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 2 - Sign Line (json) map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 3 - Sign Line (json) @@ -255,7 +255,7 @@ public class WorldPackets { @Override public void register() { map(Type.VAR_INT); // Action - map(Type.POSITION); // Position + map(Type.POSITION1_8); // Position handler(wrapper -> { int status = wrapper.get(Type.VAR_INT, 0); if (status == 6) @@ -282,7 +282,7 @@ public class WorldPackets { // Wipe the input buffer wrapper.clearInputBuffer(); wrapper.setPacketType(ServerboundPackets1_8.PLAYER_BLOCK_PLACEMENT); - wrapper.write(Type.POSITION, new Position(-1, (short) -1, -1)); + wrapper.write(Type.POSITION1_8, new Position(-1, (short) -1, -1)); wrapper.write(Type.UNSIGNED_BYTE, (short) 255); // Write item in hand Item item = Protocol1_9To1_8.getHandItem(wrapper.user()); @@ -335,7 +335,7 @@ public class WorldPackets { protocol.registerServerbound(ServerboundPackets1_9.PLAYER_BLOCK_PLACEMENT, new PacketHandlers() { @Override public void register() { - map(Type.POSITION); // 0 - Position + map(Type.POSITION1_8); // 0 - Position map(Type.VAR_INT, Type.UNSIGNED_BYTE); // 1 - Block Face handler(wrapper -> { final int hand = wrapper.read(Type.VAR_INT); // 2 - Hand @@ -354,7 +354,7 @@ public class WorldPackets { int face = wrapper.get(Type.UNSIGNED_BYTE, 0); if (face == 255) return; - Position p = wrapper.get(Type.POSITION, 0); + Position p = wrapper.get(Type.POSITION1_8, 0); int x = p.x(); int y = p.y(); int z = p.z(); @@ -386,13 +386,13 @@ public class WorldPackets { handler(wrapper -> { CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class); - Position pos = wrapper.get(Type.POSITION, 0); + Position pos = wrapper.get(Type.POSITION1_8, 0); Optional tag = provider.get(wrapper.user(), pos); // Send the Update Block Entity packet if present if (tag.isPresent()) { PacketWrapper updateBlockEntity = PacketWrapper.create(ClientboundPackets1_9.BLOCK_ENTITY_DATA, null, wrapper.user()); - updateBlockEntity.write(Type.POSITION, pos); + updateBlockEntity.write(Type.POSITION1_8, pos); updateBlockEntity.write(Type.UNSIGNED_BYTE, (short) 2); updateBlockEntity.write(Type.NAMED_COMPOUND_TAG, tag.get()); diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java index 0b35f9651..ba5528f4e 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java @@ -56,7 +56,7 @@ public class BlockRewriter { } public static BlockRewriter legacy(final Protocol protocol) { - return new BlockRewriter<>(protocol, Type.POSITION, Type.NAMED_COMPOUND_TAG); + return new BlockRewriter<>(protocol, Type.POSITION1_8, Type.NAMED_COMPOUND_TAG); } public static BlockRewriter for1_14(final Protocol protocol) {