From 08f6c0b1f11340a0e78e63fe3ca62bf2d5f7639b Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 2 Jun 2021 22:05:05 +0200 Subject: [PATCH] Update VV usage --- build.gradle.kts | 2 +- .../protocol1_12_2to1_13/packets/PlayerPacket1_13.java | 5 ++--- .../protocol1_14_4to1_15/packets/EntityPackets1_15.java | 4 ++-- .../protocol1_16_4to1_17/packets/BlockItemPackets1_17.java | 2 +- gradle/libs.versions.toml | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2ada7f28..2d24fea7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { allprojects { group = "com.viaversion" - version = "4.0.0-1.17-pre2-SNAPSHOT" + version = "4.0.0-1.17-pre4-SNAPSHOT" description = "Allow older clients to join newer server versions." } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java index 2da2d771..8afe38c9 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java @@ -30,7 +30,6 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; -import com.viaversion.viaversion.api.protocol.remapper.ValueCreator; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1; @@ -66,9 +65,9 @@ public class PlayerPacket1_13 extends RewriterBase { @Override public void handle(PacketWrapper packetWrapper) throws Exception { packetWrapper.cancel(); - packetWrapper.create(0x02, new ValueCreator() { // Plugin response + packetWrapper.create(0x02, new PacketHandler() { // Plugin response @Override - public void write(PacketWrapper newWrapper) throws Exception { + public void handle(PacketWrapper newWrapper) throws Exception { newWrapper.write(Type.VAR_INT, packetWrapper.read(Type.VAR_INT)); // Packet id newWrapper.write(Type.BOOLEAN, false); // Success } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java index 1145dad3..16ffede0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/packets/EntityPackets1_15.java @@ -87,7 +87,7 @@ public class EntityPackets1_15 extends EntityRewriter { map(Type.SHORT); // 9 - Velocity X map(Type.SHORT); // 10 - Velocity Y map(Type.SHORT); // 11 - Velocity Z - create(wrapper -> wrapper.write(Types1_14.METADATA_LIST, new ArrayList<>())); // Metadata is no longer sent in 1.15, so we have to send an empty one + handler(wrapper -> wrapper.write(Types1_14.METADATA_LIST, new ArrayList<>())); // Metadata is no longer sent in 1.15, so we have to send an empty one handler(wrapper -> { int type = wrapper.get(Type.VAR_INT, 1); @@ -140,7 +140,7 @@ public class EntityPackets1_15 extends EntityRewriter { map(Type.DOUBLE); // 4 - Z map(Type.BYTE); // 5 - Yaw map(Type.BYTE); // 6 - Pitch - create(wrapper -> wrapper.write(Types1_14.METADATA_LIST, new ArrayList<>())); // Metadata is no longer sent in 1.15, so we have to send an empty one + handler(wrapper -> wrapper.write(Types1_14.METADATA_LIST, new ArrayList<>())); // Metadata is no longer sent in 1.15, so we have to send an empty one handler(getTrackerHandler(Entity1_15Types.PLAYER, Type.VAR_INT)); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java index f3b1cd1a..ad612439 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java @@ -302,7 +302,7 @@ public class BlockItemPackets1_17 extends com.viaversion.viabackwards.api.rewrit public void registerMap() { map(Type.VAR_INT); // Map ID map(Type.BYTE); // Scale - create(wrapper -> wrapper.write(Type.BOOLEAN, true)); // Tracking position + handler(wrapper -> wrapper.write(Type.BOOLEAN, true)); // Tracking position map(Type.BOOLEAN); // Locked handler(wrapper -> { boolean hasMarkers = wrapper.read(Type.BOOLEAN); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a6bf826f..83d0c98e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.0" [versions] # ViaVersion -viaver = "4.0.0-1.17-pre2-SNAPSHOT" +viaver = "4.0.0-1.17-pre4-SNAPSHOT" # Common provided netty = "4.0.20.Final"