From 1029e704b6392a5accf83c4b6a478c92e9244e03 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 5 Nov 2024 23:03:43 +0100 Subject: [PATCH] 24w44a --- .../api/network/ProtocolVersion.java | 3 ++- .../proxy/protocol/StateRegistry.java | 4 +++- .../protocol/packet/UpsertPlayerInfoPacket.java | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java index 3b5bbcb85..786905be9 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -88,7 +88,8 @@ public enum ProtocolVersion implements Ordered { MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), MINECRAFT_1_21(767, "1.21", "1.21.1"), - MINECRAFT_1_21_2(768, "1.21.2", "1.21.3"); + MINECRAFT_1_21_2(768, "1.21.2", "1.21.3"), + MINECRAFT_1_21_4(-1, 220, "1.21.4"); private static final int SNAPSHOT_BIT = 30; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index 1bd70248a..a6da21be3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -38,6 +38,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_2; +import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_4; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_7_2; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9; @@ -358,7 +359,8 @@ public enum StateRegistry { map(0x27, MINECRAFT_1_20_2, false), map(0x28, MINECRAFT_1_20_3, false), map(0x2B, MINECRAFT_1_20_5, false), - map(0x2D, MINECRAFT_1_21_2, false)); + map(0x2D, MINECRAFT_1_21_2, false), + map(0x2E, MINECRAFT_1_21_4, false)); serverbound.register( FinishedUpdatePacket.class, () -> FinishedUpdatePacket.INSTANCE, map(0x0B, MINECRAFT_1_20_2, false), diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/UpsertPlayerInfoPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/UpsertPlayerInfoPacket.java index e2d40d2e3..817880cef 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/UpsertPlayerInfoPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/UpsertPlayerInfoPacket.java @@ -193,6 +193,11 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket { info.listOrder = ProtocolUtils.readVarInt(buf); }, (version, buf, info) -> { // write ProtocolUtils.writeVarInt(buf, info.listOrder); + }), + UPDATE_HAT((version, buf, info) -> { // read + info.showHat = buf.readBoolean(); + }, (version, buf, info) -> { // write + buf.writeBoolean(info.showHat); }); private final Read read; @@ -223,6 +228,7 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket { private int gameMode; @Nullable private ComponentHolder displayName; + private boolean showHat; private int listOrder; @Nullable private RemoteChatSession chatSession; @@ -256,6 +262,10 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket { return displayName; } + public boolean getShowHat() { + return showHat; + } + public int getListOrder() { return listOrder; } @@ -285,6 +295,10 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket { this.displayName = displayName; } + public void setShowHat(boolean showHat) { + this.showHat = showHat; + } + public void setListOrder(int listOrder) { this.listOrder = listOrder; }