Skip to content

Commit 7a85663

Browse files
authored
Update to 1.21.4 (#3319)
1 parent bcff6c6 commit 7a85663

14 files changed

+117
-56
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ group = "com.comphenix.protocol"
1313
version = "5.4.0-SNAPSHOT"
1414
description = "Provides access to the Minecraft protocol"
1515

16-
val mcVersion = "1.21.3"
16+
val mcVersion = "1.21.4"
1717
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
1818
val buildNumber = System.getenv("BUILD_NUMBER") ?: ""
1919
val isJenkins = buildNumber.isNotEmpty()

src/main/java/com/comphenix/protocol/PacketType.java

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -462,32 +462,34 @@ public static class Client extends PacketTypeEnum {
462462
public static final PacketType GROUND = new PacketType(PROTOCOL, SENDER, 0x1F, "net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$StatusOnly", "Flying$d");
463463
public static final PacketType VEHICLE_MOVE = new PacketType(PROTOCOL, SENDER, 0x20, "MoveVehicle", "VehicleMove", "CPacketVehicleMove");
464464
public static final PacketType BOAT_MOVE = new PacketType(PROTOCOL, SENDER, 0x21, "PaddleBoat", "BoatMove", "CPacketSteerBoat");
465-
public static final PacketType PICK_ITEM = new PacketType(PROTOCOL, SENDER, 0x22, "PickItem");
466-
public static final PacketType PING_REQUEST = new PacketType(PROTOCOL, SENDER, 0x23, "PingRequest");
467-
public static final PacketType AUTO_RECIPE = new PacketType(PROTOCOL, SENDER, 0x24, "PlaceRecipe", "AutoRecipe", "CPacketPlaceRecipe");
468-
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x25, "PlayerAbilities", "Abilities", "CPacketPlayerAbilities");
469-
public static final PacketType BLOCK_DIG = new PacketType(PROTOCOL, SENDER, 0x26, "PlayerAction", "BlockDig", "CPacketPlayerDigging");
470-
public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x27, "PlayerCommand", "EntityAction", "CPacketEntityAction");
471-
public static final PacketType STEER_VEHICLE = new PacketType(PROTOCOL, SENDER, 0x28, "PlayerInput", "SteerVehicle", "CPacketInput");
472-
public static final PacketType PONG = new PacketType(PROTOCOL, SENDER, 0x29, "Pong");
473-
public static final PacketType RECIPE_SETTINGS = new PacketType(PROTOCOL, SENDER, 0x2A, "RecipeBookChangeSettings", "RecipeSettings");
474-
public static final PacketType RECIPE_DISPLAYED = new PacketType(PROTOCOL, SENDER, 0x2B, "RecipeBookSeenRecipe", "RecipeDisplayed", "CPacketRecipeInfo");
475-
public static final PacketType ITEM_NAME = new PacketType(PROTOCOL, SENDER, 0x2C, "RenameItem", "ItemName");
476-
public static final PacketType RESOURCE_PACK_STATUS = new PacketType(PROTOCOL, SENDER, 0x2D, "ResourcePack", "ResourcePackStatus", "CPacketResourcePackStatus");
477-
public static final PacketType ADVANCEMENTS = new PacketType(PROTOCOL, SENDER, 0x2E, "SeenAdvancements", "Advancements", "CPacketSeenAdvancements");
478-
public static final PacketType TR_SEL = new PacketType(PROTOCOL, SENDER, 0x2F, "SelectTrade", "TrSel");
479-
public static final PacketType BEACON = new PacketType(PROTOCOL, SENDER, 0x30, "SetBeacon", "Beacon");
480-
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x31, "SetCarriedItem", "HeldItemSlot", "CPacketHeldItemChange");
481-
public static final PacketType SET_COMMAND_BLOCK = new PacketType(PROTOCOL, SENDER, 0x32, "SetCommandBlock");
482-
public static final PacketType SET_COMMAND_MINECART = new PacketType(PROTOCOL, SENDER, 0x33, "SetCommandMinecart");
483-
public static final PacketType SET_CREATIVE_SLOT = new PacketType(PROTOCOL, SENDER, 0x34, "SetCreativeModeSlot", "SetCreativeSlot", "CPacketCreativeInventoryAction");
484-
public static final PacketType SET_JIGSAW = new PacketType(PROTOCOL, SENDER, 0x35, "SetJigsawBlock", "SetJigsaw");
485-
public static final PacketType STRUCT = new PacketType(PROTOCOL, SENDER, 0x36, "SetStructureBlock", "Struct");
486-
public static final PacketType UPDATE_SIGN = new PacketType(PROTOCOL, SENDER, 0x37, "SignUpdate", "UpdateSign", "CPacketUpdateSign");
487-
public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x38, "Swing", "ArmAnimation", "CPacketAnimation");
488-
public static final PacketType SPECTATE = new PacketType(PROTOCOL, SENDER, 0x39, "TeleportToEntity", "Spectate", "CPacketSpectate");
489-
public static final PacketType USE_ITEM_ON = new PacketType(PROTOCOL, SENDER, 0x3B, "UseItemOn", "BlockPlace", "CPacketPlayerTryUseItemOnBlock");
490-
public static final PacketType USE_ITEM = new PacketType(PROTOCOL, SENDER, 0x3A, "UseItem", "CPacketPlayerTryUseItem");
465+
public static final PacketType PICK_ITEM_FROM_BLOCK = new PacketType(PROTOCOL, SENDER, 0x22, "PickItemFromBlock");
466+
public static final PacketType PICK_ITEM = new PacketType(PROTOCOL, SENDER, 0x23, "PickItemFromEntity", "PickItem");
467+
public static final PacketType PING_REQUEST = new PacketType(PROTOCOL, SENDER, 0x24, "PingRequest");
468+
public static final PacketType AUTO_RECIPE = new PacketType(PROTOCOL, SENDER, 0x25, "PlaceRecipe", "AutoRecipe", "CPacketPlaceRecipe");
469+
public static final PacketType ABILITIES = new PacketType(PROTOCOL, SENDER, 0x26, "PlayerAbilities", "Abilities", "CPacketPlayerAbilities");
470+
public static final PacketType BLOCK_DIG = new PacketType(PROTOCOL, SENDER, 0x27, "PlayerAction", "BlockDig", "CPacketPlayerDigging");
471+
public static final PacketType ENTITY_ACTION = new PacketType(PROTOCOL, SENDER, 0x28, "PlayerCommand", "EntityAction", "CPacketEntityAction");
472+
public static final PacketType STEER_VEHICLE = new PacketType(PROTOCOL, SENDER, 0x29, "PlayerInput", "SteerVehicle", "CPacketInput");
473+
public static final PacketType PLAYER_LOADED = new PacketType(PROTOCOL, SENDER, 0x2A, "PlayerLoaded");
474+
public static final PacketType PONG = new PacketType(PROTOCOL, SENDER, 0x2B, "Pong");
475+
public static final PacketType RECIPE_SETTINGS = new PacketType(PROTOCOL, SENDER, 0x2C, "RecipeBookChangeSettings", "RecipeSettings");
476+
public static final PacketType RECIPE_DISPLAYED = new PacketType(PROTOCOL, SENDER, 0x2D, "RecipeBookSeenRecipe", "RecipeDisplayed", "CPacketRecipeInfo");
477+
public static final PacketType ITEM_NAME = new PacketType(PROTOCOL, SENDER, 0x2E, "RenameItem", "ItemName");
478+
public static final PacketType RESOURCE_PACK_STATUS = new PacketType(PROTOCOL, SENDER, 0x2F, "ResourcePack", "ResourcePackStatus", "CPacketResourcePackStatus");
479+
public static final PacketType ADVANCEMENTS = new PacketType(PROTOCOL, SENDER, 0x30, "SeenAdvancements", "Advancements", "CPacketSeenAdvancements");
480+
public static final PacketType TR_SEL = new PacketType(PROTOCOL, SENDER, 0x31, "SelectTrade", "TrSel");
481+
public static final PacketType BEACON = new PacketType(PROTOCOL, SENDER, 0x32, "SetBeacon", "Beacon");
482+
public static final PacketType HELD_ITEM_SLOT = new PacketType(PROTOCOL, SENDER, 0x33, "SetCarriedItem", "HeldItemSlot", "CPacketHeldItemChange");
483+
public static final PacketType SET_COMMAND_BLOCK = new PacketType(PROTOCOL, SENDER, 0x34, "SetCommandBlock");
484+
public static final PacketType SET_COMMAND_MINECART = new PacketType(PROTOCOL, SENDER, 0x35, "SetCommandMinecart");
485+
public static final PacketType SET_CREATIVE_SLOT = new PacketType(PROTOCOL, SENDER, 0x36, "SetCreativeModeSlot", "SetCreativeSlot", "CPacketCreativeInventoryAction");
486+
public static final PacketType SET_JIGSAW = new PacketType(PROTOCOL, SENDER, 0x37, "SetJigsawBlock", "SetJigsaw");
487+
public static final PacketType STRUCT = new PacketType(PROTOCOL, SENDER, 0x38, "SetStructureBlock", "Struct");
488+
public static final PacketType UPDATE_SIGN = new PacketType(PROTOCOL, SENDER, 0x39, "SignUpdate", "UpdateSign", "CPacketUpdateSign");
489+
public static final PacketType ARM_ANIMATION = new PacketType(PROTOCOL, SENDER, 0x3A, "Swing", "ArmAnimation", "CPacketAnimation");
490+
public static final PacketType SPECTATE = new PacketType(PROTOCOL, SENDER, 0x3B, "TeleportToEntity", "Spectate", "CPacketSpectate");
491+
public static final PacketType USE_ITEM_ON = new PacketType(PROTOCOL, SENDER, 0x3D, "UseItemOn", "BlockPlace", "CPacketPlayerTryUseItemOnBlock");
492+
public static final PacketType USE_ITEM = new PacketType(PROTOCOL, SENDER, 0x3C, "UseItem", "CPacketPlayerTryUseItem");
491493

