From 4dd30b7633aad363755cac68e0320d505699d6c8 Mon Sep 17 00:00:00 2001 From: Alemiz Date: Mon, 6 Nov 2023 18:33:02 +0100 Subject: [PATCH] Start working on MCBE 1.20.50 support --- .../bedrock/codec/v630/Bedrock_v630.java | 70 +++++++++++++++++++ ...ServerPostMovePositionSerializer_v630.java | 19 +++++ ...PlayerInventoryOptionsSerializer_v360.java | 31 ++++++++ .../ShowStoreOfferSerializer_v630.java | 23 ++++++ ...ggleCrafterSlotRequestSerializer_v630.java | 29 ++++++++ .../bedrock/data/DisconnectFailReason.java | 14 +++- .../protocol/bedrock/data/LevelEvent.java | 8 +++ .../protocol/bedrock/data/ParticleType.java | 10 ++- .../protocol/bedrock/data/SoundEvent.java | 28 ++++++++ .../bedrock/data/StoreOfferRedirectType.java | 7 ++ .../data/inventory/ContainerSlotType.java | 6 +- .../bedrock/data/inventory/ContainerType.java | 10 ++- .../data/inventory/InventoryLayout.java | 10 +++ .../data/inventory/InventoryTabLeft.java | 13 ++++ .../data/inventory/InventoryTabRight.java | 10 +++ .../bedrock/packet/BedrockPacketHandler.java | 12 ++++ .../bedrock/packet/BedrockPacketType.java | 5 +- .../bedrock/packet/CraftingEventPacket.java | 4 ++ .../packet/ServerPostMovePositionPacket.java | 24 +++++++ .../SetPlayerInventoryOptionsPacket.java | 30 ++++++++ .../bedrock/packet/ShowStoreOfferPacket.java | 10 +++ .../ToggleCrafterSlotRequestPacket.java | 26 +++++++ 22 files changed, 394 insertions(+), 5 deletions(-) create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/Bedrock_v630.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ServerPostMovePositionSerializer_v630.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/SetPlayerInventoryOptionsSerializer_v360.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ShowStoreOfferSerializer_v630.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ToggleCrafterSlotRequestSerializer_v630.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/StoreOfferRedirectType.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryLayout.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabLeft.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabRight.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ServerPostMovePositionPacket.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/SetPlayerInventoryOptionsPacket.java create mode 100644 bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ToggleCrafterSlotRequestPacket.java diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/Bedrock_v630.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/Bedrock_v630.java new file mode 100644 index 000000000..3909c93fa --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/Bedrock_v630.java @@ -0,0 +1,70 @@ +package org.cloudburstmc.protocol.bedrock.codec.v630; + +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; +import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelEventSerializer_v291; +import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelSoundEvent1Serializer_v291; +import org.cloudburstmc.protocol.bedrock.codec.v313.serializer.LevelSoundEvent2Serializer_v313; +import org.cloudburstmc.protocol.bedrock.codec.v332.serializer.LevelSoundEventSerializer_v332; +import org.cloudburstmc.protocol.bedrock.codec.v361.serializer.LevelEventGenericSerializer_v361; +import org.cloudburstmc.protocol.bedrock.codec.v575.BedrockCodecHelper_v575; +import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622; +import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ServerPostMovePositionSerializer_v630; +import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.SetPlayerInventoryOptionsSerializer_v360; +import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ShowStoreOfferSerializer_v630; +import org.cloudburstmc.protocol.bedrock.codec.v630.serializer.ToggleCrafterSlotRequestSerializer_v630; +import org.cloudburstmc.protocol.bedrock.data.LevelEvent; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.ParticleType; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.packet.*; +import org.cloudburstmc.protocol.common.util.TypeMap; + +public class Bedrock_v630 extends Bedrock_v622 { + + protected static final TypeMap PARTICLE_TYPES = Bedrock_v622.PARTICLE_TYPES + .toBuilder() + .insert(87, ParticleType.DUST_PLUME) + .insert(88, ParticleType.WHITE_SMOKE) + .build(); + + protected static final TypeMap LEVEL_EVENTS = Bedrock_v622.LEVEL_EVENTS.toBuilder() + .insert(LEVEL_EVENT_PARTICLE + 40, LevelEvent.DUST_PLUME) + .replace(LEVEL_EVENT_BLOCK + 109, LevelEvent.PARTICLE_SHOOT_WHITE_SMOKE) + .insert(LEVEL_EVENT_BLOCK + 110, LevelEvent.ALL_PLAYERS_SLEEPING) + .insert(LEVEL_EVENT_PARTICLE_TYPE, PARTICLE_TYPES) + .build(); + + protected static final TypeMap CONTAINER_SLOT_TYPES = Bedrock_v622.CONTAINER_SLOT_TYPES.toBuilder() + .insert(62, ContainerSlotType.CRAFTER_BLOCK_CONTAINER) + .build(); + + protected static final TypeMap SOUND_EVENTS = Bedrock_v622.SOUND_EVENTS + .toBuilder() + .replace(479, SoundEvent.CRAFTER_CRAFT) + .insert(480, SoundEvent.CRAFTER_FAILED) + .insert(481, SoundEvent.DECORATED_POT_INSERT) + .insert(482, SoundEvent.DECORATED_POT_INSERT_FAILED) + .insert(483, SoundEvent.CRAFTER_DISABLE_SLOT) + .insert(490, SoundEvent.COPPER_BULB_ON) + .insert(491, SoundEvent.COPPER_BULB_OFF) + .insert(492, SoundEvent.UNDEFINED) + .build(); + + + public static final BedrockCodec CODEC = Bedrock_v622.CODEC.toBuilder() + .raknetProtocolVersion(11) + .protocolVersion(630) + .minecraftVersion("1.20.50") + .helper(() -> new BedrockCodecHelper_v575(ENTITY_DATA, GAME_RULE_TYPES, ITEM_STACK_REQUEST_TYPES, CONTAINER_SLOT_TYPES, PLAYER_ABILITIES, TEXT_PROCESSING_ORIGINS)) + .updateSerializer(LevelEventPacket.class, new LevelEventSerializer_v291(LEVEL_EVENTS)) + .updateSerializer(LevelEventGenericPacket.class, new LevelEventGenericSerializer_v361(LEVEL_EVENTS)) + .updateSerializer(LevelSoundEvent1Packet.class, new LevelSoundEvent1Serializer_v291(SOUND_EVENTS)) + .updateSerializer(LevelSoundEvent2Packet.class, new LevelSoundEvent2Serializer_v313(SOUND_EVENTS)) + .updateSerializer(LevelSoundEventPacket.class, new LevelSoundEventSerializer_v332(SOUND_EVENTS)) + .updateSerializer(ShowStoreOfferPacket.class, ShowStoreOfferSerializer_v630.INSTANCE) + .registerPacket(ServerPostMovePositionPacket::new, new ServerPostMovePositionSerializer_v630(), 16) + .registerPacket(ToggleCrafterSlotRequestPacket::new, new ToggleCrafterSlotRequestSerializer_v630(), 306) + .registerPacket(SetPlayerInventoryOptionsPacket::new, new SetPlayerInventoryOptionsSerializer_v360(), 307) + .build(); +} \ No newline at end of file diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ServerPostMovePositionSerializer_v630.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ServerPostMovePositionSerializer_v630.java new file mode 100644 index 000000000..55c7e3826 --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ServerPostMovePositionSerializer_v630.java @@ -0,0 +1,19 @@ +package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; + +import io.netty.buffer.ByteBuf; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; +import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; +import org.cloudburstmc.protocol.bedrock.packet.ServerPostMovePositionPacket; + +public class ServerPostMovePositionSerializer_v630 implements BedrockPacketSerializer { + + @Override + public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ServerPostMovePositionPacket packet) { + helper.writeVector3f(buffer, packet.getPosition()); + } + + @Override + public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ServerPostMovePositionPacket packet) { + packet.setPosition(helper.readVector3f(buffer)); + } +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/SetPlayerInventoryOptionsSerializer_v360.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/SetPlayerInventoryOptionsSerializer_v360.java new file mode 100644 index 000000000..2c8bcf91b --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/SetPlayerInventoryOptionsSerializer_v360.java @@ -0,0 +1,31 @@ +package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; + +import io.netty.buffer.ByteBuf; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; +import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryLayout; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabLeft; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabRight; +import org.cloudburstmc.protocol.bedrock.packet.SetPlayerInventoryOptionsPacket; +import org.cloudburstmc.protocol.common.util.VarInts; + +public class SetPlayerInventoryOptionsSerializer_v360 implements BedrockPacketSerializer { + + @Override + public void serialize(ByteBuf buffer, BedrockCodecHelper helper, SetPlayerInventoryOptionsPacket packet) { + VarInts.writeInt(buffer, packet.getLeftTab().ordinal()); + VarInts.writeInt(buffer, packet.getRightTab().ordinal()); + buffer.writeBoolean(packet.isFiltering()); + VarInts.writeInt(buffer, packet.getLayout().ordinal()); + VarInts.writeInt(buffer, packet.getCraftingLayout().ordinal()); + } + + @Override + public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetPlayerInventoryOptionsPacket packet) { + packet.setLeftTab(InventoryTabLeft.VALUES[VarInts.readInt(buffer)]); + packet.setRightTab(InventoryTabRight.VALUES[VarInts.readInt(buffer)]); + packet.setFiltering(buffer.readBoolean()); + packet.setLayout(InventoryLayout.VALUES[VarInts.readInt(buffer)]); + packet.setCraftingLayout(InventoryLayout.VALUES[VarInts.readInt(buffer)]); + } +} \ No newline at end of file diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ShowStoreOfferSerializer_v630.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ShowStoreOfferSerializer_v630.java new file mode 100644 index 000000000..1694926e9 --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ShowStoreOfferSerializer_v630.java @@ -0,0 +1,23 @@ +package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; + +import io.netty.buffer.ByteBuf; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; +import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.ShowStoreOfferSerializer_v291; +import org.cloudburstmc.protocol.bedrock.data.StoreOfferRedirectType; +import org.cloudburstmc.protocol.bedrock.packet.ShowStoreOfferPacket; + +public class ShowStoreOfferSerializer_v630 extends ShowStoreOfferSerializer_v291 { + public static final ShowStoreOfferSerializer_v630 INSTANCE = new ShowStoreOfferSerializer_v630(); + + @Override + public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ShowStoreOfferPacket packet) { + helper.writeString(buffer, packet.getOfferId()); + buffer.writeByte(packet.getRedirectType().ordinal()); + } + + @Override + public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ShowStoreOfferPacket packet) { + packet.setOfferId(helper.readString(buffer)); + packet.setRedirectType(StoreOfferRedirectType.values()[buffer.readUnsignedByte()]); + } +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ToggleCrafterSlotRequestSerializer_v630.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ToggleCrafterSlotRequestSerializer_v630.java new file mode 100644 index 000000000..2fc4794cc --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v630/serializer/ToggleCrafterSlotRequestSerializer_v630.java @@ -0,0 +1,29 @@ +package org.cloudburstmc.protocol.bedrock.codec.v630.serializer; + +import io.netty.buffer.ByteBuf; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; +import org.cloudburstmc.protocol.bedrock.codec.BedrockPacketSerializer; +import org.cloudburstmc.protocol.bedrock.packet.ToggleCrafterSlotRequestPacket; + +public class ToggleCrafterSlotRequestSerializer_v630 implements BedrockPacketSerializer { + + @Override + public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ToggleCrafterSlotRequestPacket packet) { + buffer.writeIntLE(packet.getBlockPosition().getX()); + buffer.writeIntLE(packet.getBlockPosition().getY()); + buffer.writeIntLE(packet.getBlockPosition().getZ()); + buffer.writeByte(packet.getSlot()); + buffer.writeBoolean(packet.isDisabled()); + } + + @Override + public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ToggleCrafterSlotRequestPacket packet) { + int x = buffer.readIntLE(); + int y = buffer.readIntLE(); + int z = buffer.readIntLE(); + packet.setBlockPosition(Vector3i.from(x, y, z)); + packet.setSlot(buffer.readByte()); + packet.setDisabled(buffer.readBoolean()); + } +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/DisconnectFailReason.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/DisconnectFailReason.java index 40b0b80c4..3e81e5ac7 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/DisconnectFailReason.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/DisconnectFailReason.java @@ -91,5 +91,17 @@ public enum DisconnectFailReason { CONN_INACTIVITY_TIMEOUT, STALE_CONNECTION_BEING_REPLACED, REALMS_SESSION_NOT_FOUND, - BAD_PACKET + BAD_PACKET, + CONN_FAILED_TO_CREATE_OFFER, + CONN_FAILED_TO_CREATE_ANSWER, + CONN_FAILED_TO_SET_LOCAL_DESCRIPTION, + CONN_FAILED_TO_SET_REMOTE_DESCRIPTION, + CONN_NEGOTIATION_TIMEOUT_WAITING_FOR_RESPONSE, + CONN_NEGOTIATION_TIMEOUT_WAITING_FOR_ACCEPT, + CONN_INCOMING_CONNECTION_IGNORED, + CONN_SIGNALING_PARSING_FAILURE, + CONN_SIGNALING_UNKNOWN_ERROR, + CONN_SIGNALING_UNICAST_DELIVERY_FAILED, + CONN_SIGNALING_BROADCAST_DELIVERY_FAILED, + CONN_SIGNALING_GENERIC_DELIVERY_FAILED } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/LevelEvent.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/LevelEvent.java index c79de4b28..455d81bfb 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/LevelEvent.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/LevelEvent.java @@ -84,10 +84,18 @@ public enum LevelEvent implements LevelEventType { PARTICLE_BREAK_BLOCK_SOUTH, PARTICLE_BREAK_BLOCK_WEST, PARTICLE_BREAK_BLOCK_EAST, + /** + * @since v630 + */ + PARTICLE_SHOOT_WHITE_SMOKE, SCULK_CATALYST_BLOOM, SCULK_CHARGE, SCULK_CHARGE_POP, SONIC_EXPLOSION, + /** + * @since v630 + */ + DUST_PLUME, // world START_RAINING, diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/ParticleType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/ParticleType.java index 66cff55b5..9a78b76ee 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/ParticleType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/ParticleType.java @@ -93,5 +93,13 @@ public enum ParticleType implements LevelEventType { /** * @since v618 */ - CHERRY_LEAVES + CHERRY_LEAVES, + /** + * @since v630 + */ + DUST_PLUME, + /** + * @since v630 + */ + WHITE_SMOKE } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/SoundEvent.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/SoundEvent.java index 72327242a..3b31a1d0f 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/SoundEvent.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/SoundEvent.java @@ -537,6 +537,34 @@ public enum SoundEvent { * @since v622 */ BOTTLE_EMPTY, + /** + * @since v630 + */ + CRAFTER_CRAFT, + /** + * @since v630 + */ + CRAFTER_FAILED, + /** + * @since v630 + */ + CRAFTER_DISABLE_SLOT, + /** + * @since v630 + */ + DECORATED_POT_INSERT, + /** + * @since v630 + */ + DECORATED_POT_INSERT_FAILED, + /** + * @since v630 + */ + COPPER_BULB_ON, + /** + * @since v630 + */ + COPPER_BULB_OFF, UNDEFINED } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/StoreOfferRedirectType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/StoreOfferRedirectType.java new file mode 100644 index 000000000..b79e4113b --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/StoreOfferRedirectType.java @@ -0,0 +1,7 @@ +package org.cloudburstmc.protocol.bedrock.data; + +public enum StoreOfferRedirectType { + MARKETPLACE, + DRESSING_ROOM, + THIRD_PARTY_SERVER_PAGE +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerSlotType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerSlotType.java index a24017554..1e3a02835 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerSlotType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerSlotType.java @@ -62,5 +62,9 @@ public enum ContainerSlotType { CURSOR, CREATED_OUTPUT, RECIPE_BOOK, - SMITHING_TABLE_TEMPLATE + SMITHING_TABLE_TEMPLATE, + /** + * @since v630 + */ + CRAFTER_BLOCK_CONTAINER } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerType.java index 1690d3649..17faf9e03 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/ContainerType.java @@ -42,7 +42,15 @@ public enum ContainerType { HUD(31), JIGSAW_EDITOR(32), SMITHING_TABLE(33), - CHEST_BOAT(34); + CHEST_BOAT(34), + /** + * @since v630 + */ + DECORATED_POT(35), + /** + * @since v630 + */ + CRAFTER(36); public static final ContainerType[] VALUES; diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryLayout.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryLayout.java new file mode 100644 index 000000000..939a21e0b --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryLayout.java @@ -0,0 +1,10 @@ +package org.cloudburstmc.protocol.bedrock.data.inventory; + +public enum InventoryLayout { + NONE, + SURVIVAL, + RECIPE_BOOK, + CREATIVE; + + public static final InventoryLayout[] VALUES = values(); +} \ No newline at end of file diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabLeft.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabLeft.java new file mode 100644 index 000000000..3cf5a171c --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabLeft.java @@ -0,0 +1,13 @@ +package org.cloudburstmc.protocol.bedrock.data.inventory; + +public enum InventoryTabLeft { + NONE, + RECIPE_CONSTRUCTION, + RECIPE_EQUIPMENT, + RECIPE_ITEMS, + RECIPE_NATURE, + RECIPE_SEARCH, + SURVIVAL; + + public static final InventoryTabLeft[] VALUES = values(); +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabRight.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabRight.java new file mode 100644 index 000000000..9f88914bc --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/InventoryTabRight.java @@ -0,0 +1,10 @@ +package org.cloudburstmc.protocol.bedrock.data.inventory; + +public enum InventoryTabRight { + NONE, + FULL_SCREEN, + CRAFTING, + ARMOR; + + public static final InventoryTabRight[] VALUES = values(); +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketHandler.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketHandler.java index 89ff261f8..b17fb3571 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketHandler.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketHandler.java @@ -823,4 +823,16 @@ default PacketSignal handle(AgentAnimationPacket packet) { default PacketSignal handle(RefreshEntitlementsPacket packet) { return PacketSignal.UNHANDLED; } + + default PacketSignal handle(ServerPostMovePositionPacket packet) { + return PacketSignal.UNHANDLED; + } + + default PacketSignal handle(ToggleCrafterSlotRequestPacket packet) { + return PacketSignal.UNHANDLED; + } + + default PacketSignal handle(SetPlayerInventoryOptionsPacket packet) { + return PacketSignal.UNHANDLED; + } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketType.java index 3f9816cbd..f7e48fcdf 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/BedrockPacketType.java @@ -204,5 +204,8 @@ public enum BedrockPacketType { TRIM_DATA, OPEN_SIGN, AGENT_ANIMATION, - REFRESH_ENTITLEMENTS + REFRESH_ENTITLEMENTS, + SERVER_POST_MOVE_POSITION, + TOGGLE_CRAFTER_SLOT_REQUEST, + SET_PLAYER_INVENTORY_OPTIONS } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/CraftingEventPacket.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/CraftingEventPacket.java index db3472ab6..353516e0f 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/CraftingEventPacket.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/CraftingEventPacket.java @@ -11,6 +11,10 @@ import java.util.List; import java.util.UUID; +/** + * @since since v630 + */ +@Deprecated @Data @EqualsAndHashCode(doNotUseGetters = true) @ToString(doNotUseGetters = true) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ServerPostMovePositionPacket.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ServerPostMovePositionPacket.java new file mode 100644 index 000000000..985f67122 --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ServerPostMovePositionPacket.java @@ -0,0 +1,24 @@ +package org.cloudburstmc.protocol.bedrock.packet; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.common.PacketSignal; + +@Data +@EqualsAndHashCode(doNotUseGetters = true) +@ToString(doNotUseGetters = true) +public class ServerPostMovePositionPacket implements BedrockPacket { + private Vector3f position; + + @Override + public PacketSignal handle(BedrockPacketHandler handler) { + return handler.handle(this); + } + + @Override + public BedrockPacketType getPacketType() { + return BedrockPacketType.SERVER_POST_MOVE_POSITION; + } +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/SetPlayerInventoryOptionsPacket.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/SetPlayerInventoryOptionsPacket.java new file mode 100644 index 000000000..470b3eb66 --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/SetPlayerInventoryOptionsPacket.java @@ -0,0 +1,30 @@ +package org.cloudburstmc.protocol.bedrock.packet; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryLayout; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabLeft; +import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryTabRight; +import org.cloudburstmc.protocol.common.PacketSignal; + +@Data +@EqualsAndHashCode(doNotUseGetters = true) +@ToString(doNotUseGetters = true) +public class SetPlayerInventoryOptionsPacket implements BedrockPacket { + private InventoryTabLeft leftTab; + private InventoryTabRight rightTab; + private boolean filtering; + private InventoryLayout layout; + private InventoryLayout craftingLayout; + + @Override + public PacketSignal handle(BedrockPacketHandler handler) { + return handler.handle(this); + } + + @Override + public BedrockPacketType getPacketType() { + return BedrockPacketType.SET_PLAYER_INVENTORY_OPTIONS; + } +} diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ShowStoreOfferPacket.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ShowStoreOfferPacket.java index bd26193a3..f26c87e87 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ShowStoreOfferPacket.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ShowStoreOfferPacket.java @@ -3,6 +3,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import org.cloudburstmc.protocol.bedrock.data.StoreOfferRedirectType; import org.cloudburstmc.protocol.common.PacketSignal; @Data @@ -10,8 +11,17 @@ @ToString(doNotUseGetters = true) public class ShowStoreOfferPacket implements BedrockPacket { private String offerId; + /** + * @since v630 deprecated + */ + @Deprecated private boolean shownToAll; + /** + * @since v630 + */ + private StoreOfferRedirectType redirectType; + @Override public final PacketSignal handle(BedrockPacketHandler handler) { return handler.handle(this); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ToggleCrafterSlotRequestPacket.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ToggleCrafterSlotRequestPacket.java new file mode 100644 index 000000000..660770d33 --- /dev/null +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/packet/ToggleCrafterSlotRequestPacket.java @@ -0,0 +1,26 @@ +package org.cloudburstmc.protocol.bedrock.packet; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.common.PacketSignal; + +@Data +@EqualsAndHashCode(doNotUseGetters = true) +@ToString(doNotUseGetters = true) +public class ToggleCrafterSlotRequestPacket implements BedrockPacket { + private Vector3i blockPosition; + private byte slot; + private boolean disabled; + + @Override + public PacketSignal handle(BedrockPacketHandler handler) { + return handler.handle(this); + } + + @Override + public BedrockPacketType getPacketType() { + return BedrockPacketType.TOGGLE_CRAFTER_SLOT_REQUEST; + } +}