From 07b173bb746cc493d3967e391a141cfb5349fcdd Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 19 Nov 2023 16:13:04 +0100 Subject: [PATCH] 23w46a (probably) --- .../api/protocol/version/ProtocolVersion.java | 2 +- .../Protocol1_20_3To1_20_2.java | 36 +++++-- .../packet/ClientboundPackets1_20_3.java | 99 +++++++++--------- .../viaversion/data/identifiers-1.20.3.nbt | Bin 3359 -> 3366 bytes .../data/mappings-1.20.2to1.20.3.nbt | Bin 820 -> 897 bytes gradle.properties | 2 +- 6 files changed, 81 insertions(+), 58 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java index e7334df42..00b1691f3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java @@ -85,7 +85,7 @@ public class ProtocolVersion { public static final ProtocolVersion v1_19_4 = register(762, "1.19.4"); public static final ProtocolVersion v1_20 = register(763, "1.20/1.20.1", new VersionRange("1.20", 0, 1)); public static final ProtocolVersion v1_20_2 = register(764, "1.20.2"); - public static final ProtocolVersion v1_20_3 = register(765, 162, "1.20.3"); + public static final ProtocolVersion v1_20_3 = register(765, 163, "1.20.3"); public static final ProtocolVersion unknown = register(-1, "UNKNOWN"); public static ProtocolVersion register(int version, String name) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java index 7747e56e4..e563d72bb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/Protocol1_20_3To1_20_2.java @@ -52,6 +52,7 @@ import com.viaversion.viaversion.api.type.types.UUIDIntArrayType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; import com.viaversion.viaversion.data.entity.EntityTrackerBase; +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; @@ -103,6 +104,34 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol(this).register(ClientboundPackets1_20_2.STATISTICS); + new CommandRewriter1_19_4<>(this).registerDeclareCommands1_19(ClientboundPackets1_20_2.DECLARE_COMMANDS); + + registerClientbound(ClientboundPackets1_20_2.UPDATE_SCORE, wrapper -> { + wrapper.passthrough(Type.STRING); // Owner + + final byte action = wrapper.read(Type.BYTE); + wrapper.passthrough(Type.STRING); // Objective name + + // Write or pass through value + if (action != -1) { + wrapper.passthrough(Type.VAR_INT); + } else { + wrapper.write(Type.VAR_INT, 0); + } + + // Null display and number format + wrapper.write(Type.OPTIONAL_TAG, null); + wrapper.write(Type.BOOLEAN, false); + }); + registerClientbound(ClientboundPackets1_20_2.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 + wrapper.write(Type.BOOLEAN, false); // Null number format + } + }); registerServerbound(ServerboundPackets1_20_3.UPDATE_JIGSAW_BLOCK, wrapper -> { wrapper.passthrough(Type.POSITION1_14); // Position @@ -210,13 +239,6 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol { - 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_2.TEAMS, wrapper -> { wrapper.passthrough(Type.STRING); // Team Name final byte action = wrapper.passthrough(Type.BYTE); // Mode diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/packet/ClientboundPackets1_20_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/packet/ClientboundPackets1_20_3.java index f1c15f4f2..ca941e078 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/packet/ClientboundPackets1_20_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/packet/ClientboundPackets1_20_3.java @@ -87,55 +87,56 @@ public enum ClientboundPackets1_20_3 implements ClientboundPacketType { UNLOCK_RECIPES, // 0x3F REMOVE_ENTITIES, // 0x40 REMOVE_ENTITY_EFFECT, // 0x41 - RESOURCE_PACK, // 0x42 - RESPAWN, // 0x43 - ENTITY_HEAD_LOOK, // 0x44 - MULTI_BLOCK_CHANGE, // 0x45 - SELECT_ADVANCEMENTS_TAB, // 0x46 - SERVER_DATA, // 0x47 - ACTIONBAR, // 0x48 - WORLD_BORDER_CENTER, // 0x49 - WORLD_BORDER_LERP_SIZE, // 0x4A - WORLD_BORDER_SIZE, // 0x4B - WORLD_BORDER_WARNING_DELAY, // 0x4C - WORLD_BORDER_WARNING_DISTANCE, // 0x4D - CAMERA, // 0x4E - HELD_ITEM_CHANGE, // 0x4F - UPDATE_VIEW_POSITION, // 0x50 - UPDATE_VIEW_DISTANCE, // 0x51 - SPAWN_POSITION, // 0x52 - DISPLAY_SCOREBOARD, // 0x53 - ENTITY_METADATA, // 0x54 - ATTACH_ENTITY, // 0x55 - ENTITY_VELOCITY, // 0x56 - ENTITY_EQUIPMENT, // 0x57 - SET_EXPERIENCE, // 0x58 - UPDATE_HEALTH, // 0x59 - SCOREBOARD_OBJECTIVE, // 0x5A - SET_PASSENGERS, // 0x5B - TEAMS, // 0x5C - UPDATE_SCORE, // 0x5D - SET_SIMULATION_DISTANCE, // 0x5E - TITLE_SUBTITLE, // 0x5F - TIME_UPDATE, // 0x60 - TITLE_TEXT, // 0x61 - TITLE_TIMES, // 0x62 - ENTITY_SOUND, // 0x63 - SOUND, // 0x64 - START_CONFIGURATION, // 0x65 - STOP_SOUND, // 0x66 - SYSTEM_CHAT, // 0x67 - TAB_LIST, // 0x68 - NBT_QUERY, // 0x69 - COLLECT_ITEM, // 0x6A - ENTITY_TELEPORT, // 0x6B - TICKING_STATE,// 0x6C - TICKING_STEP, // 0x6D - ADVANCEMENTS, // 0x6E - ENTITY_PROPERTIES, // 0x6F - ENTITY_EFFECT, // 0x70 - DECLARE_RECIPES, // 0x71 - TAGS; // 0x72 + RESET_SCORE, // 0x42 + RESOURCE_PACK, // 0x43 + RESPAWN, // 0x44 + ENTITY_HEAD_LOOK, // 0x45 + MULTI_BLOCK_CHANGE, // 0x46 + SELECT_ADVANCEMENTS_TAB, // 0x47 + SERVER_DATA, // 0x48 + ACTIONBAR, // 0x49 + WORLD_BORDER_CENTER, // 0x4A + WORLD_BORDER_LERP_SIZE, // 0x4B + WORLD_BORDER_SIZE, // 0x4C + WORLD_BORDER_WARNING_DELAY, // 0x4D + WORLD_BORDER_WARNING_DISTANCE, // 0x4E + CAMERA, // 0x4F + HELD_ITEM_CHANGE, // 0x50 + UPDATE_VIEW_POSITION, // 0x51 + UPDATE_VIEW_DISTANCE, // 0x52 + SPAWN_POSITION, // 0x53 + DISPLAY_SCOREBOARD, // 0x54 + ENTITY_METADATA, // 0x55 + ATTACH_ENTITY, // 0x56 + ENTITY_VELOCITY, // 0x57 + ENTITY_EQUIPMENT, // 0x58 + SET_EXPERIENCE, // 0x59 + UPDATE_HEALTH, // 0x5A + SCOREBOARD_OBJECTIVE, // 0x5B + SET_PASSENGERS, // 0x5C + TEAMS, // 0x5D + UPDATE_SCORE, // 0x5E + SET_SIMULATION_DISTANCE, // 0x5F + TITLE_SUBTITLE, // 0x60 + TIME_UPDATE, // 0x61 + TITLE_TEXT, // 0x62 + TITLE_TIMES, // 0x63 + ENTITY_SOUND, // 0x64 + SOUND, // 0x65 + START_CONFIGURATION, // 0x66 + STOP_SOUND, // 0x67 + SYSTEM_CHAT, // 0x68 + TAB_LIST, // 0x69 + NBT_QUERY, // 0x6A + COLLECT_ITEM, // 0x6B + ENTITY_TELEPORT, // 0x6C + TICKING_STATE, // 0x6D + TICKING_STEP, // 0x6E + ADVANCEMENTS, // 0x6F + ENTITY_PROPERTIES, // 0x70 + ENTITY_EFFECT, // 0x71 + DECLARE_RECIPES, // 0x72 + TAGS; // 0x73 @Override public int getId() { diff --git a/common/src/main/resources/assets/viaversion/data/identifiers-1.20.3.nbt b/common/src/main/resources/assets/viaversion/data/identifiers-1.20.3.nbt index 11e6c96bea9e9f5a920d024727d0d813e16438ec..fa6b7c52c615482e20c4fb4627a8d946980adc27 100644 GIT binary patch delta 25 hcmbO)wM=TmCN4&!$(y;}v9T7HROX~^UcgJY diff --git a/common/src/main/resources/assets/viaversion/data/mappings-1.20.2to1.20.3.nbt b/common/src/main/resources/assets/viaversion/data/mappings-1.20.2to1.20.3.nbt index 595f04ae552746f83d4d6fd83c0e5137769c3224..682b709a4c1d0af09fdf3ee211212b13198f688a 100644 GIT binary patch delta 96 zcmdnO*2q3VpHXC@K^5bajjLUmym%9f(o1tw^GZr83sQ@j8Mty23kp(Gf-|d985kIh m7#Wx{Qy7^USc)M6hTIHHi6uZ8Mj#dfa!T@{9O21tncM*u0~SyK delta 21 ccmZo<-@-OQpOI&xK^0@q#?`J&lWmz@07)