492494
/**
493495
* @deprecated Removed in 1.17

src/main/java/com/comphenix/protocol/utility/MinecraftVersion.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
* @author Kristian
3737
*/
3838
public final class MinecraftVersion implements Comparable<MinecraftVersion>, Serializable {
39+
/**
40+
* Version 1.21.4 - the garden awakens drop
41+
*/
42+
public static final MinecraftVersion v1_21_4 = new MinecraftVersion("1.21.4");
43+
3944
/**
4045
* Version 1.21.2 - the bundles of bravery drop
4146
*/
@@ -154,7 +159,7 @@ public final class MinecraftVersion implements Comparable<MinecraftVersion>, Ser
154159
/**
155160
* The latest release version of minecraft.
156161
*/
157-
public static final MinecraftVersion LATEST = v1_21_2;
162+
public static final MinecraftVersion LATEST = v1_21_4;
158163

159164
// used when serializing
160165
private static final long serialVersionUID = -8695133558996459770L;

src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public enum PlayerInfoAction {
141141
UPDATE_LATENCY,
142142
UPDATE_DISPLAY_NAME,
143143
UPDATE_LIST_ORDER,
144+
UPDATE_HAT,
144145
/**
145146
* @deprecated Removed in 1.19.3
146147
*/

src/main/java/com/comphenix/protocol/wrappers/PlayerInfoData.java

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class PlayerInfoData {
4242
private final int latency;
4343
private final int listOrder = 0;
4444
private final boolean listed;
45+
private final boolean showHat;
4546
private final NativeGameMode gameMode;
4647
private final WrappedGameProfile profile;
4748
private final WrappedChatComponent displayName;
@@ -74,6 +75,21 @@ public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMod
7475
this(profileId, latency, listed, gameMode, profile, displayName, (WrappedRemoteChatSessionData) null);
7576
}
7677

78+
/**
79+
* Constructs a new PlayerInfoData for Minecraft 1.19.3 or later.
80+
*
81+
* @param profileId the id of the profile (has to be non-null)
82+
* @param latency the latency in milliseconds
83+
* @param listed whether the player is listed in the tab list
84+
* @param gameMode the game mode
85+
* @param profile the game profile
86+
* @param displayName display name in tab list (optional)
87+
* @param remoteChatSession the remote chat session for this profile or null
88+
*/
89+
public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMode gameMode, WrappedGameProfile profile, WrappedChatComponent displayName, @Nullable WrappedRemoteChatSessionData remoteChatSession) {
90+
this(profileId, latency, listed, gameMode, profile, displayName, false, remoteChatSession);
91+
}
92+
7793
/**
7894
* Constructs a new PlayerInfoData for Minecraft 1.19. This is incompatible on 1.19.3.
7995
* @see PlayerInfoData#PlayerInfoData(UUID, int, boolean, NativeGameMode, WrappedGameProfile, WrappedChatComponent, WrappedRemoteChatSessionData)
@@ -96,20 +112,22 @@ public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMod
96112
this.displayName = displayName;
97113
this.profileKeyData = profileKeyData;
98114
this.remoteChatSessionData = null;
115+
this.showHat = false;
99116
}
100117

101118
/**
102-
* Constructs a new PlayerInfoData for Minecraft 1.19.3 or later.
119+
* Constructs a new PlayerInfoData for Minecraft 1.21.4 or later.
103120
*
104121
* @param profileId the id of the profile (has to be non-null)
105122
* @param latency the latency in milliseconds
106123
* @param listed whether the player is listed in the tab list
107124
* @param gameMode the game mode
108125
* @param profile the game profile
109126
* @param displayName display name in tab list (optional)
127+
* @param showHat whether a hat should be shown
110128
* @param remoteChatSession the remote chat session for this profile or null
111129
*/
112-
public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMode gameMode, WrappedGameProfile profile, WrappedChatComponent displayName, @Nullable WrappedRemoteChatSessionData remoteChatSession) {
130+
public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMode gameMode, WrappedGameProfile profile, WrappedChatComponent displayName, boolean showHat, @Nullable WrappedRemoteChatSessionData remoteChatSession) {
113131
this.profileId = profileId;
114132
this.latency = latency;
115133
this.listed = listed;
@@ -118,6 +136,7 @@ public PlayerInfoData(UUID profileId, int latency, boolean listed, NativeGameMod
118136
this.displayName = displayName;
119137
this.profileKeyData = null;
120138
this.remoteChatSessionData = remoteChatSession;
139+
this.showHat = showHat;
121140
}
122141

123142
/**
@@ -179,6 +198,14 @@ public WrappedChatComponent getDisplayName() {
179198
return displayName;
180199
}
181200

201+
/**
202+
* Gets if a hat is shown (since 1.21.4)
203+
* @return if the hat is shown
204+
*/
205+
public boolean isShowHat() {
206+
return showHat;
207+
}
208+
182209
/**
183210
* Returns the public key of the profile (since 1.19). Returns the public key of the remote chat session since 1.19.3
184211
* @return The public key of the profile.
@@ -227,6 +254,9 @@ public Object getGeneric(PlayerInfoData specific) {
227254
args.add(EnumWrappers.getGameModeClass());
228255
args.add(MinecraftReflection.getIChatBaseComponentClass());
229256

257+
if (MinecraftVersion.v1_21_4.atOrAbove()) {
258+
args.add(boolean.class);
259+
}
230260
if (MinecraftVersion.v1_21_2.atOrAbove()) {
231261
args.add(int.class);
232262
}
@@ -253,7 +283,19 @@ public Object getGeneric(PlayerInfoData specific) {
253283

254284
Object[] args;
255285

256-
if (MinecraftVersion.v1_21_2.atOrAbove()) {
286+
if (MinecraftVersion.v1_21_4.atOrAbove()) {
287+
args = new Object[] {
288+
specific.profileId,
289+
profile,
290+
specific.listed,
291+
specific.latency,
292+
gameMode,
293+
displayName,
294+
specific.showHat,
295+
specific.listOrder,
296+
remoteChatSessionData
297+
};
298+
} else if (MinecraftVersion.v1_21_2.atOrAbove()) {
257299
args = new Object[] {
258300
specific.profileId,
259301
profile,
@@ -326,6 +368,17 @@ public PlayerInfoData getSpecific(Object generic) {
326368
MinecraftReflection.getIChatBaseComponentClass(), BukkitConverters.getWrappedChatComponentConverter());
327369
WrappedChatComponent displayName = displayNames.read(0);
328370

371+
if (MinecraftVersion.v1_21_4.atOrAbove()) {
372+
return new PlayerInfoData(modifier.<UUID>withType(UUID.class).read(0),
373+
latency,
374+
modifier.<Boolean>withType(boolean.class).read(0),
375+
gameMode,
376+
gameProfile,
377+
displayName,
378+
modifier.<Boolean>withType(boolean.class).read(1),
379+
modifier.withType(MinecraftReflection.getRemoteChatSessionDataClass(), BukkitConverters.getWrappedRemoteChatSessionDataConverter()).read(0)
380+
);
381+
}
329382
if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) {
330383
return new PlayerInfoData(modifier.<UUID>withType(UUID.class).read(0),
331384
latency,

src/test/java/com/comphenix/protocol/BukkitInitialization.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@
4646
import org.bukkit.NamespacedKey;
4747
import org.bukkit.Registry;
4848
import org.bukkit.World;
49-
import org.bukkit.craftbukkit.v1_21_R2.CraftLootTable;
50-
import org.bukkit.craftbukkit.v1_21_R2.CraftRegistry;
51-
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
52-
import org.bukkit.craftbukkit.v1_21_R2.CraftWorld;
53-
import org.bukkit.craftbukkit.v1_21_R2.inventory.CraftItemFactory;
54-
import org.bukkit.craftbukkit.v1_21_R2.tag.CraftBlockTag;
55-
import org.bukkit.craftbukkit.v1_21_R2.tag.CraftEntityTag;
56-
import org.bukkit.craftbukkit.v1_21_R2.tag.CraftFluidTag;
57-
import org.bukkit.craftbukkit.v1_21_R2.tag.CraftItemTag;
58-
import org.bukkit.craftbukkit.v1_21_R2.util.CraftMagicNumbers;
59-
import org.bukkit.craftbukkit.v1_21_R2.util.CraftNamespacedKey;
60-
import org.bukkit.craftbukkit.v1_21_R2.util.Versioning;
49+
import org.bukkit.craftbukkit.v1_21_R3.CraftLootTable;
50+
import org.bukkit.craftbukkit.v1_21_R3.CraftRegistry;
51+
import org.bukkit.craftbukkit.v1_21_R3.CraftServer;
52+
import org.bukkit.craftbukkit.v1_21_R3.CraftWorld;
53+
import org.bukkit.craftbukkit.v1_21_R3.inventory.CraftItemFactory;
54+
import org.bukkit.craftbukkit.v1_21_R3.tag.CraftBlockTag;
55+
import org.bukkit.craftbukkit.v1_21_R3.tag.CraftEntityTag;
56+
import org.bukkit.craftbukkit.v1_21_R3.tag.CraftFluidTag;
57+
import org.bukkit.craftbukkit.v1_21_R3.tag.CraftItemTag;
58+
import org.bukkit.craftbukkit.v1_21_R3.util.CraftMagicNumbers;
59+
import org.bukkit.craftbukkit.v1_21_R3.util.CraftNamespacedKey;
60+
import org.bukkit.craftbukkit.v1_21_R3.util.Versioning;
6161
import org.jetbrains.annotations.NotNull;
6262
import org.spigotmc.SpigotWorldConfig;
6363

src/test/java/com/comphenix/protocol/injector/EntityUtilitiesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import net.minecraft.server.level.ServerLevel;
1212
import net.minecraft.world.entity.Entity;
1313
import net.minecraft.world.entity.ai.behavior.EntityTracker;
14-
import org.bukkit.craftbukkit.v1_21_R2.CraftWorld;
15-
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
14+
import org.bukkit.craftbukkit.v1_21_R3.CraftWorld;
15+
import org.bukkit.craftbukkit.v1_21_R3.entity.CraftEntity;
1616
import org.junit.jupiter.api.BeforeAll;
1717
import org.junit.jupiter.api.Test;
1818

src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import net.minecraft.world.level.block.state.BlockState;
1515
import org.bukkit.Material;
1616
import org.bukkit.block.Block;
17-
import org.bukkit.craftbukkit.v1_21_R2.inventory.CraftItemStack;
17+
import org.bukkit.craftbukkit.v1_21_R3.inventory.CraftItemStack;
1818
import org.bukkit.entity.Entity;
1919
import org.bukkit.inventory.ItemStack;
2020
import org.junit.jupiter.api.AfterAll;

src/test/java/com/comphenix/protocol/utility/MinecraftReflectionTestUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
public class MinecraftReflectionTestUtil {
44

5-
public static final String RELEASE_TARGET = "1.20.6";
6-
public static final String PACKAGE_VERSION = "v1_21_R2";
5+
public static final String RELEASE_TARGET = "1.21.4";
6+
public static final String PACKAGE_VERSION = "v1_21_R3";
77
public static final String NMS = "net.minecraft";
88
public static final String OBC = "org.bukkit.craftbukkit." + PACKAGE_VERSION;
99

src/test/java/com/comphenix/protocol/utility/MinecraftVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void testComparison() {
4848

4949
@Test
5050
void testCurrent() {
51-
assertEquals(MinecraftVersion.v1_21_2, MinecraftVersion.getCurrentVersion());
51+
assertEquals(MinecraftVersion.v1_21_4, MinecraftVersion.getCurrentVersion());
5252
}
5353

5454
@Test

0 commit comments

Comments
 (0)