From 8f5683f7640a1f8f2795f8a5903fcba664151912 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 19 Nov 2023 16:48:24 +0100 Subject: [PATCH] 23w46a (mostly) --- .../Protocol1_20_2To1_20_3.java | 47 +++++++++++++++--- .../data/mappings-1.20.3to1.20.2.nbt | Bin 7481 -> 7630 bytes gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java index 5fb6d647..5c6693ce 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java @@ -34,6 +34,7 @@ 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.libs.opennbt.tag.builtin.Tag; +import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.CommandRewriter1_19_4; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2; @@ -42,6 +43,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3 import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3; import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3; import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType; +import com.viaversion.viaversion.rewriter.StatisticsRewriter; import java.util.BitSet; public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol { @@ -64,6 +66,44 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol(this).register(ClientboundPackets1_20_3.STATISTICS); + new CommandRewriter1_19_4(this) { + @Override + public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { + if (argumentType.equals("minecraft:style")) { + wrapper.write(Type.VAR_INT, 1); // Phrase + } else { + super.handleArgument(wrapper, argumentType); + } + } + }.registerDeclareCommands1_19(ClientboundPackets1_20_3.DECLARE_COMMANDS); + + registerClientbound(ClientboundPackets1_20_3.RESET_SCORE, ClientboundPackets1_20_2.UPDATE_SCORE, wrapper -> { + wrapper.passthrough(Type.STRING); // Owner + wrapper.write(Type.BYTE, (byte) 1); // Reset score + wrapper.passthrough(Type.STRING); // Objective name + }); + registerClientbound(ClientboundPackets1_20_3.UPDATE_SCORE, wrapper -> { + wrapper.passthrough(Type.STRING); // Owner + wrapper.write(Type.BYTE, (byte) 0); // Change score + wrapper.passthrough(Type.STRING); // Objective name + wrapper.passthrough(Type.VAR_INT); // Score + + // Remove display and number format + wrapper.clearInputBuffer(); + }); + registerClientbound(ClientboundPackets1_20_3.SCOREBOARD_OBJECTIVE, wrapper -> { + wrapper.passthrough(Type.STRING); // Objective Name + final byte action = wrapper.passthrough(Type.BYTE); // Method + if (action == 0 || action == 2) { + convertComponent(wrapper); // Display Name + wrapper.passthrough(Type.VAR_INT); // Render type + + // Remove number format + wrapper.clearInputBuffer(); + } + }); + cancelClientbound(ClientboundPackets1_20_3.TICKING_STATE); cancelClientbound(ClientboundPackets1_20_3.TICKING_STEP); @@ -173,13 +213,6 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol { - wrapper.passthrough(Type.STRING); // Objective Name - final byte action = wrapper.passthrough(Type.BYTE); // Mode - if (action == 0 || action == 2) { - convertComponent(wrapper); // Display Name - } - }); registerClientbound(ClientboundPackets1_20_3.TEAMS, wrapper -> { wrapper.passthrough(Type.STRING); // Team Name final byte action = wrapper.passthrough(Type.BYTE); // Mode diff --git a/common/src/main/resources/assets/viabackwards/data/mappings-1.20.3to1.20.2.nbt b/common/src/main/resources/assets/viabackwards/data/mappings-1.20.3to1.20.2.nbt index b48b4806c74d7661c2fbb99b82c509367612c328..9e60ea7effc5f4b61612b73a08eaba862d1bd5cb 100644 GIT binary patch delta 216 zcmdmKb m-v;74Kzw)dG{zmAK;0!kO$?2b%b8AXPGk<{+|12;SO5U=^Baf& diff --git a/gradle.properties b/gradle.properties index a0ec978c..33aa8a8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=4.9.0-23w45a-SNAPSHOT +projectVersion=4.9.0-23w46a-SNAPSHOT # Smile emoji mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 18b23577..2f9ed8d7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.1" [versions] # ViaVersion -viaver = "4.9.0-23w45a-SNAPSHOT" +viaver = "4.9.0-23w46a-SNAPSHOT" # Common provided netty = "4.0.20.Final"