From 53dbc0634289dbc08a2c9e263856746d883a1fb1 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 2 Nov 2024 21:13:31 -0400 Subject: [PATCH] Bump to 1.21.3 + small optimizations --- .../mcprotocollib/protocol/codec/MinecraftCodec.java | 4 ++-- .../mcprotocollib/protocol/codec/MinecraftCodecHelper.java | 2 +- .../data/game/recipe/display/slot/EmptySlotDisplay.java | 2 ++ .../ingame/serverbound/ServerboundClientTickEndPacket.java | 7 +++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java index f9788596..63b782f5 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java @@ -216,7 +216,7 @@ public class MinecraftCodec { public static final PacketCodec CODEC = PacketCodec.builder() .protocolVersion(768) .helper(MinecraftCodecHelper::new) - .minecraftVersion("1.21.2") + .minecraftVersion("1.21.3") .state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder() .registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new) ) @@ -406,7 +406,7 @@ public class MinecraftCodec { .registerServerboundPacket(ServerboundChatSessionUpdatePacket.class, ServerboundChatSessionUpdatePacket::new) .registerServerboundPacket(ServerboundChunkBatchReceivedPacket.class, ServerboundChunkBatchReceivedPacket::new) .registerServerboundPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new) - .registerServerboundPacket(ServerboundClientTickEndPacket.class, ServerboundClientTickEndPacket::new) + .registerServerboundPacket(ServerboundClientTickEndPacket.class, (buf, helper) -> ServerboundClientTickEndPacket.INSTANCE) .registerServerboundPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new) .registerServerboundPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new) .registerServerboundPacket(ServerboundConfigurationAcknowledgedPacket.class, ServerboundConfigurationAcknowledgedPacket::new) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodecHelper.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodecHelper.java index 756b1008..cd42072b 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodecHelper.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodecHelper.java @@ -1099,7 +1099,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper { RecipeSlotType type = RecipeSlotType.from(this.readVarInt(buf)); SlotDisplay display; switch (type) { - case EMPTY -> display = new EmptySlotDisplay(); + case EMPTY -> display = EmptySlotDisplay.INSTANCE; case ANY_FUEL -> display = new AnyFuelSlotDisplay(); case ITEM -> display = new ItemSlotDisplay(this.readVarInt(buf)); case ITEM_STACK -> display = new ItemStackSlotDisplay(this.readItemStack(buf)); diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/recipe/display/slot/EmptySlotDisplay.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/recipe/display/slot/EmptySlotDisplay.java index f7fe8e4e..a037dc23 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/recipe/display/slot/EmptySlotDisplay.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/recipe/display/slot/EmptySlotDisplay.java @@ -1,6 +1,8 @@ package org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot; public record EmptySlotDisplay() implements SlotDisplay { + public static final EmptySlotDisplay INSTANCE = new EmptySlotDisplay(); + @Override public RecipeSlotType getType() { return RecipeSlotType.EMPTY; diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/serverbound/ServerboundClientTickEndPacket.java b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/serverbound/ServerboundClientTickEndPacket.java index 0a1abec1..8b9381ee 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/serverbound/ServerboundClientTickEndPacket.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/serverbound/ServerboundClientTickEndPacket.java @@ -1,17 +1,16 @@ package org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound; import io.netty.buffer.ByteBuf; +import lombok.AccessLevel; import lombok.Data; import lombok.NoArgsConstructor; import org.geysermc.mcprotocollib.protocol.codec.MinecraftCodecHelper; import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket; @Data -@NoArgsConstructor +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class ServerboundClientTickEndPacket implements MinecraftPacket { - - public ServerboundClientTickEndPacket(ByteBuf in, MinecraftCodecHelper helper) { - } + public static final ServerboundClientTickEndPacket INSTANCE = new ServerboundClientTickEndPacket(); @Override public void serialize(ByteBuf out, MinecraftCodecHelper helper) {