From ceb08c1e558ed4d7ef68510d99dafd15c32a8358 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 5 Jun 2023 09:10:50 +0200 Subject: [PATCH] Update VV usage --- build.gradle.kts | 2 +- .../protocol1_12_2to1_13/Protocol1_12_2To1_13.java | 12 ++++++------ .../protocol1_13_2to1_14/Protocol1_13_2To1_14.java | 1 - .../Protocol1_14_3To1_14_4.java | 9 +++++---- .../protocol1_14_4to1_15/Protocol1_14_4To1_15.java | 8 ++++---- gradle/libs.versions.toml | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7d9a8424..b9c4b2cb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { allprojects { group = "com.viaversion" - version = "4.7.0-1.20-pre5-SNAPSHOT" + version = "4.7.0-1.20-rc1-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/Protocol1_12_2To1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java index c6b67234..07937e4b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java @@ -57,18 +57,18 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter(this) { @Override protected void handleTranslate(JsonObject root, String translate) { - String newTranslate = mappedTranslationKey(translate); - if (newTranslate != null || (newTranslate = getMappingData().getTranslateMappings().get(translate)) != null) { - root.addProperty("translate", newTranslate); + String mappedKey = mappedTranslationKey(translate); + if (mappedKey != null || (mappedKey = getMappingData().getTranslateMappings().get(translate)) != null) { + root.addProperty("translate", mappedKey); } } }; private final TranslatableRewriter translatableToLegacyRewriter = new TranslatableRewriter(this) { @Override protected void handleTranslate(JsonObject root, String translate) { - String newTranslate = mappedTranslationKey(translate); - if (newTranslate != null || (newTranslate = getMappingData().getTranslateMappings().get(translate)) != null) { - root.addProperty("translate", Protocol1_13To1_12_2.MAPPINGS.getMojangTranslation().getOrDefault(newTranslate, newTranslate)); + String mappedKey = mappedTranslationKey(translate); + if (mappedKey != null || (mappedKey = getMappingData().getTranslateMappings().get(translate)) != null) { + root.addProperty("translate", Protocol1_13To1_12_2.MAPPINGS.getMojangTranslation().getOrDefault(mappedKey, mappedKey)); } } }; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java index 9d3e5e71..2d7c9641 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java @@ -70,7 +70,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { int blockTagsSize = wrapper.passthrough(Type.VAR_INT); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_3to1_14_4/Protocol1_14_3To1_14_4.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_3to1_14_4/Protocol1_14_3To1_14_4.java index a2b0d3ea..08150885 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_3to1_14_4/Protocol1_14_3To1_14_4.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_3to1_14_4/Protocol1_14_3To1_14_4.java @@ -20,19 +20,20 @@ package com.viaversion.viabackwards.protocol.protocol1_14_3to1_14_4; import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.protocols.protocol1_14_4to1_14_3.ClientboundPackets1_14_4; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14; -public class Protocol1_14_3To1_14_4 extends BackwardsProtocol { +public class Protocol1_14_3To1_14_4 extends BackwardsProtocol { public Protocol1_14_3To1_14_4() { - super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); + super(ClientboundPackets1_14_4.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); } @Override protected void registerPackets() { // Acknowledge Player Digging - added in pre4 - registerClientbound(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING, ClientboundPackets1_14.BLOCK_CHANGE, new PacketHandlers() { + registerClientbound(ClientboundPackets1_14_4.ACKNOWLEDGE_PLAYER_DIGGING, ClientboundPackets1_14.BLOCK_CHANGE, new PacketHandlers() { @Override public void register() { map(Type.POSITION1_14); @@ -47,7 +48,7 @@ public class Protocol1_14_3To1_14_4 extends BackwardsProtocol { + registerClientbound(ClientboundPackets1_14_4.TRADE_LIST, wrapper -> { wrapper.passthrough(Type.VAR_INT); int size = wrapper.passthrough(Type.UNSIGNED_BYTE); for (int i = 0; i < size; i++) { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java index 8f0c865d..5460f255 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java @@ -31,14 +31,14 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.data.entity.EntityTrackerBase; -import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; +import com.viaversion.viaversion.protocols.protocol1_14_4to1_14_3.ClientboundPackets1_14_4; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; -public class Protocol1_14_4To1_15 extends BackwardsProtocol { +public class Protocol1_14_4To1_15 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.15", "1.14", Protocol1_15To1_14_4.class); private final EntityPackets1_15 entityRewriter = new EntityPackets1_15(this); @@ -46,7 +46,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this); public Protocol1_14_4To1_15() { - super(ClientboundPackets1_15.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); + super(ClientboundPackets1_15.class, ClientboundPackets1_14_4.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); } @Override @@ -76,7 +76,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol { - PacketWrapper soundPacket = wrapper.create(ClientboundPackets1_14.SOUND); + PacketWrapper soundPacket = wrapper.create(ClientboundPackets1_14_4.SOUND); soundPacket.write(Type.VAR_INT, 243); // entity.generic.explode soundPacket.write(Type.VAR_INT, 4); // blocks category soundPacket.write(Type.INT, toEffectCoordinate(wrapper.get(Type.FLOAT, 0))); // x diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1db1b8ba..f9ed98b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.1" [versions] # ViaVersion -viaver = "4.7.0-23w17a-SNAPSHOT" +viaver = "4.7.0-1.20-rc1-SNAPSHOT" # Common provided netty = "4.0.20.Final"