From 1a1dfa719b8aa7df87fa34d694c13f2754b8ab79 Mon Sep 17 00:00:00 2001 From: Julian Haag Date: Sat, 17 Jun 2023 04:40:42 +0200 Subject: [PATCH] Update a few things --- README.md | 63 +- generator/src/main/kotlin/GenerateCode.kt | 3 + scripts/packet_generate.py | 56 +- scripts/packet_generate_text.py | 2 +- .../io/layercraft/packetlib/codec/Codec.kt | 69 +++ .../packetlib/codec/MinecraftCodec.kt | 87 --- .../packetlib/codec/MinecraftCodecs.kt | 558 ++++++------------ .../{data => codec}/ProtocolVersion.kt | 2 +- .../packetlib/data/entity/Entity.kt | 54 -- .../data/entity/EntityAnimationType.kt | 10 - .../packetlib/data/entity/EntityType.kt | 138 ----- .../packetlib/data/particle/Particles.kt | 95 --- .../io/layercraft/packetlib/packets/Packet.kt | 14 + .../packetlib/packets/PacketInterface.kt | 37 -- .../serverbound/LegacyServerListPingPacket.kt | 29 - .../serverbound/SetProtocolPacket.kt | 41 -- .../login/clientbound/CompressPacket.kt | 29 - .../login/clientbound/DisconnectPacket.kt | 29 - .../clientbound/EncryptionBeginPacket.kt | 37 -- .../clientbound/LoginPluginRequestPacket.kt | 37 -- .../login/clientbound/SuccessPacket.kt | 65 -- .../serverbound/EncryptionBeginPacket.kt | 63 -- .../serverbound/LoginPluginResponsePacket.kt | 37 -- .../login/serverbound/LoginStartPacket.kt | 53 -- .../play/clientbound/AbilitiesPacket.kt | 37 -- .../AcknowledgePlayerDiggingPacket.kt | 29 - .../play/clientbound/ActionBarPacket.kt | 29 - .../play/clientbound/AdvancementsPacket.kt | 159 ----- .../play/clientbound/AnimationPacket.kt | 33 -- .../play/clientbound/AttachEntityPacket.kt | 33 -- .../play/clientbound/BlockActionPacket.kt | 41 -- .../clientbound/BlockBreakAnimationPacket.kt | 37 -- .../play/clientbound/BlockChangePacket.kt | 33 -- .../v1_19_2/play/clientbound/BossBarPacket.kt | 93 --- .../v1_19_2/play/clientbound/CameraPacket.kt | 29 - .../play/clientbound/ChatPreviewPacket.kt | 37 -- .../play/clientbound/ChatSuggestionsPacket.kt | 33 -- .../play/clientbound/ClearTitlesPacket.kt | 29 - .../play/clientbound/CloseWindowPacket.kt | 29 - .../v1_19_2/play/clientbound/CollectPacket.kt | 37 -- .../clientbound/CraftProgressBarPacket.kt | 37 -- .../clientbound/CraftRecipeResponsePacket.kt | 33 -- .../play/clientbound/CustomPayloadPacket.kt | 33 -- .../clientbound/DeathCombatEventPacket.kt | 37 -- .../play/clientbound/DeclareCommandsPacket.kt | 29 - .../play/clientbound/DeclareRecipesPacket.kt | 100 ---- .../play/clientbound/DifficultyPacket.kt | 33 -- .../play/clientbound/EndCombatEventPacket.kt | 33 -- .../clientbound/EnterCombatEventPacket.kt | 24 - .../play/clientbound/EntityDestroyPacket.kt | 29 - .../play/clientbound/EntityEffectPacket.kt | 53 -- .../play/clientbound/EntityEquipmentPacket.kt | 29 - .../clientbound/EntityHeadRotationPacket.kt | 33 -- .../play/clientbound/EntityLookPacket.kt | 41 -- .../play/clientbound/EntityMetadataPacket.kt | 29 - .../play/clientbound/EntityMoveLookPacket.kt | 53 -- .../clientbound/EntitySoundEffectPacket.kt | 49 -- .../play/clientbound/EntityStatusPacket.kt | 33 -- .../play/clientbound/EntityTeleportPacket.kt | 53 -- .../EntityUpdateAttributesPacket.kt | 81 --- .../play/clientbound/EntityVelocityPacket.kt | 41 -- .../play/clientbound/ExperiencePacket.kt | 37 -- .../play/clientbound/ExplosionPacket.kt | 82 --- .../play/clientbound/FacePlayerPacket.kt | 65 -- .../play/clientbound/GameStateChangePacket.kt | 33 -- .../play/clientbound/HeldItemSlotPacket.kt | 29 - .../play/clientbound/HideMessagePacket.kt | 29 - .../InitializeWorldBorderPacket.kt | 57 -- .../play/clientbound/KeepAlivePacket.kt | 29 - .../play/clientbound/KickDisconnectPacket.kt | 29 - .../v1_19_2/play/clientbound/LoginPacket.kt | 102 ---- .../play/clientbound/MapChunkPacket.kt | 74 --- .../v1_19_2/play/clientbound/MapPacket.kt | 77 --- .../play/clientbound/MessageHeaderPacket.kt | 1 - .../clientbound/MultiBlockChangePacket.kt | 37 -- .../clientbound/NamedEntitySpawnPacket.kt | 53 -- .../clientbound/NamedSoundEffectPacket.kt | 57 -- .../clientbound/NbtQueryResponsePacket.kt | 33 -- .../play/clientbound/OpenBookPacket.kt | 29 - .../play/clientbound/OpenHorseWindowPacket.kt | 37 -- .../play/clientbound/OpenSignEntityPacket.kt | 29 - .../play/clientbound/OpenWindowPacket.kt | 37 -- .../v1_19_2/play/clientbound/PingPacket.kt | 29 - .../play/clientbound/PlayerChatPacket.kt | 1 - .../play/clientbound/PlayerInfoPacket.kt | 206 ------- .../clientbound/PlayerlistHeaderPacket.kt | 33 -- .../play/clientbound/PositionPacket.kt | 57 -- .../play/clientbound/RelEntityMovePacket.kt | 45 -- .../clientbound/RemoveEntityEffectPacket.kt | 33 -- .../clientbound/ResourcePackSendPacket.kt | 45 -- .../v1_19_2/play/clientbound/RespawnPacket.kt | 69 --- .../ScoreboardDisplayObjectivePacket.kt | 33 -- .../clientbound/ScoreboardObjectivePacket.kt | 57 -- .../play/clientbound/ScoreboardScorePacket.kt | 46 -- .../clientbound/SelectAdvancementTabPacket.kt | 33 -- .../play/clientbound/ServerDataPacket.kt | 49 -- .../play/clientbound/SetCooldownPacket.kt | 33 -- .../play/clientbound/SetPassengersPacket.kt | 33 -- .../v1_19_2/play/clientbound/SetSlotPacket.kt | 37 -- .../clientbound/SetTitleSubtitlePacket.kt | 29 - .../play/clientbound/SetTitleTextPacket.kt | 29 - .../play/clientbound/SetTitleTimePacket.kt | 37 -- .../ShouldDisplayChatPreviewPacket.kt | 29 - .../clientbound/SimulationDistancePacket.kt | 29 - .../play/clientbound/SoundEffectPacket.kt | 57 -- .../SpawnEntityExperienceOrbPacket.kt | 45 -- .../play/clientbound/SpawnEntityPacket.kt | 77 --- .../play/clientbound/SpawnPositionPacket.kt | 33 -- .../play/clientbound/StatisticsPacket.kt | 52 -- .../play/clientbound/StopSoundPacket.kt | 53 -- .../play/clientbound/SystemChatPacket.kt | 33 -- .../play/clientbound/TabCompletePacket.kt | 65 -- .../v1_19_2/play/clientbound/TagsPacket.kt | 44 -- .../v1_19_2/play/clientbound/TeamsPacket.kt | 131 ---- .../play/clientbound/TileEntityDataPacket.kt | 38 -- .../play/clientbound/TradeListPacket.kt | 90 --- .../play/clientbound/UnloadChunkPacket.kt | 33 -- .../play/clientbound/UnlockRecipesPacket.kt | 75 --- .../play/clientbound/UpdateHealthPacket.kt | 37 -- .../play/clientbound/UpdateLightPacket.kt | 61 -- .../play/clientbound/UpdateTimePacket.kt | 33 -- .../clientbound/UpdateViewDistancePacket.kt | 29 - .../clientbound/UpdateViewPositionPacket.kt | 33 -- .../play/clientbound/VehicleMovePacket.kt | 45 -- .../play/clientbound/WindowItemsPacket.kt | 33 -- .../clientbound/WorldBorderCenterPacket.kt | 33 -- .../clientbound/WorldBorderLerpSizePacket.kt | 37 -- .../play/clientbound/WorldBorderSizePacket.kt | 29 - .../WorldBorderWarningDelayPacket.kt | 29 - .../WorldBorderWarningReachPacket.kt | 29 - .../play/clientbound/WorldEventPacket.kt | 41 -- .../play/clientbound/WorldParticlesPacket.kt | 65 -- .../play/serverbound/AbilitiesPacket.kt | 29 - .../play/serverbound/AdvancementTabPacket.kt | 40 -- .../play/serverbound/ArmAnimationPacket.kt | 29 - .../play/serverbound/BlockDigPacket.kt | 41 -- .../play/serverbound/BlockPlacePacket.kt | 57 -- .../play/serverbound/ChatCommandPacket.kt | 78 --- .../play/serverbound/ChatMessagePacket.kt | 57 -- .../play/serverbound/ChatPreviewPacket.kt | 33 -- .../play/serverbound/ClientCommandPacket.kt | 29 - .../play/serverbound/CloseWindowPacket.kt | 29 - .../serverbound/CraftRecipeRequestPacket.kt | 37 -- .../play/serverbound/CustomPayloadPacket.kt | 33 -- .../play/serverbound/DisplayedRecipePacket.kt | 29 - .../play/serverbound/EditBookPacket.kt | 41 -- .../play/serverbound/EnchantItemPacket.kt | 33 -- .../play/serverbound/EntityActionPacket.kt | 37 -- .../v1_19_2/play/serverbound/FlyingPacket.kt | 29 - .../serverbound/GenerateStructurePacket.kt | 37 -- .../play/serverbound/HeldItemSlotPacket.kt | 29 - .../play/serverbound/KeepAlivePacket.kt | 29 - .../play/serverbound/LockDifficultyPacket.kt | 29 - .../v1_19_2/play/serverbound/LookPacket.kt | 37 -- .../MessageAcknowledgementPacket.kt | 37 -- .../play/serverbound/NameItemPacket.kt | 29 - .../play/serverbound/PickItemPacket.kt | 29 - .../v1_19_2/play/serverbound/PongPacket.kt | 29 - .../play/serverbound/PositionLookPacket.kt | 49 -- .../play/serverbound/PositionPacket.kt | 41 -- .../play/serverbound/QueryBlockNbtPacket.kt | 33 -- .../play/serverbound/QueryEntityNbtPacket.kt | 33 -- .../play/serverbound/RecipeBookPacket.kt | 37 -- .../serverbound/ResourcePackReceivePacket.kt | 29 - .../play/serverbound/SelectTradePacket.kt | 29 - .../play/serverbound/SetBeaconEffectPacket.kt | 41 -- .../play/serverbound/SetCreativeSlotPacket.kt | 29 - .../play/serverbound/SetDifficultyPacket.kt | 29 - .../play/serverbound/SettingsPacket.kt | 57 -- .../play/serverbound/SpectatePacket.kt | 29 - .../play/serverbound/SteerBoatPacket.kt | 33 -- .../play/serverbound/SteerVehiclePacket.kt | 37 -- .../play/serverbound/TabCompletePacket.kt | 33 -- .../play/serverbound/TeleportConfirmPacket.kt | 29 - .../UpdateCommandBlockMinecartPacket.kt | 37 -- .../serverbound/UpdateCommandBlockPacket.kt | 41 -- .../serverbound/UpdateJigsawBlockPacket.kt | 49 -- .../play/serverbound/UpdateSignPacket.kt | 45 -- .../serverbound/UpdateStructureBlockPacket.kt | 89 --- .../play/serverbound/UseEntityPacket.kt | 79 --- .../v1_19_2/play/serverbound/UseItemPacket.kt | 33 -- .../play/serverbound/VehicleMovePacket.kt | 45 -- .../play/serverbound/WindowClickPacket.kt | 65 -- .../v1_19_2/status/clientbound/PingPacket.kt | 29 - .../status/clientbound/ServerInfoPacket.kt | 29 - .../v1_19_2/status/serverbound/PingPacket.kt | 29 - .../status/serverbound/PingStartPacket.kt | 24 - .../serverbound/LegacyServerListPingPacket.kt | 9 +- .../serverbound/SetProtocolPacket.kt | 9 +- .../login/clientbound/CompressPacket.kt | 9 +- .../login/clientbound/DisconnectPacket.kt | 9 +- .../clientbound/EncryptionBeginPacket.kt | 9 +- .../clientbound/LoginPluginRequestPacket.kt | 9 +- .../login/clientbound/SuccessPacket.kt | 11 +- .../serverbound/EncryptionBeginPacket.kt | 9 +- .../serverbound/LoginPluginResponsePacket.kt | 9 +- .../login/serverbound/LoginStartPacket.kt | 9 +- .../play/clientbound/AbilitiesPacket.kt | 9 +- .../AcknowledgePlayerDiggingPacket.kt | 9 +- .../play/clientbound/ActionBarPacket.kt | 9 +- .../play/clientbound/AdvancementsPacket.kt | 17 +- .../play/clientbound/AnimationPacket.kt | 9 +- .../play/clientbound/AttachEntityPacket.kt | 9 +- .../play/clientbound/BlockActionPacket.kt | 9 +- .../clientbound/BlockBreakAnimationPacket.kt | 9 +- .../play/clientbound/BlockChangePacket.kt | 9 +- .../v1_19_3/play/clientbound/BossBarPacket.kt | 9 +- .../v1_19_3/play/clientbound/CameraPacket.kt | 9 +- .../play/clientbound/ChatSuggestionsPacket.kt | 9 +- .../play/clientbound/ClearTitlesPacket.kt | 9 +- .../play/clientbound/CloseWindowPacket.kt | 9 +- .../v1_19_3/play/clientbound/CollectPacket.kt | 9 +- .../clientbound/CraftProgressBarPacket.kt | 9 +- .../clientbound/CraftRecipeResponsePacket.kt | 9 +- .../play/clientbound/CustomPayloadPacket.kt | 9 +- .../clientbound/DeathCombatEventPacket.kt | 9 +- .../play/clientbound/DeclareCommandsPacket.kt | 9 +- .../play/clientbound/DifficultyPacket.kt | 9 +- .../play/clientbound/EndCombatEventPacket.kt | 9 +- .../clientbound/EnterCombatEventPacket.kt | 9 +- .../play/clientbound/EntityDestroyPacket.kt | 9 +- .../play/clientbound/EntityEffectPacket.kt | 9 +- .../play/clientbound/EntityEquipmentPacket.kt | 9 +- .../clientbound/EntityHeadRotationPacket.kt | 9 +- .../play/clientbound/EntityLookPacket.kt | 9 +- .../play/clientbound/EntityMetadataPacket.kt | 9 +- .../play/clientbound/EntityMoveLookPacket.kt | 9 +- .../clientbound/EntitySoundEffectPacket.kt | 9 +- .../play/clientbound/EntityStatusPacket.kt | 9 +- .../play/clientbound/EntityTeleportPacket.kt | 9 +- .../EntityUpdateAttributesPacket.kt | 13 +- .../play/clientbound/EntityVelocityPacket.kt | 9 +- .../play/clientbound/ExperiencePacket.kt | 9 +- .../play/clientbound/ExplosionPacket.kt | 11 +- .../play/clientbound/FacePlayerPacket.kt | 9 +- .../play/clientbound/FeatureFlagsPacket.kt | 9 +- .../play/clientbound/GameStateChangePacket.kt | 9 +- .../play/clientbound/HeldItemSlotPacket.kt | 9 +- .../InitializeWorldBorderPacket.kt | 9 +- .../play/clientbound/KeepAlivePacket.kt | 9 +- .../play/clientbound/KickDisconnectPacket.kt | 9 +- .../v1_19_3/play/clientbound/LoginPacket.kt | 9 +- .../play/clientbound/MapChunkPacket.kt | 9 +- .../v1_19_3/play/clientbound/MapPacket.kt | 9 +- .../clientbound/MultiBlockChangePacket.kt | 9 +- .../clientbound/NamedEntitySpawnPacket.kt | 9 +- .../clientbound/NbtQueryResponsePacket.kt | 9 +- .../play/clientbound/OpenBookPacket.kt | 9 +- .../play/clientbound/OpenHorseWindowPacket.kt | 9 +- .../play/clientbound/OpenSignEntityPacket.kt | 9 +- .../play/clientbound/OpenWindowPacket.kt | 9 +- .../v1_19_3/play/clientbound/PingPacket.kt | 9 +- .../play/clientbound/PlayerRemovePacket.kt | 9 +- .../clientbound/PlayerlistHeaderPacket.kt | 9 +- .../play/clientbound/PositionPacket.kt | 9 +- .../play/clientbound/ProfilelessChatPacket.kt | 9 +- .../play/clientbound/RelEntityMovePacket.kt | 9 +- .../clientbound/RemoveEntityEffectPacket.kt | 9 +- .../clientbound/ResourcePackSendPacket.kt | 9 +- .../v1_19_3/play/clientbound/RespawnPacket.kt | 9 +- .../ScoreboardDisplayObjectivePacket.kt | 9 +- .../clientbound/ScoreboardObjectivePacket.kt | 9 +- .../play/clientbound/ScoreboardScorePacket.kt | 9 +- .../clientbound/SelectAdvancementTabPacket.kt | 9 +- .../play/clientbound/ServerDataPacket.kt | 9 +- .../play/clientbound/SetCooldownPacket.kt | 9 +- .../play/clientbound/SetPassengersPacket.kt | 9 +- .../v1_19_3/play/clientbound/SetSlotPacket.kt | 9 +- .../clientbound/SetTitleSubtitlePacket.kt | 9 +- .../play/clientbound/SetTitleTextPacket.kt | 9 +- .../play/clientbound/SetTitleTimePacket.kt | 9 +- .../clientbound/SimulationDistancePacket.kt | 9 +- .../play/clientbound/SoundEffectPacket.kt | 9 +- .../SpawnEntityExperienceOrbPacket.kt | 9 +- .../play/clientbound/SpawnEntityPacket.kt | 9 +- .../play/clientbound/SpawnPositionPacket.kt | 9 +- .../play/clientbound/StatisticsPacket.kt | 11 +- .../play/clientbound/StopSoundPacket.kt | 9 +- .../play/clientbound/SystemChatPacket.kt | 9 +- .../play/clientbound/TabCompletePacket.kt | 11 +- .../v1_19_3/play/clientbound/TagsPacket.kt | 11 +- .../v1_19_3/play/clientbound/TeamsPacket.kt | 9 +- .../play/clientbound/TileEntityDataPacket.kt | 9 +- .../play/clientbound/TradeListPacket.kt | 11 +- .../play/clientbound/UnloadChunkPacket.kt | 9 +- .../play/clientbound/UnlockRecipesPacket.kt | 9 +- .../play/clientbound/UpdateHealthPacket.kt | 9 +- .../play/clientbound/UpdateLightPacket.kt | 9 +- .../play/clientbound/UpdateTimePacket.kt | 9 +- .../clientbound/UpdateViewDistancePacket.kt | 9 +- .../clientbound/UpdateViewPositionPacket.kt | 9 +- .../play/clientbound/VehicleMovePacket.kt | 9 +- .../play/clientbound/WindowItemsPacket.kt | 9 +- .../clientbound/WorldBorderCenterPacket.kt | 9 +- .../clientbound/WorldBorderLerpSizePacket.kt | 9 +- .../play/clientbound/WorldBorderSizePacket.kt | 9 +- .../WorldBorderWarningDelayPacket.kt | 9 +- .../WorldBorderWarningReachPacket.kt | 9 +- .../play/clientbound/WorldEventPacket.kt | 9 +- .../play/clientbound/WorldParticlesPacket.kt | 9 +- .../play/serverbound/AbilitiesPacket.kt | 9 +- .../play/serverbound/AdvancementTabPacket.kt | 9 +- .../play/serverbound/ArmAnimationPacket.kt | 9 +- .../play/serverbound/BlockDigPacket.kt | 9 +- .../play/serverbound/BlockPlacePacket.kt | 9 +- .../serverbound/ChatSessionUpdatePacket.kt | 9 +- .../play/serverbound/ClientCommandPacket.kt | 9 +- .../play/serverbound/CloseWindowPacket.kt | 9 +- .../serverbound/CraftRecipeRequestPacket.kt | 9 +- .../play/serverbound/CustomPayloadPacket.kt | 9 +- .../play/serverbound/DisplayedRecipePacket.kt | 9 +- .../play/serverbound/EditBookPacket.kt | 9 +- .../play/serverbound/EnchantItemPacket.kt | 9 +- .../play/serverbound/EntityActionPacket.kt | 9 +- .../v1_19_3/play/serverbound/FlyingPacket.kt | 9 +- .../serverbound/GenerateStructurePacket.kt | 9 +- .../play/serverbound/HeldItemSlotPacket.kt | 9 +- .../play/serverbound/KeepAlivePacket.kt | 9 +- .../play/serverbound/LockDifficultyPacket.kt | 9 +- .../v1_19_3/play/serverbound/LookPacket.kt | 9 +- .../MessageAcknowledgementPacket.kt | 9 +- .../play/serverbound/NameItemPacket.kt | 9 +- .../play/serverbound/PickItemPacket.kt | 9 +- .../v1_19_3/play/serverbound/PongPacket.kt | 9 +- .../play/serverbound/PositionLookPacket.kt | 9 +- .../play/serverbound/PositionPacket.kt | 9 +- .../play/serverbound/QueryBlockNbtPacket.kt | 9 +- .../play/serverbound/QueryEntityNbtPacket.kt | 9 +- .../play/serverbound/RecipeBookPacket.kt | 9 +- .../serverbound/ResourcePackReceivePacket.kt | 9 +- .../play/serverbound/SelectTradePacket.kt | 9 +- .../v1_19_3/play/serverbound/SessionPacket.kt | 41 -- .../play/serverbound/SetBeaconEffectPacket.kt | 9 +- .../play/serverbound/SetCreativeSlotPacket.kt | 9 +- .../play/serverbound/SetDifficultyPacket.kt | 9 +- .../play/serverbound/SettingsPacket.kt | 9 +- .../play/serverbound/SpectatePacket.kt | 9 +- .../play/serverbound/SteerBoatPacket.kt | 9 +- .../play/serverbound/SteerVehiclePacket.kt | 9 +- .../play/serverbound/TabCompletePacket.kt | 9 +- .../play/serverbound/TeleportConfirmPacket.kt | 9 +- .../UpdateCommandBlockMinecartPacket.kt | 9 +- .../serverbound/UpdateCommandBlockPacket.kt | 9 +- .../serverbound/UpdateJigsawBlockPacket.kt | 9 +- .../play/serverbound/UpdateSignPacket.kt | 9 +- .../serverbound/UpdateStructureBlockPacket.kt | 9 +- .../play/serverbound/UseEntityPacket.kt | 9 +- .../v1_19_3/play/serverbound/UseItemPacket.kt | 9 +- .../play/serverbound/VehicleMovePacket.kt | 9 +- .../play/serverbound/WindowClickPacket.kt | 11 +- .../v1_19_3/status/clientbound/PingPacket.kt | 9 +- .../status/clientbound/ServerInfoPacket.kt | 9 +- .../v1_19_3/status/serverbound/PingPacket.kt | 9 +- .../status/serverbound/PingStartPacket.kt | 9 +- ...Interface.kt => MCProtocolDeserializer.kt} | 11 +- ...zeInterface.kt => MCProtocolSerializer.kt} | 13 +- .../packetlib/types/ChunkBlockEntity.kt | 8 +- .../{utils => types}/VarNumbersUtils.kt | 14 +- .../{utils => types}/VarStringUtils.kt | 10 +- .../MinecraftByteBufferDeserialize.kt | 39 -- .../MinecraftByteBufferSerialize.kt | 46 -- .../stream/MinecraftInputStreamDeserialize.kt | 32 - .../stream/MinecraftOutputStreamSerialize.kt | 26 - .../layercraft/packetlib/MinecraftByteTest.kt | 2 - .../io/layercraft/packetlib/PacketIdCheck.kt | 55 +- .../packetlib/PacketLibTestHelper.kt | 107 ++++ .../layercraft/packetlib/SerializationTest.kt | 30 +- .../io/layercraft/packetlib/TranslatorAPI.kt | 30 - .../utils/MinecraftNumberUtilsTest.kt | 4 +- 369 files changed, 1138 insertions(+), 9475 deletions(-) create mode 100644 generator/src/main/kotlin/GenerateCode.kt create mode 100644 src/main/kotlin/io/layercraft/packetlib/codec/Codec.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodec.kt rename src/main/kotlin/io/layercraft/packetlib/{data => codec}/ProtocolVersion.kt (97%) delete mode 100644 src/main/kotlin/io/layercraft/packetlib/data/entity/Entity.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/data/entity/EntityAnimationType.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/data/entity/EntityType.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/data/particle/Particles.kt create mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/Packet.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/PacketInterface.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/LegacyServerListPingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/SetProtocolPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/CompressPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/DisconnectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/EncryptionBeginPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/LoginPluginRequestPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/SuccessPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/EncryptionBeginPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginPluginResponsePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginStartPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AbilitiesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AcknowledgePlayerDiggingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ActionBarPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AdvancementsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AnimationPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AttachEntityPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockActionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockBreakAnimationPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockChangePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BossBarPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CameraPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatPreviewPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatSuggestionsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ClearTitlesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CloseWindowPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CollectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftProgressBarPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftRecipeResponsePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CustomPayloadPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeathCombatEventPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareCommandsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareRecipesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DifficultyPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EndCombatEventPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EnterCombatEventPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityDestroyPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEquipmentPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityHeadRotationPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityLookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMetadataPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMoveLookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntitySoundEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityStatusPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityTeleportPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityUpdateAttributesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityVelocityPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExperiencePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExplosionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/FacePlayerPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/GameStateChangePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HeldItemSlotPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HideMessagePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/InitializeWorldBorderPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KeepAlivePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KickDisconnectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/LoginPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapChunkPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MessageHeaderPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MultiBlockChangePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedEntitySpawnPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedSoundEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NbtQueryResponsePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenBookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenHorseWindowPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenSignEntityPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenWindowPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerChatPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerInfoPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerlistHeaderPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PositionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RelEntityMovePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RemoveEntityEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ResourcePackSendPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RespawnPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardDisplayObjectivePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardObjectivePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardScorePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SelectAdvancementTabPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ServerDataPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetCooldownPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetPassengersPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetSlotPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleSubtitlePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTextPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTimePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ShouldDisplayChatPreviewPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SimulationDistancePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SoundEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityExperienceOrbPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnPositionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StatisticsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StopSoundPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SystemChatPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TabCompletePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TagsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TeamsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TileEntityDataPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TradeListPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnloadChunkPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnlockRecipesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateHealthPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateLightPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateTimePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewDistancePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewPositionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/VehicleMovePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WindowItemsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderCenterPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderLerpSizePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderSizePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningDelayPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningReachPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldEventPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldParticlesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AbilitiesPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AdvancementTabPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ArmAnimationPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockDigPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockPlacePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatCommandPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatMessagePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatPreviewPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ClientCommandPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CloseWindowPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CraftRecipeRequestPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CustomPayloadPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/DisplayedRecipePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EditBookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EnchantItemPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EntityActionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/FlyingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/GenerateStructurePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/HeldItemSlotPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/KeepAlivePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LockDifficultyPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/MessageAcknowledgementPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/NameItemPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PickItemPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PongPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionLookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryBlockNbtPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryEntityNbtPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/RecipeBookPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ResourcePackReceivePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SelectTradePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetBeaconEffectPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetCreativeSlotPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetDifficultyPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SettingsPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SpectatePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerBoatPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerVehiclePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TabCompletePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TeleportConfirmPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockMinecartPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateJigsawBlockPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateSignPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateStructureBlockPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseEntityPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseItemPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/VehicleMovePacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/WindowClickPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/PingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/ServerInfoPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingStartPacket.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SessionPacket.kt rename src/main/kotlin/io/layercraft/packetlib/serialization/{MinecraftProtocolDeserializeInterface.kt => MCProtocolDeserializer.kt} (81%) rename src/main/kotlin/io/layercraft/packetlib/serialization/{MinecraftProtocolSerializeInterface.kt => MCProtocolSerializer.kt} (82%) rename src/main/kotlin/io/layercraft/packetlib/{utils => types}/VarNumbersUtils.kt (83%) rename src/main/kotlin/io/layercraft/packetlib/{utils => types}/VarStringUtils.kt (81%) delete mode 100644 src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferDeserialize.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferSerialize.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftInputStreamDeserialize.kt delete mode 100644 src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftOutputStreamSerialize.kt create mode 100644 src/test/kotlin/io/layercraft/packetlib/PacketLibTestHelper.kt delete mode 100644 src/test/kotlin/io/layercraft/packetlib/TranslatorAPI.kt diff --git a/README.md b/README.md index 1b91b57..41686ed 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ KDocs: [PacketLib KDocs](https://packetlib.kdocs.layercraft.io/) Type Safe generated Minecraft Protocol Packets in Kotlin. -For current versions: 1.19.2, 1.19.3 & 1.19.4. +For current versions: 1.19.3(also 1.19.4). But some complex Packets are not implemented yet. ### Prewords @@ -168,62 +168,7 @@ Settings.xml ## Serialization Implementations -### Included Implementations -- [ByteBuffer (Java)](https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html) -> MinecraftByteBufferSerialize / MinecraftByteBufferDeserialize -- [InputStream (Java)](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html) -> MinecraftInputStreamSerialize / MinecraftInputStreamDeserialize +There are no more default implementations for serialization in this library, so you have to write your own. +But here are some old example implementations: https://gist.github.com/Newspicel/54184b844dee00a4f351e58de033e071 -### Write your own -To write your own implementation, you need to implement the following interfaces: -- MinecraftProtocolSerializeInterface -- MinecraftProtocolDeserializeInterface - -So you can use your implementation with the MinecraftCodec. e.g.: Netty, Okio, ... - -### Example Implementation - -```kotlin -object TranslatorAPI { - - fun decodeFromByteArray(bytes: ByteArray, serializer: PacketSerializer): T { - val byteBuffer = ByteBuffer.wrap(bytes) - val deserialize = MinecraftByteBufferDeserialize(byteBuffer) - - return serializer.deserialize(deserialize) - } - - fun encodeToByteArray(value: T, serializer: PacketSerializer): ByteArray { - val byteBuffer = ByteBuffer.allocate(MAX_PACKET_SIZE) - val serialize = MinecraftByteBufferSerialize(byteBuffer) - - serializer.serialize(serialize, value) - - val size = byteBuffer.position() - val byteArray = ByteArray(size) - byteBuffer.get(0, byteArray, 0, size) - - return byteArray - } - - fun decodeFromInputWithCodec(codec: MinecraftCodec, input: MinecraftProtocolDeserializeInterface<*>, packetDirection: PacketDirection, packetState: PacketState, packetId: Int): Packet? { - return codec.getCodecPacket(packetDirection, packetState, packetId)?.packetSerializer?.deserialize(input) - } - - fun encodeToOutputWithCodec(codec: MinecraftCodec, output: MinecraftProtocolSerializeInterface<*>, value: Packet) { - codec.getCodecPacketFromPacket(value)?.packetSerializer?.serialize(output, value) - } -} -``` - -Serialize a packet to a byte array: - -```kotlin -val packet = SetProtocolPacket(ProtocolVersion.V1_19_2.protocolNumber, "localhost", 25565, 1) - -val bytes = TranslatorAPI.encodeToByteArray(packet, SetProtocolPacket) -``` - -Deserialize a packet from a byte array: - -```kotlin -val packet = TranslatorAPI.decodeFromByteArray(bytes, SetProtocolPacket) -``` +So you need to implement the `MCProtocolSerializer` interface and the `MCProtocolDeserializer` interface. Then just get your Packet over the `MinecraftCodecs` and serialize it. \ No newline at end of file diff --git a/generator/src/main/kotlin/GenerateCode.kt b/generator/src/main/kotlin/GenerateCode.kt new file mode 100644 index 0000000..e0f2756 --- /dev/null +++ b/generator/src/main/kotlin/GenerateCode.kt @@ -0,0 +1,3 @@ +fun main() { + println("Hello, World!") +} \ No newline at end of file diff --git a/scripts/packet_generate.py b/scripts/packet_generate.py index f9f3db9..0688251 100644 --- a/scripts/packet_generate.py +++ b/scripts/packet_generate.py @@ -24,7 +24,8 @@ } src = "src/main/kotlin" -version = input("Version: ") +# First Argument: Version +version = "custom" if len(os.sys.argv) < 2 else os.sys.argv[1] data_url = versions[version][0] wikivg_url_end = "&oldid=" + versions[version][1] @@ -47,10 +48,9 @@ def codec_generate(): package_string = packet["package"] status = packet["status"] id = packet["id"] + direction_string = "clientBound" if packet["direction"] == "clientbound" else "serverBound" - direction_string = "registerClientBoundPacket" if packet[ - "direction"] == "clientbound" else "registerServerBoundPacket" - add_text = f""" .{direction_string}({id}, {package_string}.{class_name}::class, {package_string}.{class_name}) \n""" + add_text = f""" {direction_string}({id}, {package_string}.{class_name}::class, {package_string}.{class_name}) \n""" if status == "handshaking": handshaking_text += add_text @@ -61,25 +61,30 @@ def codec_generate(): elif status == "play": play_text += add_text + handshaking_text = handshaking_text[:-1] + login_text = login_text[:-1] + status_text = status_text[:-1] + play_text = play_text[:-1] + text = f""" val V{version_underline}: MinecraftCodec = - MinecraftCodec.create(ProtocolVersion.V{version_underline}) - .registerPacketRegistry( - PacketState.HANDSHAKING, - MinecraftCodecRegistry.create() -{handshaking_text}) - .registerPacketRegistry( - PacketState.LOGIN, - MinecraftCodecRegistry.create() -{login_text}) - .registerPacketRegistry( - PacketState.STATUS, - MinecraftCodecRegistry.create() -{status_text}) - .registerPacketRegistry( - PacketState.PLAY, - MinecraftCodecRegistry.create() -{play_text}) + codec(ProtocolVersion.V{version_underline}) {{ + packets(PacketState.HANDSHAKING) {{ +{handshaking_text} + }} + + packets(PacketState.LOGIN) {{ +{login_text} + }} + + packets(PacketState.STATUS) {{ +{status_text} + }} + + packets(PacketState.PLAY) {{ +{play_text} + }} + }} """ # write to codec.kt.tmp file @@ -276,8 +281,8 @@ def generate(self) -> str: class_str = f"""package {self.package} import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer {class_other_imports_str} /** * {wikivg_name} | {id} | {status} | {direction} @@ -286,18 +291,17 @@ def generate(self) -> str: * @see https://wiki.vg/Protocol#{wikivg_id} */ -@MinecraftPacket(id = {id}, state = PacketState.{status.upper()}, direction = PacketDirection.{direction.upper()}) {"data" if len(class_fields_str) > 1 else ""} class {class_name}( {class_fields_str} ) : {direction_interface} {{ companion object : PacketSerializer<{class_name}> {{ - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): {class_name} {{ + override fun deserialize(input: MCProtocolDeserializer<*>): {class_name} {{ {class_deserialize_str} return {class_name}({class_var_list_str}) }} - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: {class_name}) {{ + override fun serialize(output: MCProtocolSerializer<*>, value: {class_name}) {{ {class_serialize_str} }} }} diff --git a/scripts/packet_generate_text.py b/scripts/packet_generate_text.py index 89a3596..9c34098 100644 --- a/scripts/packet_generate_text.py +++ b/scripts/packet_generate_text.py @@ -418,7 +418,7 @@ def generate_extra_class_deserializer(self, field_name: str, info_deserialize_va class_deserialize_str = f"""val {field_name} = {info_deserialize_var_name}.readVarIntArray {{ arrayInput{round_str} -> {extra_class_deserialize_str} - return@readVarIntArray {class_name}({extra_class_fields_str}) + {class_name}({extra_class_fields_str}) }}""" return class_deserialize_str diff --git a/src/main/kotlin/io/layercraft/packetlib/codec/Codec.kt b/src/main/kotlin/io/layercraft/packetlib/codec/Codec.kt new file mode 100644 index 0000000..26e354d --- /dev/null +++ b/src/main/kotlin/io/layercraft/packetlib/codec/Codec.kt @@ -0,0 +1,69 @@ +package io.layercraft.packetlib.codec + +import io.layercraft.packetlib.packets.ClientBoundPacket +import io.layercraft.packetlib.packets.Packet +import io.layercraft.packetlib.packets.PacketSerializer +import io.layercraft.packetlib.packets.ServerBoundPacket +import java.util.* +import kotlin.reflect.KClass + +class Codec internal constructor( + val protocolVersion: ProtocolVersion, + internal val packets: EnumMap = EnumMap(PacketState::class.java), +) { + + private val list: List> by lazy { + packets.values.flatMap { it.clientPacketMap.values }.toList() + packets.values.flatMap { it.serverPacketMap.values }.toList() + } + + fun getCodecPacket(packetDirection: PacketDirection, packetState: PacketState, packetId: Int): CodecPacket<*>? { + return when (packetDirection) { + PacketDirection.CLIENTBOUND -> packets[packetState]?.serverPacketMap?.get(packetId) + PacketDirection.SERVERBOUND -> packets[packetState]?.clientPacketMap?.get(packetId) + } + } + + @Suppress("UNCHECKED_CAST") + fun getCodecPacketFromPacket(packet: T): CodecPacket? { + return list.find { it.packet == packet::class } as CodecPacket? + } + + fun packets(state: PacketState, registry: CodecRegistry.() -> Unit) { + packets[state] = CodecRegistry().apply(registry) + } +} + +class CodecRegistry internal constructor( + val clientPacketMap: HashMap> = HashMap(), + val serverPacketMap: HashMap> = HashMap(), +) { + fun clientBound(packetId: Int, packet: KClass, packetSerializer: PacketSerializer) { + serverPacketMap[packetId] = CodecPacket(packetId, packet, packetSerializer) + } + + fun serverBound(packetId: Int, packet: KClass, packetSerializer: PacketSerializer) { + clientPacketMap[packetId] = CodecPacket(packetId, packet, packetSerializer) + } +} + +fun codec(protocolVersion: ProtocolVersion, init: Codec.() -> Unit): Codec { + return Codec(protocolVersion).apply(init) +} + +fun codecCopy(protocolVersion: ProtocolVersion, codec: Codec): Codec { + return Codec(protocolVersion, codec.packets.clone()) +} + +data class CodecPacket internal constructor( + val packetId: Int, + val packet: KClass, + val packetSerializer: PacketSerializer, +) + +enum class PacketDirection { + SERVERBOUND, CLIENTBOUND, +} + +enum class PacketState { + HANDSHAKING, STATUS, LOGIN, PLAY, +} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodec.kt b/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodec.kt deleted file mode 100644 index 92543e2..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodec.kt +++ /dev/null @@ -1,87 +0,0 @@ -package io.layercraft.packetlib.codec - -import io.layercraft.packetlib.data.ProtocolVersion -import io.layercraft.packetlib.packets.* -import java.util.* -import kotlin.reflect.KClass -class MinecraftCodec private constructor( - val protocolVersion: ProtocolVersion, - val packets: EnumMap = EnumMap(PacketState::class.java), -) { - val protocolVersionAsInt: Int - get() = protocolVersion.v - - val protocolVersionAsString: String - get() = protocolVersion.name - - private val list: List> - get() = packets.values.flatMap { it.clientPacketMap.values }.toList() + packets.values.flatMap { it.serverPacketMap.values }.toList() - - fun registerPacketRegistry(state: PacketState, registry: MinecraftCodecRegistry) = apply { - packets[state] = registry - } - - fun getClientBoundCodecPacket(packetState: PacketState, packetId: Int): MinecraftServerCodecPacket<*>? { - return packets[packetState]?.serverPacketMap?.get(packetId) - } - - fun getServerBoundCodecPacket(packetState: PacketState, packetId: Int): MinecraftClientCodecPacket<*>? { - return packets[packetState]?.clientPacketMap?.get(packetId) - } - - fun getCodecPacket(packetDirection: PacketDirection, packetState: PacketState, packetId: Int): MinecraftCodecPacket<*>? { - return when (packetDirection) { - PacketDirection.CLIENTBOUND -> getClientBoundCodecPacket(packetState, packetId) - PacketDirection.SERVERBOUND -> getServerBoundCodecPacket(packetState, packetId) - } - } - - fun getCodecPacketFromPacket(packet: T): MinecraftCodecPacket? { - return list.find { it.packet == packet::class } as MinecraftCodecPacket? - } - - fun copy(protocolVersion: ProtocolVersion): MinecraftCodec { - return MinecraftCodec(protocolVersion, packets) - } - - companion object { - fun create(protocolVersion: ProtocolVersion): MinecraftCodec = MinecraftCodec(protocolVersion) - } -} - -class MinecraftCodecRegistry private constructor( - val clientPacketMap: HashMap> = HashMap(), - val serverPacketMap: HashMap> = HashMap(), -) { - fun registerClientBoundPacket(packetId: Int, packet: KClass, packetSerializer: PacketSerializer) = - apply { - serverPacketMap[packetId] = MinecraftServerCodecPacket(packetId, packet, packetSerializer) - } - - fun registerServerBoundPacket(packetId: Int, packet: KClass, packetSerializer: PacketSerializer) = - apply { - clientPacketMap[packetId] = MinecraftClientCodecPacket(packetId, packet, packetSerializer) - } - - companion object { - fun create(): MinecraftCodecRegistry = MinecraftCodecRegistry() - } -} - -interface MinecraftCodecPacket { - val packetId: Int - val packet: KClass - val packetSerializer: PacketSerializer -} - -data class MinecraftServerCodecPacket( - override val packetId: Int, - override val packet: KClass, - override val packetSerializer: PacketSerializer, -) : MinecraftCodecPacket - -data class MinecraftClientCodecPacket( - override val packetId: Int, - override val packet: KClass, - override val packetSerializer: PacketSerializer, -) : MinecraftCodecPacket \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodecs.kt b/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodecs.kt index 15c4f6b..af133d5 100644 --- a/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodecs.kt +++ b/src/main/kotlin/io/layercraft/packetlib/codec/MinecraftCodecs.kt @@ -2,384 +2,188 @@ package io.layercraft.packetlib.codec -import io.layercraft.packetlib.data.ProtocolVersion -import io.layercraft.packetlib.packets.PacketState - object MinecraftCodecs { - val V1_19_2: MinecraftCodec = - MinecraftCodec.create(ProtocolVersion.V1_19_2) - .registerPacketRegistry( - PacketState.HANDSHAKING, - MinecraftCodecRegistry.create() - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound.SetProtocolPacket::class, io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound.SetProtocolPacket) - .registerServerBoundPacket(0xfe, io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound.LegacyServerListPingPacket::class, io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound.LegacyServerListPingPacket), - ) - .registerPacketRegistry( - PacketState.LOGIN, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.DisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.DisconnectPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.EncryptionBeginPacket) - .registerClientBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.SuccessPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.SuccessPacket) - .registerClientBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.CompressPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.CompressPacket) - .registerClientBoundPacket(0x04, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.LoginPluginRequestPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.clientbound.LoginPluginRequestPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.LoginStartPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.LoginStartPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.EncryptionBeginPacket) - .registerServerBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.LoginPluginResponsePacket::class, io.layercraft.packetlib.packets.v1_19_2.login.serverbound.LoginPluginResponsePacket), - ) - .registerPacketRegistry( - PacketState.STATUS, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.status.clientbound.ServerInfoPacket::class, io.layercraft.packetlib.packets.v1_19_2.status.clientbound.ServerInfoPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.status.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_2.status.clientbound.PingPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.status.serverbound.PingStartPacket::class, io.layercraft.packetlib.packets.v1_19_2.status.serverbound.PingStartPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.status.serverbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_2.status.serverbound.PingPacket), - ) - .registerPacketRegistry( - PacketState.PLAY, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnEntityPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnEntityPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnEntityExperienceOrbPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnEntityExperienceOrbPacket) - .registerClientBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NamedEntitySpawnPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NamedEntitySpawnPacket) - .registerClientBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AnimationPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AnimationPacket) - .registerClientBoundPacket(0x04, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.StatisticsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.StatisticsPacket) - .registerClientBoundPacket(0x05, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AcknowledgePlayerDiggingPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AcknowledgePlayerDiggingPacket) - .registerClientBoundPacket(0x06, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockBreakAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockBreakAnimationPacket) - .registerClientBoundPacket(0x07, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TileEntityDataPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TileEntityDataPacket) - .registerClientBoundPacket(0x08, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockActionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockActionPacket) - .registerClientBoundPacket(0x09, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BlockChangePacket) - .registerClientBoundPacket(0x0a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BossBarPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.BossBarPacket) - .registerClientBoundPacket(0x0b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DifficultyPacket) - .registerClientBoundPacket(0x0c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ChatPreviewPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ChatPreviewPacket) - .registerClientBoundPacket(0x0d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ClearTitlesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ClearTitlesPacket) - .registerClientBoundPacket(0x0e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TabCompletePacket) - .registerClientBoundPacket(0x0f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeclareCommandsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeclareCommandsPacket) - .registerClientBoundPacket(0x10, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CloseWindowPacket) - .registerClientBoundPacket(0x11, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WindowItemsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WindowItemsPacket) - .registerClientBoundPacket(0x12, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CraftProgressBarPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CraftProgressBarPacket) - .registerClientBoundPacket(0x13, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetSlotPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetSlotPacket) - .registerClientBoundPacket(0x14, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetCooldownPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetCooldownPacket) - .registerClientBoundPacket(0x15, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ChatSuggestionsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ChatSuggestionsPacket) - .registerClientBoundPacket(0x16, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CustomPayloadPacket) - .registerClientBoundPacket(0x17, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NamedSoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NamedSoundEffectPacket) - .registerClientBoundPacket(0x18, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.HideMessagePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.HideMessagePacket) - .registerClientBoundPacket(0x19, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.KickDisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.KickDisconnectPacket) - .registerClientBoundPacket(0x1a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityStatusPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityStatusPacket) - .registerClientBoundPacket(0x1b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ExplosionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ExplosionPacket) - .registerClientBoundPacket(0x1c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UnloadChunkPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UnloadChunkPacket) - .registerClientBoundPacket(0x1d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.GameStateChangePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.GameStateChangePacket) - .registerClientBoundPacket(0x1e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenHorseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenHorseWindowPacket) - .registerClientBoundPacket(0x1f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.InitializeWorldBorderPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.InitializeWorldBorderPacket) - .registerClientBoundPacket(0x20, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.KeepAlivePacket) - .registerClientBoundPacket(0x21, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MapChunkPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MapChunkPacket) - .registerClientBoundPacket(0x22, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldEventPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldEventPacket) - .registerClientBoundPacket(0x23, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldParticlesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldParticlesPacket) - .registerClientBoundPacket(0x24, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateLightPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateLightPacket) - .registerClientBoundPacket(0x25, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.LoginPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.LoginPacket) - .registerClientBoundPacket(0x26, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MapPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MapPacket) - .registerClientBoundPacket(0x27, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TradeListPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TradeListPacket) - .registerClientBoundPacket(0x28, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RelEntityMovePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RelEntityMovePacket) - .registerClientBoundPacket(0x29, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityMoveLookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityMoveLookPacket) - .registerClientBoundPacket(0x2a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityLookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityLookPacket) - .registerClientBoundPacket(0x2b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.VehicleMovePacket) - .registerClientBoundPacket(0x2c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenBookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenBookPacket) - .registerClientBoundPacket(0x2d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenWindowPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenWindowPacket) - .registerClientBoundPacket(0x2e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenSignEntityPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.OpenSignEntityPacket) - .registerClientBoundPacket(0x2f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PingPacket) - .registerClientBoundPacket(0x30, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CraftRecipeResponsePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CraftRecipeResponsePacket) - .registerClientBoundPacket(0x31, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AbilitiesPacket) - .registerClientBoundPacket(0x34, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EndCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EndCombatEventPacket) - .registerClientBoundPacket(0x35, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EnterCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EnterCombatEventPacket) - .registerClientBoundPacket(0x36, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeathCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeathCombatEventPacket) - .registerClientBoundPacket(0x37, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PlayerInfoPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PlayerInfoPacket) - .registerClientBoundPacket(0x38, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.FacePlayerPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.FacePlayerPacket) - .registerClientBoundPacket(0x39, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PositionPacket) - .registerClientBoundPacket(0x3a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UnlockRecipesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UnlockRecipesPacket) - .registerClientBoundPacket(0x3b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityDestroyPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityDestroyPacket) - .registerClientBoundPacket(0x3c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RemoveEntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RemoveEntityEffectPacket) - .registerClientBoundPacket(0x3d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ResourcePackSendPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ResourcePackSendPacket) - .registerClientBoundPacket(0x3e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RespawnPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.RespawnPacket) - .registerClientBoundPacket(0x3f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityHeadRotationPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityHeadRotationPacket) - .registerClientBoundPacket(0x40, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MultiBlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.MultiBlockChangePacket) - .registerClientBoundPacket(0x41, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SelectAdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SelectAdvancementTabPacket) - .registerClientBoundPacket(0x42, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ServerDataPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ServerDataPacket) - .registerClientBoundPacket(0x43, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ActionBarPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ActionBarPacket) - .registerClientBoundPacket(0x44, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderCenterPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderCenterPacket) - .registerClientBoundPacket(0x45, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderLerpSizePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderLerpSizePacket) - .registerClientBoundPacket(0x46, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderSizePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderSizePacket) - .registerClientBoundPacket(0x47, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderWarningDelayPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderWarningDelayPacket) - .registerClientBoundPacket(0x48, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderWarningReachPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.WorldBorderWarningReachPacket) - .registerClientBoundPacket(0x49, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CameraPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CameraPacket) - .registerClientBoundPacket(0x4a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.HeldItemSlotPacket) - .registerClientBoundPacket(0x4b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateViewPositionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateViewPositionPacket) - .registerClientBoundPacket(0x4c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateViewDistancePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateViewDistancePacket) - .registerClientBoundPacket(0x4d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnPositionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SpawnPositionPacket) - .registerClientBoundPacket(0x4e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ShouldDisplayChatPreviewPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ShouldDisplayChatPreviewPacket) - .registerClientBoundPacket(0x4f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardDisplayObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardDisplayObjectivePacket) - .registerClientBoundPacket(0x50, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityMetadataPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityMetadataPacket) - .registerClientBoundPacket(0x51, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AttachEntityPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AttachEntityPacket) - .registerClientBoundPacket(0x52, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityVelocityPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityVelocityPacket) - .registerClientBoundPacket(0x53, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityEquipmentPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityEquipmentPacket) - .registerClientBoundPacket(0x54, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ExperiencePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ExperiencePacket) - .registerClientBoundPacket(0x55, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateHealthPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateHealthPacket) - .registerClientBoundPacket(0x56, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardObjectivePacket) - .registerClientBoundPacket(0x57, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetPassengersPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetPassengersPacket) - .registerClientBoundPacket(0x58, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TeamsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TeamsPacket) - .registerClientBoundPacket(0x59, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardScorePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.ScoreboardScorePacket) - .registerClientBoundPacket(0x5a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SimulationDistancePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SimulationDistancePacket) - .registerClientBoundPacket(0x5b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleSubtitlePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleSubtitlePacket) - .registerClientBoundPacket(0x5c, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateTimePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.UpdateTimePacket) - .registerClientBoundPacket(0x5d, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleTextPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleTextPacket) - .registerClientBoundPacket(0x5e, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleTimePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SetTitleTimePacket) - .registerClientBoundPacket(0x5f, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntitySoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntitySoundEffectPacket) - .registerClientBoundPacket(0x60, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SoundEffectPacket) - .registerClientBoundPacket(0x61, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.StopSoundPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.StopSoundPacket) - .registerClientBoundPacket(0x62, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SystemChatPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.SystemChatPacket) - .registerClientBoundPacket(0x63, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PlayerlistHeaderPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.PlayerlistHeaderPacket) - .registerClientBoundPacket(0x64, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NbtQueryResponsePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.NbtQueryResponsePacket) - .registerClientBoundPacket(0x65, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CollectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.CollectPacket) - .registerClientBoundPacket(0x66, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityTeleportPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityTeleportPacket) - .registerClientBoundPacket(0x67, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AdvancementsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.AdvancementsPacket) - .registerClientBoundPacket(0x68, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityUpdateAttributesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityUpdateAttributesPacket) - .registerClientBoundPacket(0x69, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.EntityEffectPacket) - .registerClientBoundPacket(0x6a, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeclareRecipesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.DeclareRecipesPacket) - .registerClientBoundPacket(0x6b, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TagsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.clientbound.TagsPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.TeleportConfirmPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.TeleportConfirmPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.QueryBlockNbtPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.QueryBlockNbtPacket) - .registerServerBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetDifficultyPacket) - .registerServerBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.MessageAcknowledgementPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.MessageAcknowledgementPacket) - .registerServerBoundPacket(0x04, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatCommandPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatCommandPacket) - .registerServerBoundPacket(0x05, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatMessagePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatMessagePacket) - .registerServerBoundPacket(0x06, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatPreviewPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ChatPreviewPacket) - .registerServerBoundPacket(0x07, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ClientCommandPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ClientCommandPacket) - .registerServerBoundPacket(0x08, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SettingsPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SettingsPacket) - .registerServerBoundPacket(0x09, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.TabCompletePacket) - .registerServerBoundPacket(0x0a, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EnchantItemPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EnchantItemPacket) - .registerServerBoundPacket(0x0b, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.WindowClickPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.WindowClickPacket) - .registerServerBoundPacket(0x0c, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CloseWindowPacket) - .registerServerBoundPacket(0x0d, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CustomPayloadPacket) - .registerServerBoundPacket(0x0e, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EditBookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EditBookPacket) - .registerServerBoundPacket(0x0f, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.QueryEntityNbtPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.QueryEntityNbtPacket) - .registerServerBoundPacket(0x10, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UseEntityPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UseEntityPacket) - .registerServerBoundPacket(0x11, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.GenerateStructurePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.GenerateStructurePacket) - .registerServerBoundPacket(0x12, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.KeepAlivePacket) - .registerServerBoundPacket(0x13, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.LockDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.LockDifficultyPacket) - .registerServerBoundPacket(0x14, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PositionPacket) - .registerServerBoundPacket(0x15, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PositionLookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PositionLookPacket) - .registerServerBoundPacket(0x16, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.LookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.LookPacket) - .registerServerBoundPacket(0x17, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.FlyingPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.FlyingPacket) - .registerServerBoundPacket(0x18, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.VehicleMovePacket) - .registerServerBoundPacket(0x19, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SteerBoatPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SteerBoatPacket) - .registerServerBoundPacket(0x1a, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PickItemPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PickItemPacket) - .registerServerBoundPacket(0x1b, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CraftRecipeRequestPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.CraftRecipeRequestPacket) - .registerServerBoundPacket(0x1c, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.AbilitiesPacket) - .registerServerBoundPacket(0x1d, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.BlockDigPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.BlockDigPacket) - .registerServerBoundPacket(0x1e, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EntityActionPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.EntityActionPacket) - .registerServerBoundPacket(0x1f, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SteerVehiclePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SteerVehiclePacket) - .registerServerBoundPacket(0x20, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PongPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.PongPacket) - .registerServerBoundPacket(0x21, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.RecipeBookPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.RecipeBookPacket) - .registerServerBoundPacket(0x22, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.DisplayedRecipePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.DisplayedRecipePacket) - .registerServerBoundPacket(0x23, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.NameItemPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.NameItemPacket) - .registerServerBoundPacket(0x24, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ResourcePackReceivePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ResourcePackReceivePacket) - .registerServerBoundPacket(0x25, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.AdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.AdvancementTabPacket) - .registerServerBoundPacket(0x26, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SelectTradePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SelectTradePacket) - .registerServerBoundPacket(0x27, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetBeaconEffectPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetBeaconEffectPacket) - .registerServerBoundPacket(0x28, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.HeldItemSlotPacket) - .registerServerBoundPacket(0x29, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateCommandBlockPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateCommandBlockPacket) - .registerServerBoundPacket(0x2a, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateCommandBlockMinecartPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateCommandBlockMinecartPacket) - .registerServerBoundPacket(0x2b, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetCreativeSlotPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SetCreativeSlotPacket) - .registerServerBoundPacket(0x2c, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateJigsawBlockPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateJigsawBlockPacket) - .registerServerBoundPacket(0x2d, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateStructureBlockPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateStructureBlockPacket) - .registerServerBoundPacket(0x2e, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateSignPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UpdateSignPacket) - .registerServerBoundPacket(0x2f, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ArmAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.ArmAnimationPacket) - .registerServerBoundPacket(0x30, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SpectatePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.SpectatePacket) - .registerServerBoundPacket(0x31, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.BlockPlacePacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.BlockPlacePacket) - .registerServerBoundPacket(0x32, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UseItemPacket::class, io.layercraft.packetlib.packets.v1_19_2.play.serverbound.UseItemPacket), - ) - val V1_19_3: MinecraftCodec = - MinecraftCodec.create(ProtocolVersion.V1_19_3) - .registerPacketRegistry( - PacketState.HANDSHAKING, - MinecraftCodecRegistry.create() - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.SetProtocolPacket::class, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.SetProtocolPacket) - .registerServerBoundPacket(0xfe, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.LegacyServerListPingPacket::class, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.LegacyServerListPingPacket), - ) - .registerPacketRegistry( - PacketState.LOGIN, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.DisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.DisconnectPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.EncryptionBeginPacket) - .registerClientBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.SuccessPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.SuccessPacket) - .registerClientBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.CompressPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.CompressPacket) - .registerClientBoundPacket(0x04, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.LoginPluginRequestPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.LoginPluginRequestPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginStartPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginStartPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.EncryptionBeginPacket) - .registerServerBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginPluginResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginPluginResponsePacket), - ) - .registerPacketRegistry( - PacketState.STATUS, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.ServerInfoPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.ServerInfoPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.PingPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingStartPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingStartPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingPacket), - ) - .registerPacketRegistry( - PacketState.PLAY, - MinecraftCodecRegistry.create() - .registerClientBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityPacket) - .registerClientBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityExperienceOrbPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityExperienceOrbPacket) - .registerClientBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NamedEntitySpawnPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NamedEntitySpawnPacket) - .registerClientBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AnimationPacket) - .registerClientBoundPacket(0x04, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StatisticsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StatisticsPacket) - .registerClientBoundPacket(0x05, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AcknowledgePlayerDiggingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AcknowledgePlayerDiggingPacket) - .registerClientBoundPacket(0x06, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockBreakAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockBreakAnimationPacket) - .registerClientBoundPacket(0x07, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TileEntityDataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TileEntityDataPacket) - .registerClientBoundPacket(0x08, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockActionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockActionPacket) - .registerClientBoundPacket(0x09, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockChangePacket) - .registerClientBoundPacket(0x0a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BossBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BossBarPacket) - .registerClientBoundPacket(0x0b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DifficultyPacket) - .registerClientBoundPacket(0x0c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ClearTitlesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ClearTitlesPacket) - .registerClientBoundPacket(0x0d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TabCompletePacket) - .registerClientBoundPacket(0x0e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeclareCommandsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeclareCommandsPacket) - .registerClientBoundPacket(0x0f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CloseWindowPacket) - .registerClientBoundPacket(0x10, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WindowItemsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WindowItemsPacket) - .registerClientBoundPacket(0x11, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftProgressBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftProgressBarPacket) - .registerClientBoundPacket(0x12, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetSlotPacket) - .registerClientBoundPacket(0x13, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetCooldownPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetCooldownPacket) - .registerClientBoundPacket(0x14, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ChatSuggestionsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ChatSuggestionsPacket) - .registerClientBoundPacket(0x15, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CustomPayloadPacket) - .registerClientBoundPacket(0x17, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KickDisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KickDisconnectPacket) - .registerClientBoundPacket(0x18, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ProfilelessChatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ProfilelessChatPacket) - .registerClientBoundPacket(0x19, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityStatusPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityStatusPacket) - .registerClientBoundPacket(0x1a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExplosionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExplosionPacket) - .registerClientBoundPacket(0x1b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnloadChunkPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnloadChunkPacket) - .registerClientBoundPacket(0x1c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.GameStateChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.GameStateChangePacket) - .registerClientBoundPacket(0x1d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenHorseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenHorseWindowPacket) - .registerClientBoundPacket(0x1e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.InitializeWorldBorderPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.InitializeWorldBorderPacket) - .registerClientBoundPacket(0x1f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KeepAlivePacket) - .registerClientBoundPacket(0x20, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapChunkPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapChunkPacket) - .registerClientBoundPacket(0x21, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldEventPacket) - .registerClientBoundPacket(0x22, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldParticlesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldParticlesPacket) - .registerClientBoundPacket(0x23, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateLightPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateLightPacket) - .registerClientBoundPacket(0x24, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.LoginPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.LoginPacket) - .registerClientBoundPacket(0x25, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapPacket) - .registerClientBoundPacket(0x26, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TradeListPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TradeListPacket) - .registerClientBoundPacket(0x27, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RelEntityMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RelEntityMovePacket) - .registerClientBoundPacket(0x28, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMoveLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMoveLookPacket) - .registerClientBoundPacket(0x29, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityLookPacket) - .registerClientBoundPacket(0x2a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.VehicleMovePacket) - .registerClientBoundPacket(0x2b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenBookPacket) - .registerClientBoundPacket(0x2c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenWindowPacket) - .registerClientBoundPacket(0x2d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenSignEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenSignEntityPacket) - .registerClientBoundPacket(0x2e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PingPacket) - .registerClientBoundPacket(0x2f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftRecipeResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftRecipeResponsePacket) - .registerClientBoundPacket(0x30, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AbilitiesPacket) - .registerClientBoundPacket(0x32, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EndCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EndCombatEventPacket) - .registerClientBoundPacket(0x33, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EnterCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EnterCombatEventPacket) - .registerClientBoundPacket(0x34, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeathCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeathCombatEventPacket) - .registerClientBoundPacket(0x35, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerRemovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerRemovePacket) - .registerClientBoundPacket(0x37, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FacePlayerPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FacePlayerPacket) - .registerClientBoundPacket(0x38, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PositionPacket) - .registerClientBoundPacket(0x39, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnlockRecipesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnlockRecipesPacket) - .registerClientBoundPacket(0x3a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityDestroyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityDestroyPacket) - .registerClientBoundPacket(0x3b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RemoveEntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RemoveEntityEffectPacket) - .registerClientBoundPacket(0x3c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ResourcePackSendPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ResourcePackSendPacket) - .registerClientBoundPacket(0x3d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RespawnPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RespawnPacket) - .registerClientBoundPacket(0x3e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityHeadRotationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityHeadRotationPacket) - .registerClientBoundPacket(0x3f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MultiBlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MultiBlockChangePacket) - .registerClientBoundPacket(0x40, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SelectAdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SelectAdvancementTabPacket) - .registerClientBoundPacket(0x41, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ServerDataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ServerDataPacket) - .registerClientBoundPacket(0x42, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ActionBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ActionBarPacket) - .registerClientBoundPacket(0x43, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderCenterPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderCenterPacket) - .registerClientBoundPacket(0x44, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderLerpSizePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderLerpSizePacket) - .registerClientBoundPacket(0x45, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderSizePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderSizePacket) - .registerClientBoundPacket(0x46, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningDelayPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningDelayPacket) - .registerClientBoundPacket(0x47, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningReachPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningReachPacket) - .registerClientBoundPacket(0x48, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CameraPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CameraPacket) - .registerClientBoundPacket(0x49, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.HeldItemSlotPacket) - .registerClientBoundPacket(0x4a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewPositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewPositionPacket) - .registerClientBoundPacket(0x4b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewDistancePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewDistancePacket) - .registerClientBoundPacket(0x4c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnPositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnPositionPacket) - .registerClientBoundPacket(0x4d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardDisplayObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardDisplayObjectivePacket) - .registerClientBoundPacket(0x4e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMetadataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMetadataPacket) - .registerClientBoundPacket(0x4f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AttachEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AttachEntityPacket) - .registerClientBoundPacket(0x50, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityVelocityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityVelocityPacket) - .registerClientBoundPacket(0x51, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEquipmentPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEquipmentPacket) - .registerClientBoundPacket(0x52, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExperiencePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExperiencePacket) - .registerClientBoundPacket(0x53, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateHealthPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateHealthPacket) - .registerClientBoundPacket(0x54, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardObjectivePacket) - .registerClientBoundPacket(0x55, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetPassengersPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetPassengersPacket) - .registerClientBoundPacket(0x56, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TeamsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TeamsPacket) - .registerClientBoundPacket(0x57, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardScorePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardScorePacket) - .registerClientBoundPacket(0x58, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SimulationDistancePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SimulationDistancePacket) - .registerClientBoundPacket(0x59, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleSubtitlePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleSubtitlePacket) - .registerClientBoundPacket(0x5a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateTimePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateTimePacket) - .registerClientBoundPacket(0x5b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTextPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTextPacket) - .registerClientBoundPacket(0x5c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTimePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTimePacket) - .registerClientBoundPacket(0x5d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntitySoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntitySoundEffectPacket) - .registerClientBoundPacket(0x5e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SoundEffectPacket) - .registerClientBoundPacket(0x5f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StopSoundPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StopSoundPacket) - .registerClientBoundPacket(0x60, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SystemChatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SystemChatPacket) - .registerClientBoundPacket(0x61, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerlistHeaderPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerlistHeaderPacket) - .registerClientBoundPacket(0x62, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NbtQueryResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NbtQueryResponsePacket) - .registerClientBoundPacket(0x63, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CollectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CollectPacket) - .registerClientBoundPacket(0x64, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityTeleportPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityTeleportPacket) - .registerClientBoundPacket(0x65, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AdvancementsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AdvancementsPacket) - .registerClientBoundPacket(0x66, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityUpdateAttributesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityUpdateAttributesPacket) - .registerClientBoundPacket(0x67, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FeatureFlagsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FeatureFlagsPacket) - .registerClientBoundPacket(0x68, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEffectPacket) - .registerClientBoundPacket(0x6a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TagsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TagsPacket) - .registerServerBoundPacket(0x00, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TeleportConfirmPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TeleportConfirmPacket) - .registerServerBoundPacket(0x01, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryBlockNbtPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryBlockNbtPacket) - .registerServerBoundPacket(0x02, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetDifficultyPacket) - .registerServerBoundPacket(0x03, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.MessageAcknowledgementPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.MessageAcknowledgementPacket) - .registerServerBoundPacket(0x06, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ClientCommandPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ClientCommandPacket) - .registerServerBoundPacket(0x07, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SettingsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SettingsPacket) - .registerServerBoundPacket(0x08, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TabCompletePacket) - .registerServerBoundPacket(0x09, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EnchantItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EnchantItemPacket) - .registerServerBoundPacket(0x0a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.WindowClickPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.WindowClickPacket) - .registerServerBoundPacket(0x0b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CloseWindowPacket) - .registerServerBoundPacket(0x0c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CustomPayloadPacket) - .registerServerBoundPacket(0x0d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EditBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EditBookPacket) - .registerServerBoundPacket(0x0e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryEntityNbtPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryEntityNbtPacket) - .registerServerBoundPacket(0x0f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseEntityPacket) - .registerServerBoundPacket(0x10, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.GenerateStructurePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.GenerateStructurePacket) - .registerServerBoundPacket(0x11, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.KeepAlivePacket) - .registerServerBoundPacket(0x12, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LockDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LockDifficultyPacket) - .registerServerBoundPacket(0x13, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionPacket) - .registerServerBoundPacket(0x14, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionLookPacket) - .registerServerBoundPacket(0x15, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LookPacket) - .registerServerBoundPacket(0x16, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.FlyingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.FlyingPacket) - .registerServerBoundPacket(0x17, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.VehicleMovePacket) - .registerServerBoundPacket(0x18, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerBoatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerBoatPacket) - .registerServerBoundPacket(0x19, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PickItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PickItemPacket) - .registerServerBoundPacket(0x1a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CraftRecipeRequestPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CraftRecipeRequestPacket) - .registerServerBoundPacket(0x1b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AbilitiesPacket) - .registerServerBoundPacket(0x1c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockDigPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockDigPacket) - .registerServerBoundPacket(0x1d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EntityActionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EntityActionPacket) - .registerServerBoundPacket(0x1e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerVehiclePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerVehiclePacket) - .registerServerBoundPacket(0x1f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PongPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PongPacket) - .registerServerBoundPacket(0x20, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SessionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SessionPacket) - .registerServerBoundPacket(0x21, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.RecipeBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.RecipeBookPacket) - .registerServerBoundPacket(0x22, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.DisplayedRecipePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.DisplayedRecipePacket) - .registerServerBoundPacket(0x23, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.NameItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.NameItemPacket) - .registerServerBoundPacket(0x24, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ResourcePackReceivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ResourcePackReceivePacket) - .registerServerBoundPacket(0x25, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AdvancementTabPacket) - .registerServerBoundPacket(0x26, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SelectTradePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SelectTradePacket) - .registerServerBoundPacket(0x27, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetBeaconEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetBeaconEffectPacket) - .registerServerBoundPacket(0x28, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.HeldItemSlotPacket) - .registerServerBoundPacket(0x29, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockPacket) - .registerServerBoundPacket(0x2a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockMinecartPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockMinecartPacket) - .registerServerBoundPacket(0x2b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetCreativeSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetCreativeSlotPacket) - .registerServerBoundPacket(0x2c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateJigsawBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateJigsawBlockPacket) - .registerServerBoundPacket(0x2d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateStructureBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateStructureBlockPacket) - .registerServerBoundPacket(0x2e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateSignPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateSignPacket) - .registerServerBoundPacket(0x2f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ArmAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ArmAnimationPacket) - .registerServerBoundPacket(0x30, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SpectatePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SpectatePacket) - .registerServerBoundPacket(0x31, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockPlacePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockPlacePacket) - .registerServerBoundPacket(0x32, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseItemPacket), - ) + val V1_19_3: Codec = + codec(ProtocolVersion.V1_19_3) { + packets(PacketState.HANDSHAKING) { + serverBound(0x00, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.SetProtocolPacket::class, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.SetProtocolPacket) + serverBound(0xfe, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.LegacyServerListPingPacket::class, io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.LegacyServerListPingPacket) + } + + packets(PacketState.LOGIN) { + clientBound(0x00, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.DisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.DisconnectPacket) + clientBound(0x01, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.EncryptionBeginPacket) + clientBound(0x02, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.SuccessPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.SuccessPacket) + clientBound(0x03, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.CompressPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.CompressPacket) + clientBound(0x04, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.LoginPluginRequestPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.clientbound.LoginPluginRequestPacket) + serverBound(0x00, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginStartPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginStartPacket) + serverBound(0x01, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.EncryptionBeginPacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.EncryptionBeginPacket) + serverBound(0x02, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginPluginResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginPluginResponsePacket) + } + + packets(PacketState.STATUS) { + clientBound(0x00, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.ServerInfoPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.ServerInfoPacket) + clientBound(0x01, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.clientbound.PingPacket) + serverBound(0x00, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingStartPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingStartPacket) + serverBound(0x01, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.status.serverbound.PingPacket) + } + + packets(PacketState.PLAY) { + clientBound(0x00, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityPacket) + clientBound(0x01, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityExperienceOrbPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnEntityExperienceOrbPacket) + clientBound(0x02, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NamedEntitySpawnPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NamedEntitySpawnPacket) + clientBound(0x03, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AnimationPacket) + clientBound(0x04, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StatisticsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StatisticsPacket) + clientBound(0x05, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AcknowledgePlayerDiggingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AcknowledgePlayerDiggingPacket) + clientBound(0x06, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockBreakAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockBreakAnimationPacket) + clientBound(0x07, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TileEntityDataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TileEntityDataPacket) + clientBound(0x08, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockActionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockActionPacket) + clientBound(0x09, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BlockChangePacket) + clientBound(0x0a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BossBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.BossBarPacket) + clientBound(0x0b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DifficultyPacket) + clientBound(0x0c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ClearTitlesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ClearTitlesPacket) + clientBound(0x0d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TabCompletePacket) + clientBound(0x0e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeclareCommandsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeclareCommandsPacket) + clientBound(0x0f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CloseWindowPacket) + clientBound(0x10, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WindowItemsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WindowItemsPacket) + clientBound(0x11, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftProgressBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftProgressBarPacket) + clientBound(0x12, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetSlotPacket) + clientBound(0x13, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetCooldownPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetCooldownPacket) + clientBound(0x14, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ChatSuggestionsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ChatSuggestionsPacket) + clientBound(0x15, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CustomPayloadPacket) + clientBound(0x17, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KickDisconnectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KickDisconnectPacket) + clientBound(0x18, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ProfilelessChatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ProfilelessChatPacket) + clientBound(0x19, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityStatusPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityStatusPacket) + clientBound(0x1a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExplosionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExplosionPacket) + clientBound(0x1b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnloadChunkPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnloadChunkPacket) + clientBound(0x1c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.GameStateChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.GameStateChangePacket) + clientBound(0x1d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenHorseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenHorseWindowPacket) + clientBound(0x1e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.InitializeWorldBorderPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.InitializeWorldBorderPacket) + clientBound(0x1f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.KeepAlivePacket) + clientBound(0x20, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapChunkPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapChunkPacket) + clientBound(0x21, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldEventPacket) + clientBound(0x22, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldParticlesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldParticlesPacket) + clientBound(0x23, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateLightPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateLightPacket) + clientBound(0x24, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.LoginPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.LoginPacket) + clientBound(0x25, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MapPacket) + clientBound(0x26, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TradeListPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TradeListPacket) + clientBound(0x27, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RelEntityMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RelEntityMovePacket) + clientBound(0x28, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMoveLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMoveLookPacket) + clientBound(0x29, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityLookPacket) + clientBound(0x2a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.VehicleMovePacket) + clientBound(0x2b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenBookPacket) + clientBound(0x2c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenWindowPacket) + clientBound(0x2d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenSignEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.OpenSignEntityPacket) + clientBound(0x2e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PingPacket) + clientBound(0x2f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftRecipeResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CraftRecipeResponsePacket) + clientBound(0x30, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AbilitiesPacket) + clientBound(0x32, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EndCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EndCombatEventPacket) + clientBound(0x33, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EnterCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EnterCombatEventPacket) + clientBound(0x34, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeathCombatEventPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.DeathCombatEventPacket) + clientBound(0x35, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerRemovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerRemovePacket) + clientBound(0x37, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FacePlayerPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FacePlayerPacket) + clientBound(0x38, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PositionPacket) + clientBound(0x39, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnlockRecipesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UnlockRecipesPacket) + clientBound(0x3a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityDestroyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityDestroyPacket) + clientBound(0x3b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RemoveEntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RemoveEntityEffectPacket) + clientBound(0x3c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ResourcePackSendPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ResourcePackSendPacket) + clientBound(0x3d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RespawnPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.RespawnPacket) + clientBound(0x3e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityHeadRotationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityHeadRotationPacket) + clientBound(0x3f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MultiBlockChangePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.MultiBlockChangePacket) + clientBound(0x40, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SelectAdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SelectAdvancementTabPacket) + clientBound(0x41, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ServerDataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ServerDataPacket) + clientBound(0x42, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ActionBarPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ActionBarPacket) + clientBound(0x43, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderCenterPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderCenterPacket) + clientBound(0x44, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderLerpSizePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderLerpSizePacket) + clientBound(0x45, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderSizePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderSizePacket) + clientBound(0x46, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningDelayPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningDelayPacket) + clientBound(0x47, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningReachPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.WorldBorderWarningReachPacket) + clientBound(0x48, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CameraPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CameraPacket) + clientBound(0x49, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.HeldItemSlotPacket) + clientBound(0x4a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewPositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewPositionPacket) + clientBound(0x4b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewDistancePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateViewDistancePacket) + clientBound(0x4c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnPositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SpawnPositionPacket) + clientBound(0x4d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardDisplayObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardDisplayObjectivePacket) + clientBound(0x4e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMetadataPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityMetadataPacket) + clientBound(0x4f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AttachEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AttachEntityPacket) + clientBound(0x50, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityVelocityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityVelocityPacket) + clientBound(0x51, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEquipmentPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEquipmentPacket) + clientBound(0x52, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExperiencePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ExperiencePacket) + clientBound(0x53, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateHealthPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateHealthPacket) + clientBound(0x54, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardObjectivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardObjectivePacket) + clientBound(0x55, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetPassengersPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetPassengersPacket) + clientBound(0x56, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TeamsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TeamsPacket) + clientBound(0x57, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardScorePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.ScoreboardScorePacket) + clientBound(0x58, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SimulationDistancePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SimulationDistancePacket) + clientBound(0x59, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleSubtitlePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleSubtitlePacket) + clientBound(0x5a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateTimePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.UpdateTimePacket) + clientBound(0x5b, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTextPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTextPacket) + clientBound(0x5c, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTimePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SetTitleTimePacket) + clientBound(0x5d, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntitySoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntitySoundEffectPacket) + clientBound(0x5e, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SoundEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SoundEffectPacket) + clientBound(0x5f, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StopSoundPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.StopSoundPacket) + clientBound(0x60, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SystemChatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.SystemChatPacket) + clientBound(0x61, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerlistHeaderPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.PlayerlistHeaderPacket) + clientBound(0x62, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NbtQueryResponsePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.NbtQueryResponsePacket) + clientBound(0x63, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CollectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.CollectPacket) + clientBound(0x64, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityTeleportPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityTeleportPacket) + clientBound(0x65, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AdvancementsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.AdvancementsPacket) + clientBound(0x66, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityUpdateAttributesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityUpdateAttributesPacket) + clientBound(0x67, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FeatureFlagsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.FeatureFlagsPacket) + clientBound(0x68, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.EntityEffectPacket) + clientBound(0x6a, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TagsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.clientbound.TagsPacket) + serverBound(0x00, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TeleportConfirmPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TeleportConfirmPacket) + serverBound(0x01, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryBlockNbtPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryBlockNbtPacket) + serverBound(0x02, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetDifficultyPacket) + serverBound(0x03, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.MessageAcknowledgementPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.MessageAcknowledgementPacket) + serverBound(0x06, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ClientCommandPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ClientCommandPacket) + serverBound(0x07, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SettingsPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SettingsPacket) + serverBound(0x08, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TabCompletePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.TabCompletePacket) + serverBound(0x09, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EnchantItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EnchantItemPacket) + serverBound(0x0a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.WindowClickPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.WindowClickPacket) + serverBound(0x0b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CloseWindowPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CloseWindowPacket) + serverBound(0x0c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CustomPayloadPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CustomPayloadPacket) + serverBound(0x0d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EditBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EditBookPacket) + serverBound(0x0e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryEntityNbtPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.QueryEntityNbtPacket) + serverBound(0x0f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseEntityPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseEntityPacket) + serverBound(0x10, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.GenerateStructurePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.GenerateStructurePacket) + serverBound(0x11, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.KeepAlivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.KeepAlivePacket) + serverBound(0x12, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LockDifficultyPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LockDifficultyPacket) + serverBound(0x13, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionPacket) + serverBound(0x14, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionLookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PositionLookPacket) + serverBound(0x15, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.LookPacket) + serverBound(0x16, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.FlyingPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.FlyingPacket) + serverBound(0x17, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.VehicleMovePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.VehicleMovePacket) + serverBound(0x18, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerBoatPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerBoatPacket) + serverBound(0x19, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PickItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PickItemPacket) + serverBound(0x1a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CraftRecipeRequestPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.CraftRecipeRequestPacket) + serverBound(0x1b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AbilitiesPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AbilitiesPacket) + serverBound(0x1c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockDigPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockDigPacket) + serverBound(0x1d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EntityActionPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.EntityActionPacket) + serverBound(0x1e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerVehiclePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SteerVehiclePacket) + serverBound(0x1f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PongPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.PongPacket) + serverBound(0x20, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ChatSessionUpdatePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ChatSessionUpdatePacket) + serverBound(0x21, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.RecipeBookPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.RecipeBookPacket) + serverBound(0x22, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.DisplayedRecipePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.DisplayedRecipePacket) + serverBound(0x23, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.NameItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.NameItemPacket) + serverBound(0x24, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ResourcePackReceivePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ResourcePackReceivePacket) + serverBound(0x25, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AdvancementTabPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.AdvancementTabPacket) + serverBound(0x26, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SelectTradePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SelectTradePacket) + serverBound(0x27, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetBeaconEffectPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetBeaconEffectPacket) + serverBound(0x28, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.HeldItemSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.HeldItemSlotPacket) + serverBound(0x29, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockPacket) + serverBound(0x2a, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockMinecartPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateCommandBlockMinecartPacket) + serverBound(0x2b, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetCreativeSlotPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SetCreativeSlotPacket) + serverBound(0x2c, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateJigsawBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateJigsawBlockPacket) + serverBound(0x2d, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateStructureBlockPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateStructureBlockPacket) + serverBound(0x2e, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateSignPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UpdateSignPacket) + serverBound(0x2f, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ArmAnimationPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.ArmAnimationPacket) + serverBound(0x30, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SpectatePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.SpectatePacket) + serverBound(0x31, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockPlacePacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.BlockPlacePacket) + serverBound(0x32, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseItemPacket::class, io.layercraft.packetlib.packets.v1_19_3.play.serverbound.UseItemPacket) + } + } - val V1_19_4: MinecraftCodec = this.V1_19_3.copy(ProtocolVersion.V1_19_4) + val V1_19_4: Codec = codecCopy(ProtocolVersion.V1_19_4, this.V1_19_3) } \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/data/ProtocolVersion.kt b/src/main/kotlin/io/layercraft/packetlib/codec/ProtocolVersion.kt similarity index 97% rename from src/main/kotlin/io/layercraft/packetlib/data/ProtocolVersion.kt rename to src/main/kotlin/io/layercraft/packetlib/codec/ProtocolVersion.kt index 76be1da..1010e72 100644 --- a/src/main/kotlin/io/layercraft/packetlib/data/ProtocolVersion.kt +++ b/src/main/kotlin/io/layercraft/packetlib/codec/ProtocolVersion.kt @@ -1,4 +1,4 @@ -package io.layercraft.packetlib.data +package io.layercraft.packetlib.codec enum class ProtocolVersion(val protocolNumber: Int, val version: String) { diff --git a/src/main/kotlin/io/layercraft/packetlib/data/entity/Entity.kt b/src/main/kotlin/io/layercraft/packetlib/data/entity/Entity.kt deleted file mode 100644 index fcf0c84..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/data/entity/Entity.kt +++ /dev/null @@ -1,54 +0,0 @@ -package io.layercraft.packetlib.data.entity - -abstract class Entity( - val state: Byte = 0, - val airTicks: Int = 300, - val customName: String? = null, - val customNameVisible: Boolean = false, - val silent: Boolean = false, - val noGravity: Boolean = false, - val pose: EntityPose = EntityPose.STANDING, - val snowTicks: Int = 0, -) - -enum class EntityState( - val bitmask: Int, -) { - IS_ON_FIRE(0x01), - IS_CROUCHED(0x02), - IS_SPRINTING(0x08), - IS_SWIMMING(0x10), - IS_INVISIBLE(0x20), - IS_GLOWING(0x40), - IS_FLYING_WITH_ELYTRA(0x80), - ; - - companion object { - fun fromBitmask(bitmask: Byte): Set { - return values().filter { bitmask.toInt() and it.bitmask != 0 }.toSet() - } - - fun toBitmask(states: Set): Byte { - return states.fold(0) { acc, state -> acc or state.bitmask }.toByte() - } - } -} - -enum class EntityPose( - val bitmask: Int, -) { - STANDING(0), - FALL_FLYING(1), - SLEEPING(2), - SWIMMING(3), - SPIN_ATTACK(4), - SNEAKING(5), - LONG_JUMPING(6), - DYING(7), - CROAKING(8), - USING_TONGUE(9), - ROARING(10), - SNIFFING(11), - EMERGING(12), - DIGGING(13), -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityAnimationType.kt b/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityAnimationType.kt deleted file mode 100644 index 4f2ad90..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityAnimationType.kt +++ /dev/null @@ -1,10 +0,0 @@ -package io.layercraft.packetlib.data.entity - -enum class EntityAnimationType(val id: Int) { - SWING_MAIN_HAND(0), - TAKE_DAMAGE(1), - LEAVE_BED(2), - SWING_OFF_HAND(3), - CRITICAL_EFFECT(4), - MAGIC_CRITICAL_EFFECT(5), -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityType.kt b/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityType.kt deleted file mode 100644 index 7604004..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/data/entity/EntityType.kt +++ /dev/null @@ -1,138 +0,0 @@ -package io.layercraft.packetlib.data.entity - -@Suppress("unused", "SpellCheckingInspection") -enum class EntityType( - val type: Int, - val entityName: String, - val indentifier: String, -) { - ALLAY(0, "Allay", "minecraft:allay"), - AREA_EFFECT_CLOUD(1, "Area Effect Cloud", "minecraft:area_effect_cloud"), - ARMOR_STAND(2, "Armor Stand", "minecraft:armor_stand"), - ARROW(3, "Arrow", "minecraft:arrow"), - AXOLOTL(4, "Axolotl", "minecraft:axolotl"), - BAT(5, "Bat", "minecraft:bat"), - BEE(6, "Bee", "minecraft:bee"), - BLAZE(7, "Blaze", "minecraft:blaze"), - BOAT(8, "Boat", "minecraft:boat"), - CHEST_BOAT(9, "Chest Boat", "minecraft:chest_boat"), - CAT(10, "Cat", "minecraft:cat"), - CAVE_SPIDER(11, "Cave Spider", "minecraft:cave_spider"), - CHICKEN(12, "Chicken", "minecraft:chicken"), - COD(13, "Cod", "minecraft:cod"), - COW(14, "Cow", "minecraft:cow"), - CREEPER(15, "Creeper", "minecraft:creeper"), - DOLPHIN(16, "Dolphin", "minecraft:dolphin"), - DONKEY(17, "Donkey", "minecraft:donkey"), - DRAGON_FIREBALL(18, "Dragon Fireball", "minecraft:dragon_fireball"), - DROWNED(19, "Drowned", "minecraft:drowned"), - ELDER_GUARDIAN(20, "Elder Guardian", "minecraft:elder_guardian"), - ENDER_CRYSTAL(21, "Ender Crystal", "minecraft:ender_crystal"), - ENDER_DRAGON(22, "Ender Dragon", "minecraft:ender_dragon"), - ENDERMAN(23, "Enderman", "minecraft:enderman"), - ENDERMITE(24, "Endermite", "minecraft:endermite"), - EVOKER(25, "Evoker", "minecraft:evoker"), - EVOKER_FANGS(26, "Evoker Fangs", "minecraft:evoker_fangs"), - EXPERIENCE_ORB(27, "Experience Orb", "minecraft:experience_orb"), - EYE_OF_ENDER(28, "Eye of Ender", "minecraft:eye_of_ender"), - FALLING_BLOCK(29, "Falling Block", "minecraft:falling_block"), - FIREWORK_ROCKET(30, "Firework Rocket", "minecraft:firework_rocket"), - FOX(31, "Fox", "minecraft:fox"), - FROG(32, "Frog", "minecraft:frog"), - GHAST(33, "Ghast", "minecraft:ghast"), - GIANT(34, "Giant", "minecraft:giant"), - GLOW_ITEM_FRAME(35, "Glow Item Frame", "minecraft:glow_item_frame"), - GLOW_SQUID(36, "Glow Squid", "minecraft:glow_squid"), - GOAT(37, "Goat", "minecraft:goat"), - GUARDIAN(38, "Guardian", "minecraft:guardian"), - HOGLIN(39, "Hoglin", "minecraft:hoglin"), - HORSE(40, "Horse", "minecraft:horse"), - HUSK(41, "Husk", "minecraft:husk"), - ILLUSIONER(42, "Illusioner", "minecraft:illusioner"), - IRON_GOLEM(43, "Iron Golem", "minecraft:iron_golem"), - ITEM(44, "Item", "minecraft:item"), - ITEM_FRAME(45, "Item Frame", "minecraft:item_frame"), - FIREBALL(46, "Fireball", "minecraft:fireball"), - LEASH_KNOT(47, "Leash Knot", "minecraft:leash_knot"), - LIGHTNING_BOLT(48, "Lightning Bolt", "minecraft:lightning_bolt"), - LLAMA(49, "Llama", "minecraft:llama"), - LLAMA_SPIT(50, "Llama Spit", "minecraft:llama_spit"), - MAGMA_CUBE(51, "Magma Cube", "minecraft:magma_cube"), - MARKER(52, "Marker", "minecraft:marker"), - MINECART(53, "Minecart", "minecraft:minecart"), - CHEST_MINECART(54, "Minecart Chest", "minecraft:chest_minecart"), - COMMAND_BLOCK_MINECART(55, "Minecart Command Block", "minecraft:command_block_minecart"), - FURNACE_MINECART(56, "Minecart Furnace", "minecraft:furnace_minecart"), - HOPPER_MINECART(57, "Minecart Hopper", "minecraft:hopper_minecart"), - SPAWNER_MINECART(58, "Minecart Spawner", "minecraft:spawner_minecart"), - TNT_MINECART(59, "Minecart TNT", "minecraft:tnt_minecart"), - MULE(60, "Mule", "minecraft:mule"), - MOOSHROOM(61, "Mooshroom", "minecraft:mooshroom"), - OCELOT(62, "Ocelot", "minecraft:ocelot"), - PAINTING(63, "Painting", "minecraft:painting"), - PANDA(64, "Panda", "minecraft:panda"), - PARROT(65, "Parrot", "minecraft:parrot"), - PHANTOM(66, "Phantom", "minecraft:phantom"), - PIG(67, "Pig", "minecraft:pig"), - PIGLIN(68, "Piglin", "minecraft:piglin"), - PIGLIN_BRUTE(69, "Piglin Brute", "minecraft:piglin_brute"), - PILLAGER(70, "Pillager", "minecraft:pillager"), - POLAR_BEAR(71, "Polar Bear", "minecraft:polar_bear"), - PRIMED_TNT(72, "Primed TNT", "minecraft:tnt"), - PUFFERFISH(73, "Pufferfish", "minecraft:pufferfish"), - RABBIT(74, "Rabbit", "minecraft:rabbit"), - RAVAGER(75, "Ravager", "minecraft:ravager"), - SALMON(76, "Salmon", "minecraft:salmon"), - SHEEP(77, "Sheep", "minecraft:sheep"), - SHULKER(78, "Shulker", "minecraft:shulker"), - SHULKER_BULLET(79, "Shulker Bullet", "minecraft:shulker_bullet"), - SILVERFISH(80, "Silverfish", "minecraft:silverfish"), - SKELETON(81, "Skeleton", "minecraft:skeleton"), - SKELETON_HORSE(82, "Skeleton Horse", "minecraft:skeleton_horse"), - SLIME(83, "Slime", "minecraft:slime"), - SMALL_FIREBALL(84, "Small Fireball", "minecraft:small_fireball"), - SNOW_GOLEM(85, "Snow Golem", "minecraft:snow_golem"), - SNOWBALL(86, "Snowball", "minecraft:snowball"), - SPECTRAL_ARROW(87, "Spectral Arrow", "minecraft:spectral_arrow"), - SPIDER(88, "Spider", "minecraft:spider"), - SQUID(89, "Squid", "minecraft:squid"), - STRAY(90, "Stray", "minecraft:stray"), - STRIDER(91, "Strider", "minecraft:strider"), - TADPOLE(92, "Tadpole", "minecraft:tadpole"), - EGG(93, "Thrown Egg", "minecraft:egg"), - ENDER_PEARL(94, "Thrown Enderpearl", "minecraft:ender_pearl"), - XP_BOTTLE(95, "Thrown Experience Bottle", "minecraft:xp_bottle"), - POTION(96, "Thrown Potion", "minecraft:potion"), - TRIDENT(97, "Thrown Trident", "minecraft:trident"), - TRADER_LLAMA(98, "Trader Llama", "minecraft:trader_llama"), - TROPICAL_FISH(99, "Tropical Fish", "minecraft:tropical_fish"), - TURTLE(100, "Turtle", "minecraft:turtle"), - VEX(101, "Vex", "minecraft:vex"), - VILLAGER(102, "Villager", "minecraft:villager"), - VINDICATOR(103, "Vindicator", "minecraft:vindicator"), - WANDERING_TRADER(104, "Wandering Trader", "minecraft:wandering_trader"), - WARDEN(105, "Warden", "minecraft:warden"), - WITCH(106, "Witch", "minecraft:witch"), - WITHER(107, "Wither", "minecraft:wither"), - WITHER_SKELETON(108, "Wither Skeleton", "minecraft:wither_skeleton"), - WITHER_SKULL(109, "Wither Skull", "minecraft:wither_skull"), - WOLF(110, "Wolf", "minecraft:wolf"), - ZOGLIN(111, "Zoglin", "minecraft:zoglin"), - ZOMBIE(112, "Zombie", "minecraft:zombie"), - ZOMBIE_HORSE(113, "Zombie Horse", "minecraft:zombie_horse"), - ZOMBIE_VILLAGER(114, "Zombie Villager", "minecraft:zombie_villager"), - ZOMBIFIED_PIGLIN(115, "Zombified Piglin", "minecraft:zombified_piglin"), - PLAYER(116, "Player", "minecraft:player"), - FISHING_BOBBER(117, "Fishing Bobber", "minecraft:fishing_bobber"), - ; - - companion object { - private val BY_TYPE = values().associateBy(EntityType::type) - private val BY_NAME = values().associateBy(EntityType::entityName) - private val BY_INDENTFIER = values().associateBy(EntityType::indentifier) - - fun byType(id: Int) = BY_TYPE[id] ?: throw IllegalArgumentException("Unknown entity type id $id") - fun byEntityName(name: String) = BY_NAME[name] ?: throw IllegalArgumentException("Unknown entity type name $name") - fun byIndentifier(key: String) = BY_INDENTFIER[key] ?: throw IllegalArgumentException("Unknown entity type indentifier $key") - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/data/particle/Particles.kt b/src/main/kotlin/io/layercraft/packetlib/data/particle/Particles.kt deleted file mode 100644 index 1e2b918..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/data/particle/Particles.kt +++ /dev/null @@ -1,95 +0,0 @@ -package io.layercraft.packetlib.data.particle - -enum class Particles( - val id: Int, - val particleName: String, -) { - AMBIENT_ENTITY_EFFECT(0, "minecraft:ambient_entity_effect"), - ANGRY_VILLAGER(1, "minecraft:angry_villager"), - BLOCK(2, "minecraft:block"), - BLOCK_MARKER(3, "minecraft:block_marker"), - BUBBLE(4, "minecraft:bubble"), - CLOUD(5, "minecraft:cloud"), - CRIT(6, "minecraft:crit"), - DAMAGE_INDICATOR(7, "minecraft:damage_indicator"), - DRAGON_BREATH(8, "minecraft:dragon_breath"), - DRIPPING_LAVA(9, "minecraft:dripping_lava"), - FALLING_LAVA(10, "minecraft:falling_lava"), - LANDING_LAVA(11, "minecraft:landing_lava"), - DRIPPING_WATER(12, "minecraft:dripping_water"), - FALLING_WATER(13, "minecraft:falling_water"), - DUST(14, "minecraft:dust"), - DUST_COLOR_TRANSITION(15, "minecraft:dust_color_transition"), - EFFECT(16, "minecraft:effect"), - ELDER_GUARDIAN(17, "minecraft:elder_guardian"), - ENCHANTED_HIT(18, "minecraft:enchanted_hit"), - ENCHANT(19, "minecraft:enchant"), - END_ROD(20, "minecraft:end_rod"), - ENTITY_EFFECT(21, "minecraft:entity_effect"), - EXPLOSION_EMITTER(22, "minecraft:explosion_emitter"), - EXPLOSION(23, "minecraft:explosion"), - FALLING_DUST(24, "minecraft:falling_dust"), - FIREWORK(25, "minecraft:firework"), - FISHING(26, "minecraft:fishing"), - FLAME(27, "minecraft:flame"), - SOUL_FIRE_FLAME(28, "minecraft:soul_fire_flame"), - SOUL(29, "minecraft:soul"), - FLASH(30, "minecraft:flash"), - HAPPY_VILLAGER(31, "minecraft:happy_villager"), - COMPOSTER(32, "minecraft:composter"), - HEART(33, "minecraft:heart"), - INSTANT_EFFECT(34, "minecraft:instant_effect"), - ITEM(35, "minecraft:item"), - VIBRATION(36, "minecraft:vibration"), - ITEM_SLIME(37, "minecraft:item_slime"), - ITEM_SNOWBALL(38, "minecraft:item_snowball"), - LARGE_SMOKE(39, "minecraft:large_smoke"), - LAVA(40, "minecraft:lava"), - MYCELIUM(41, "minecraft:mycelium"), - NOTE(42, "minecraft:note"), - POOF(43, "minecraft:poof"), - PORTAL(44, "minecraft:portal"), - RAIN(45, "minecraft:rain"), - SMOKE(46, "minecraft:smoke"), - SNEEZE(47, "minecraft:sneeze"), - SPIT(48, "minecraft:spit"), - SQUID_INK(49, "minecraft:squid_ink"), - SWEEP_ATTACK(50, "minecraft:sweep_attack"), - TOTEM_OF_UNDYING(51, "minecraft:totem_of_undying"), - UNDERWATER(52, "minecraft:underwater"), - SPLASH(53, "minecraft:splash"), - WITCH(54, "minecraft:witch"), - BUBBLE_POP(55, "minecraft:bubble_pop"), - CURRENT_DOWN(56, "minecraft:current_down"), - BUBBLE_COLUMN_UP(57, "minecraft:bubble_column_up"), - NAUTILUS(58, "minecraft:nautilus"), - DOLPHIN(59, "minecraft:dolphin"), - CAMPFIRE_COSY_SMOKE(60, "minecraft:campfire_cosy_smoke"), - CAMPFIRE_SIGNAL_SMOKE(61, "minecraft:campfire_signal_smoke"), - DRIPPING_HONEY(62, "minecraft:dripping_honey"), - FALLING_HONEY(63, "minecraft:falling_honey"), - LANDING_HONEY(64, "minecraft:landing_honey"), - FALLING_NECTAR(65, "minecraft:falling_nectar"), - FALLING_SPORE_BLOSSOM(66, "minecraft:falling_spore_blossom"), - ASH(67, "minecraft:ash"), - CRIMSON_SPORE(68, "minecraft:crimson_spore"), - WARPED_SPORE(69, "minecraft:warped_spore"), - SPORE_BLOSSOM_AIR(70, "minecraft:spore_blossom_air"), - DRIPPING_OBSIDIAN_TEAR(71, "minecraft:dripping_obsidian_tear"), - FALLING_OBSIDIAN_TEAR(72, "minecraft:falling_obsidian_tear"), - LANDING_OBSIDIAN_TEAR(73, "minecraft:landing_obsidian_tear"), - REVERSE_PORTAL(74, "minecraft:reverse_portal"), - WHITE_ASH(75, "minecraft:white_ash"), - SMALL_FLAME(76, "minecraft:small_flame"), - SNOWFLAKE(77, "minecraft:snowflake"), - DRIPPING_DRIPSTONE_LAVA(78, "minecraft:dripping_dripstone_lava"), - FALLING_DRIPSTONE_LAVA(79, "minecraft:falling_dripstone_lava"), - DRIPPING_DRIPSTONE_WATER(80, "minecraft:dripping_dripstone_water"), - FALLING_DRIPSTONE_WATER(81, "minecraft:falling_dripstone_water"), - GLOW_SQUID_INK(82, "minecraft:glow_squid_ink"), - GLOW(83, "minecraft:glow"), - WAX_ON(84, "minecraft:wax_on"), - WAX_OFF(85, "minecraft:wax_off"), - ELECTRIC_SPARK(86, "minecraft:electric_spark"), - SCRAPE(87, "minecraft:scrape"), -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/Packet.kt b/src/main/kotlin/io/layercraft/packetlib/packets/Packet.kt new file mode 100644 index 0000000..903a190 --- /dev/null +++ b/src/main/kotlin/io/layercraft/packetlib/packets/Packet.kt @@ -0,0 +1,14 @@ +package io.layercraft.packetlib.packets + +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer + +interface Packet +interface ServerBoundPacket : Packet +interface ClientBoundPacket : Packet + +interface PacketSerializer where T : Packet { + fun deserialize(input: MCProtocolDeserializer<*>): T + + fun serialize(output: MCProtocolSerializer<*>, value: T) +} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/PacketInterface.kt b/src/main/kotlin/io/layercraft/packetlib/packets/PacketInterface.kt deleted file mode 100644 index 0b61f0b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/PacketInterface.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets - -import io.layercraft.packetlib.codec.MinecraftCodec -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -interface Packet { - val bound: PacketDirection - - fun codecPacket(codec: MinecraftCodec) = codec.getCodecPacketFromPacket(this) -} - -interface ServerBoundPacket : Packet { - override val bound: PacketDirection - get() = PacketDirection.SERVERBOUND -} -interface ClientBoundPacket : Packet { - override val bound: PacketDirection - get() = PacketDirection.CLIENTBOUND -} - -interface PacketSerializer where T : Packet { - fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): T - - fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: T) -} - -@Target(AnnotationTarget.CLASS) -annotation class MinecraftPacket(val id: Int, val state: PacketState, val direction: PacketDirection) - -enum class PacketDirection { - SERVERBOUND, CLIENTBOUND, -} - -enum class PacketState { - HANDSHAKING, STATUS, LOGIN, PLAY, -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/LegacyServerListPingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/LegacyServerListPingPacket.kt deleted file mode 100644 index 45511e5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/LegacyServerListPingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Legacy Server List Ping | 0xfe | handshaking | serverbound - * - * @param payload payload - * @see https://wiki.vg/Protocol#Legacy_Server_List_Ping - */ - -@MinecraftPacket(id = 0xfe, state = PacketState.HANDSHAKING, direction = PacketDirection.SERVERBOUND) -data class LegacyServerListPingPacket( - val payload: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LegacyServerListPingPacket { - val payload = input.readUByte() - - return LegacyServerListPingPacket(payload) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LegacyServerListPingPacket) { - output.writeUByte(value.payload) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/SetProtocolPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/SetProtocolPacket.kt deleted file mode 100644 index b811474..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/handshaking/serverbound/SetProtocolPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Handshake | 0x00 | handshaking | serverbound - * - * @param protocolVersion protocolVersion - * @param serverHost serverHost - * @param serverPort serverPort - * @param nextState nextState - * @see https://wiki.vg/Protocol#Handshake - */ - -@MinecraftPacket(id = 0x00, state = PacketState.HANDSHAKING, direction = PacketDirection.SERVERBOUND) -data class SetProtocolPacket( - val protocolVersion: Int, // varint - val serverHost: String, - val serverPort: UShort, - val nextState: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetProtocolPacket { - val protocolVersion = input.readVarInt() - val serverHost = input.readString() - val serverPort = input.readUShort() - val nextState = input.readVarInt() - - return SetProtocolPacket(protocolVersion, serverHost, serverPort, nextState) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetProtocolPacket) { - output.writeVarInt(value.protocolVersion) - output.writeString(value.serverHost) - output.writeUShort(value.serverPort) - output.writeVarInt(value.nextState) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/CompressPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/CompressPacket.kt deleted file mode 100644 index ed31fa8..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/CompressPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Compression | 0x03 | login | clientbound - * - * @param threshold threshold - * @see https://wiki.vg/Protocol#Set_Compression - */ - -@MinecraftPacket(id = 0x03, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) -data class CompressPacket( - val threshold: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CompressPacket { - val threshold = input.readVarInt() - - return CompressPacket(threshold) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CompressPacket) { - output.writeVarInt(value.threshold) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/DisconnectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/DisconnectPacket.kt deleted file mode 100644 index e5307b3..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/DisconnectPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Disconnect (login) | 0x00 | login | clientbound - * - * @param reason reason - * @see https://wiki.vg/Protocol#Disconnect_.28login.29 - */ - -@MinecraftPacket(id = 0x00, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) -data class DisconnectPacket( - val reason: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DisconnectPacket { - val reason = input.readString() - - return DisconnectPacket(reason) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DisconnectPacket) { - output.writeString(value.reason) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/EncryptionBeginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/EncryptionBeginPacket.kt deleted file mode 100644 index ea18d37..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/EncryptionBeginPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Encryption Request | 0x01 | login | clientbound - * - * @param serverId serverId - * @param publicKey publicKey - * @param verifyToken verifyToken - * @see https://wiki.vg/Protocol#Encryption_Request - */ - -@MinecraftPacket(id = 0x01, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) -data class EncryptionBeginPacket( - val serverId: String, - val publicKey: ByteArray, - val verifyToken: ByteArray, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EncryptionBeginPacket { - val serverId = input.readString() - val publicKey = input.readVarIntByteArray() - val verifyToken = input.readVarIntByteArray() - - return EncryptionBeginPacket(serverId, publicKey, verifyToken) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EncryptionBeginPacket) { - output.writeString(value.serverId) - output.writeVarIntByteArray(value.publicKey) - output.writeVarIntByteArray(value.verifyToken) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/LoginPluginRequestPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/LoginPluginRequestPacket.kt deleted file mode 100644 index 565190a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/LoginPluginRequestPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Login Plugin Request | 0x04 | login | clientbound - * - * @param messageId messageId - * @param channel channel - * @param data data - * @see https://wiki.vg/Protocol#Login_Plugin_Request - */ - -@MinecraftPacket(id = 0x04, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) -data class LoginPluginRequestPacket( - val messageId: Int, // varint - val channel: String, - val data: ByteArray, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPluginRequestPacket { - val messageId = input.readVarInt() - val channel = input.readString() - val data = input.readRemainingByteArray() - - return LoginPluginRequestPacket(messageId, channel, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPluginRequestPacket) { - output.writeVarInt(value.messageId) - output.writeString(value.channel) - output.writeRemainingByteArray(value.data) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/SuccessPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/SuccessPacket.kt deleted file mode 100644 index 35d8cad..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/clientbound/SuccessPacket.kt +++ /dev/null @@ -1,65 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Login Success | 0x02 | login | clientbound - * - * @param uuid uuid - * @param username username - * @param properties list of SuccessPacketProperties - * @see https://wiki.vg/Protocol#Login_Success - */ - -@MinecraftPacket(id = 0x02, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) -data class SuccessPacket( - val uuid: UUID, - val username: String, - val properties: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SuccessPacket { - val uuid = input.readUUID() - val username = input.readString() - val properties = input.readVarIntArray { arrayInput -> - val name = arrayInput.readString() - val value = arrayInput.readString() - val hasSignature = arrayInput.readBoolean() - val signature = if (hasSignature) arrayInput.readString() else null - - return@readVarIntArray SuccessPacketProperties(name, value, hasSignature, signature) - } - - return SuccessPacket(uuid, username, properties) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SuccessPacket) { - output.writeUUID(value.uuid) - output.writeString(value.username) - - output.writeVarIntArray(value.properties) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.name) - arrayOutput.writeString(arrayValue.value) - arrayOutput.writeBoolean(arrayValue.hasSignature) - if (arrayValue.hasSignature) arrayOutput.writeString(arrayValue.signature!!) - } - } - } -} - -/** - * SuccessPacketProperties - * - * @param name name - * @param value value - * @param hasSignature signature is present - * @param signature signature -*/ -data class SuccessPacketProperties( - val name: String, - val value: String, - val hasSignature: Boolean, - val signature: String?, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/EncryptionBeginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/EncryptionBeginPacket.kt deleted file mode 100644 index 55fac7d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/EncryptionBeginPacket.kt +++ /dev/null @@ -1,63 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Encryption Response | 0x01 | login | serverbound - * - * @param sharedSecret sharedSecret - * @param hasVerifyToken hasVerifyToken - * @param verifyToken verifyToken - * @param salt salt - * @param messageSignature messageSignature - * @see https://wiki.vg/Protocol#Encryption_Response - */ - -@MinecraftPacket(id = 0x01, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) -data class EncryptionBeginPacket( - val sharedSecret: ByteArray, - val hasVerifyToken: Boolean, - val verifyToken: ByteArray?, - val salt: Long?, - val messageSignature: ByteArray?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EncryptionBeginPacket { - val sharedSecret = input.readVarIntByteArray() - val hasVerifyToken = input.readBoolean() - val verifyToken = when (hasVerifyToken) { - true -> input.readVarIntByteArray() - else -> null - } - val salt = when (hasVerifyToken) { - false -> input.readLong() - else -> null - } - val messageSignature = when (hasVerifyToken) { - false -> input.readVarIntByteArray() - else -> null - } - - return EncryptionBeginPacket(sharedSecret, hasVerifyToken, verifyToken, salt, messageSignature) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EncryptionBeginPacket) { - output.writeVarIntByteArray(value.sharedSecret) - output.writeBoolean(value.hasVerifyToken) - when (value.hasVerifyToken) { - true -> output.writeVarIntByteArray(value.verifyToken!!) - else -> {} - } - when (value.hasVerifyToken) { - false -> output.writeLong(value.salt!!) - else -> {} - } - when (value.hasVerifyToken) { - false -> output.writeVarIntByteArray(value.messageSignature!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginPluginResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginPluginResponsePacket.kt deleted file mode 100644 index baf900d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginPluginResponsePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Login Plugin Response | 0x02 | login | serverbound - * - * @param messageId messageId - * @param hasData data is present - * @param data data - * @see https://wiki.vg/Protocol#Login_Plugin_Response - */ - -@MinecraftPacket(id = 0x02, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) -data class LoginPluginResponsePacket( - val messageId: Int, // varint - val hasData: Boolean, - val data: ByteArray?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPluginResponsePacket { - val messageId = input.readVarInt() - val hasData = input.readBoolean() - val data = if (hasData) input.readRemainingByteArray() else null - - return LoginPluginResponsePacket(messageId, hasData, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPluginResponsePacket) { - output.writeVarInt(value.messageId) - output.writeBoolean(value.hasData) - if (value.hasData) output.writeRemainingByteArray(value.data!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginStartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginStartPacket.kt deleted file mode 100644 index 0a04858..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/login/serverbound/LoginStartPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.login.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Login Start | 0x00 | login | serverbound - * - * @param username username - * @param hasSignature signature is present - * @param timestamp timestamp - * @param publicKey publicKey - * @param signature signature - * @param hasPlayerUUID playerUUID is present - * @param playerUUID playerUUID - * @see https://wiki.vg/Protocol#Login_Start - */ - -@MinecraftPacket(id = 0x00, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) -data class LoginStartPacket( - val username: String, - val hasSignature: Boolean, - val timestamp: Long?, - val publicKey: ByteArray?, - val signature: ByteArray?, - val hasPlayerUUID: Boolean, - val playerUUID: UUID?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginStartPacket { - val username = input.readString() - val hasSignature = input.readBoolean() - val timestamp = if (hasSignature) input.readLong() else null - val publicKey = if (hasSignature) input.readVarIntByteArray() else null - val signature = if (hasSignature) input.readVarIntByteArray() else null - val hasPlayerUUID = input.readBoolean() - val playerUUID = if (hasPlayerUUID) input.readUUID() else null - - return LoginStartPacket(username, hasSignature, timestamp, publicKey, signature, hasPlayerUUID, playerUUID) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginStartPacket) { - output.writeString(value.username) - output.writeBoolean(value.hasSignature) - if (value.hasSignature) output.writeLong(value.timestamp!!) - if (value.hasSignature) output.writeVarIntByteArray(value.publicKey!!) - if (value.hasSignature) output.writeVarIntByteArray(value.signature!!) - output.writeBoolean(value.hasPlayerUUID) - if (value.hasPlayerUUID) output.writeUUID(value.playerUUID!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AbilitiesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AbilitiesPacket.kt deleted file mode 100644 index 5f324bf..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AbilitiesPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Player Abilities (clientbound) | 0x31 | play | clientbound - * - * @param flags flags - * @param flyingSpeed flyingSpeed - * @param walkingSpeed walkingSpeed - * @see https://wiki.vg/Protocol#Player_Abilities_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x31, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class AbilitiesPacket( - val flags: Byte, - val flyingSpeed: Float, - val walkingSpeed: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AbilitiesPacket { - val flags = input.readByte() - val flyingSpeed = input.readFloat() - val walkingSpeed = input.readFloat() - - return AbilitiesPacket(flags, flyingSpeed, walkingSpeed) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AbilitiesPacket) { - output.writeByte(value.flags) - output.writeFloat(value.flyingSpeed) - output.writeFloat(value.walkingSpeed) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AcknowledgePlayerDiggingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AcknowledgePlayerDiggingPacket.kt deleted file mode 100644 index a7f961c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AcknowledgePlayerDiggingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Acknowledge Block Change | 0x05 | play | clientbound - * - * @param sequenceId sequenceId - * @see https://wiki.vg/Protocol#Acknowledge_Block_Change - */ - -@MinecraftPacket(id = 0x05, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class AcknowledgePlayerDiggingPacket( - val sequenceId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AcknowledgePlayerDiggingPacket { - val sequenceId = input.readVarInt() - - return AcknowledgePlayerDiggingPacket(sequenceId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AcknowledgePlayerDiggingPacket) { - output.writeVarInt(value.sequenceId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ActionBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ActionBarPacket.kt deleted file mode 100644 index 1ec43e5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ActionBarPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Action Bar Text | 0x43 | play | clientbound - * - * @param text text - * @see https://wiki.vg/Protocol#Set_Action_Bar_Text - */ - -@MinecraftPacket(id = 0x43, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ActionBarPacket( - val text: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ActionBarPacket { - val text = input.readString() - - return ActionBarPacket(text) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ActionBarPacket) { - output.writeString(value.text) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AdvancementsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AdvancementsPacket.kt deleted file mode 100644 index e8ddceb..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AdvancementsPacket.kt +++ /dev/null @@ -1,159 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Advancements | 0x67 | play | clientbound - * - * @param reset reset - * @param advancementMapping list of AdvancementsPacketAdvancementMapping - * @param identifiers identifiers - * @param progressMapping list of AdvancementsPacketProgressMapping - * @see https://wiki.vg/Protocol#Update_Advancements - */ - -@MinecraftPacket(id = 0x67, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class AdvancementsPacket( - val reset: Boolean, - val advancementMapping: List, // varint array - val identifiers: List, // varint array - val progressMapping: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AdvancementsPacket { - val reset = input.readBoolean() - val advancementMapping = input.readVarIntArray { arrayInput -> - val key = arrayInput.readString() - val hasParentId = arrayInput.readBoolean() - val parentId = if (hasParentId) arrayInput.readString() else null - val hasDisplayData = arrayInput.readBoolean() - val title = if (hasDisplayData) arrayInput.readString() else null - val description = if (hasDisplayData) arrayInput.readString() else null - val frameType = if (hasDisplayData) arrayInput.readVarInt() else null - val xCord = if (hasDisplayData) arrayInput.readFloat() else null - val yCord = if (hasDisplayData) arrayInput.readFloat() else null - val criteria = arrayInput.readVarIntArray { arrayInput -> - val key = arrayInput.readString() - - return@readVarIntArray AdvancementsPacketCriteria(key) - } - val requirements = arrayInput.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readString() } } - - return@readVarIntArray AdvancementsPacketAdvancementMapping(key, hasParentId, parentId, hasDisplayData, title, description, frameType, xCord, yCord, criteria, requirements) - } - val identifiers = input.readVarIntArray { arrayInput -> arrayInput.readString() } - val progressMapping = input.readVarIntArray { arrayInput -> - val key = arrayInput.readString() - val value = arrayInput.readVarIntArray { arrayInput1 -> - val criterionIdentifier = arrayInput1.readString() - val hasCriterionProgress = arrayInput1.readBoolean() - val criterionProgress = if (hasCriterionProgress) arrayInput1.readLong() else null - - return@readVarIntArray AdvancementsPacketValue(criterionIdentifier, hasCriterionProgress, criterionProgress) - } - - return@readVarIntArray AdvancementsPacketProgressMapping(key, value) - } - - return AdvancementsPacket(reset, advancementMapping, identifiers, progressMapping) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AdvancementsPacket) { - output.writeBoolean(value.reset) - - output.writeVarIntArray(value.advancementMapping) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.key) - arrayOutput.writeBoolean(arrayValue.hasParentId) - if (arrayValue.hasParentId) arrayOutput.writeString(arrayValue.parentId!!) - arrayOutput.writeBoolean(arrayValue.hasDisplayData) - if (arrayValue.hasDisplayData) arrayOutput.writeString(arrayValue.title!!) - if (arrayValue.hasDisplayData) arrayOutput.writeString(arrayValue.description!!) - if (arrayValue.hasDisplayData) arrayOutput.writeVarInt(arrayValue.frameType!!) - if (arrayValue.hasDisplayData) arrayOutput.writeFloat(arrayValue.xCord!!) - if (arrayValue.hasDisplayData) arrayOutput.writeFloat(arrayValue.yCord!!) - - arrayOutput.writeVarIntArray(arrayValue.criteria) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.key) - } - - arrayOutput.writeVarIntArray(arrayValue.requirements) { arrayValue1, arrayOutput1 -> arrayOutput1.writeVarIntArray(arrayValue1) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } } - } - - output.writeVarIntArray(value.identifiers) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - - output.writeVarIntArray(value.progressMapping) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.key) - - arrayOutput.writeVarIntArray(arrayValue.value) { arrayValue1, arrayOutput1 -> - arrayOutput1.writeString(arrayValue1.criterionIdentifier) - arrayOutput1.writeBoolean(arrayValue1.hasCriterionProgress) - if (arrayValue1.hasCriterionProgress) arrayOutput1.writeLong(arrayValue1.criterionProgress!!) - } - } - } - } -} - -/** - * AdvancementsPacketCriteria - * - * @param key key -*/ -data class AdvancementsPacketCriteria( - val key: String, -) - -/** - * AdvancementsPacketAdvancementMapping - * - * @param key key - * @param hasParentId parentId is present - * @param parentId parentId - * @param hasDisplayData displayData is present - * @param title title - * @param description description - * @param frameType frameType - * @param xCord xCord - * @param yCord yCord - * @param criteria list of AdvancementsPacketCriteria - * @param requirements requirements -*/ -data class AdvancementsPacketAdvancementMapping( - val key: String, - val hasParentId: Boolean, - val parentId: String?, - val hasDisplayData: Boolean, - val title: String?, - val description: String?, - val frameType: Int?, // varint - val xCord: Float?, - val yCord: Float?, - val criteria: List, // varint array - val requirements: List>, // varint array -) - -/** - * AdvancementsPacketValue - * - * @param criterionIdentifier criterionIdentifier - * @param hasCriterionProgress criterionProgress is present - * @param criterionProgress criterionProgress -*/ -data class AdvancementsPacketValue( - val criterionIdentifier: String, - val hasCriterionProgress: Boolean, - val criterionProgress: Long?, -) - -/** - * AdvancementsPacketProgressMapping - * - * @param key key - * @param value list of AdvancementsPacketValue -*/ -data class AdvancementsPacketProgressMapping( - val key: String, - val value: List, // varint array -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AnimationPacket.kt deleted file mode 100644 index 8265721..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AnimationPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Entity Animation (clientbound) | 0x03 | play | clientbound - * - * @param entityId entityId - * @param animation animation - * @see https://wiki.vg/Protocol#Entity_Animation_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x03, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class AnimationPacket( - val entityId: Int, // varint - val animation: UByte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AnimationPacket { - val entityId = input.readVarInt() - val animation = input.readUByte() - - return AnimationPacket(entityId, animation) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AnimationPacket) { - output.writeVarInt(value.entityId) - output.writeUByte(value.animation) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AttachEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AttachEntityPacket.kt deleted file mode 100644 index a2e7bc7..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/AttachEntityPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Link Entities | 0x51 | play | clientbound - * - * @param entityId entityId - * @param vehicleId vehicleId - * @see https://wiki.vg/Protocol#Link_Entities - */ - -@MinecraftPacket(id = 0x51, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class AttachEntityPacket( - val entityId: Int, - val vehicleId: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AttachEntityPacket { - val entityId = input.readInt() - val vehicleId = input.readInt() - - return AttachEntityPacket(entityId, vehicleId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AttachEntityPacket) { - output.writeInt(value.entityId) - output.writeInt(value.vehicleId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockActionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockActionPacket.kt deleted file mode 100644 index 96d6b13..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockActionPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Block Action | 0x08 | play | clientbound - * - * @param location location - * @param byte1 byte1 - * @param byte2 byte2 - * @param blockId blockId - * @see https://wiki.vg/Protocol#Block_Action - */ - -@MinecraftPacket(id = 0x08, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class BlockActionPacket( - val location: Position, - val byte1: UByte, - val byte2: UByte, - val blockId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockActionPacket { - val location = input.readPosition() - val byte1 = input.readUByte() - val byte2 = input.readUByte() - val blockId = input.readVarInt() - - return BlockActionPacket(location, byte1, byte2, blockId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockActionPacket) { - output.writePosition(value.location) - output.writeUByte(value.byte1) - output.writeUByte(value.byte2) - output.writeVarInt(value.blockId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockBreakAnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockBreakAnimationPacket.kt deleted file mode 100644 index 46256cc..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockBreakAnimationPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Set Block Destroy Stage | 0x06 | play | clientbound - * - * @param entityId entityId - * @param location location - * @param destroyStage destroyStage - * @see https://wiki.vg/Protocol#Set_Block_Destroy_Stage - */ - -@MinecraftPacket(id = 0x06, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class BlockBreakAnimationPacket( - val entityId: Int, // varint - val location: Position, - val destroyStage: Byte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockBreakAnimationPacket { - val entityId = input.readVarInt() - val location = input.readPosition() - val destroyStage = input.readByte() - - return BlockBreakAnimationPacket(entityId, location, destroyStage) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockBreakAnimationPacket) { - output.writeVarInt(value.entityId) - output.writePosition(value.location) - output.writeByte(value.destroyStage) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockChangePacket.kt deleted file mode 100644 index b6b11c3..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BlockChangePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Block Update | 0x09 | play | clientbound - * - * @param location location - * @param type type - * @see https://wiki.vg/Protocol#Block_Update - */ - -@MinecraftPacket(id = 0x09, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class BlockChangePacket( - val location: Position, - val type: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockChangePacket { - val location = input.readPosition() - val type = input.readVarInt() - - return BlockChangePacket(location, type) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockChangePacket) { - output.writePosition(value.location) - output.writeVarInt(value.type) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BossBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BossBarPacket.kt deleted file mode 100644 index 99d0280..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/BossBarPacket.kt +++ /dev/null @@ -1,93 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Boss Bar | 0x0a | play | clientbound - * - * @param entityUUID entityUUID - * @param action action - * @param title title - * @param health health - * @param color color - * @param dividers dividers - * @param flags flags - * @see https://wiki.vg/Protocol#Boss_Bar - */ - -@MinecraftPacket(id = 0x0a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class BossBarPacket( - val entityUUID: UUID, - val action: Int, // varint - val title: String?, - val health: Float?, - val color: Int?, // varint - val dividers: Int?, // varint - val flags: UByte?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BossBarPacket { - val entityUUID = input.readUUID() - val action = input.readVarInt() - val title = when (action) { - 0 -> input.readString() - 3 -> input.readString() - else -> null - } - val health = when (action) { - 0 -> input.readFloat() - 2 -> input.readFloat() - else -> null - } - val color = when (action) { - 0 -> input.readVarInt() - 4 -> input.readVarInt() - else -> null - } - val dividers = when (action) { - 0 -> input.readVarInt() - 4 -> input.readVarInt() - else -> null - } - val flags = when (action) { - 0 -> input.readUByte() - 5 -> input.readUByte() - else -> null - } - - return BossBarPacket(entityUUID, action, title, health, color, dividers, flags) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BossBarPacket) { - output.writeUUID(value.entityUUID) - output.writeVarInt(value.action) - when (value.action) { - 0 -> output.writeString(value.title!!) - 3 -> output.writeString(value.title!!) - else -> {} - } - when (value.action) { - 0 -> output.writeFloat(value.health!!) - 2 -> output.writeFloat(value.health!!) - else -> {} - } - when (value.action) { - 0 -> output.writeVarInt(value.color!!) - 4 -> output.writeVarInt(value.color!!) - else -> {} - } - when (value.action) { - 0 -> output.writeVarInt(value.dividers!!) - 4 -> output.writeVarInt(value.dividers!!) - else -> {} - } - when (value.action) { - 0 -> output.writeUByte(value.flags!!) - 5 -> output.writeUByte(value.flags!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CameraPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CameraPacket.kt deleted file mode 100644 index 643fa13..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CameraPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Camera | 0x49 | play | clientbound - * - * @param cameraId cameraId - * @see https://wiki.vg/Protocol#Set_Camera - */ - -@MinecraftPacket(id = 0x49, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CameraPacket( - val cameraId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CameraPacket { - val cameraId = input.readVarInt() - - return CameraPacket(cameraId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CameraPacket) { - output.writeVarInt(value.cameraId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatPreviewPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatPreviewPacket.kt deleted file mode 100644 index b1a46c0..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatPreviewPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Chat Preview (clientbound) | 0x0c | play | clientbound - * - * @param queryId queryId - * @param hasMessage message is present - * @param message message - * @see https://wiki.vg/Protocol#Chat_Preview_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x0c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ChatPreviewPacket( - val queryId: Int, - val hasMessage: Boolean, - val message: String?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatPreviewPacket { - val queryId = input.readInt() - val hasMessage = input.readBoolean() - val message = if (hasMessage) input.readString() else null - - return ChatPreviewPacket(queryId, hasMessage, message) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatPreviewPacket) { - output.writeInt(value.queryId) - output.writeBoolean(value.hasMessage) - if (value.hasMessage) output.writeString(value.message!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatSuggestionsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatSuggestionsPacket.kt deleted file mode 100644 index 87d9fac..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ChatSuggestionsPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Chat Suggestions | 0x15 | play | clientbound - * - * @param action action - * @param entries entries - * @see https://wiki.vg/Protocol#Chat_Suggestions - */ - -@MinecraftPacket(id = 0x15, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ChatSuggestionsPacket( - val action: Int, // varint - val entries: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatSuggestionsPacket { - val action = input.readVarInt() - val entries = input.readVarIntArray { arrayInput -> arrayInput.readString() } - - return ChatSuggestionsPacket(action, entries) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatSuggestionsPacket) { - output.writeVarInt(value.action) - output.writeVarIntArray(value.entries) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ClearTitlesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ClearTitlesPacket.kt deleted file mode 100644 index 881c8ec..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ClearTitlesPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Clear Titles | 0x0d | play | clientbound - * - * @param reset reset - * @see https://wiki.vg/Protocol#Clear_Titles - */ - -@MinecraftPacket(id = 0x0d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ClearTitlesPacket( - val reset: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ClearTitlesPacket { - val reset = input.readBoolean() - - return ClearTitlesPacket(reset) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ClearTitlesPacket) { - output.writeBoolean(value.reset) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CloseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CloseWindowPacket.kt deleted file mode 100644 index 09721ff..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CloseWindowPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Close Container (clientbound) | 0x10 | play | clientbound - * - * @param windowId windowId - * @see https://wiki.vg/Protocol#Close_Container_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x10, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CloseWindowPacket( - val windowId: UByte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CloseWindowPacket { - val windowId = input.readUByte() - - return CloseWindowPacket(windowId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CloseWindowPacket) { - output.writeUByte(value.windowId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CollectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CollectPacket.kt deleted file mode 100644 index 1517811..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CollectPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Pickup Item | 0x65 | play | clientbound - * - * @param collectedEntityId collectedEntityId - * @param collectorEntityId collectorEntityId - * @param pickupItemCount pickupItemCount - * @see https://wiki.vg/Protocol#Pickup_Item - */ - -@MinecraftPacket(id = 0x65, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CollectPacket( - val collectedEntityId: Int, // varint - val collectorEntityId: Int, // varint - val pickupItemCount: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CollectPacket { - val collectedEntityId = input.readVarInt() - val collectorEntityId = input.readVarInt() - val pickupItemCount = input.readVarInt() - - return CollectPacket(collectedEntityId, collectorEntityId, pickupItemCount) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CollectPacket) { - output.writeVarInt(value.collectedEntityId) - output.writeVarInt(value.collectorEntityId) - output.writeVarInt(value.pickupItemCount) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftProgressBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftProgressBarPacket.kt deleted file mode 100644 index 88935d8..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftProgressBarPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Container Property | 0x12 | play | clientbound - * - * @param windowId windowId - * @param property property - * @param value value - * @see https://wiki.vg/Protocol#Set_Container_Property - */ - -@MinecraftPacket(id = 0x12, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CraftProgressBarPacket( - val windowId: UByte, - val property: Short, - val value: Short, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftProgressBarPacket { - val windowId = input.readUByte() - val property = input.readShort() - val value = input.readShort() - - return CraftProgressBarPacket(windowId, property, value) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftProgressBarPacket) { - output.writeUByte(value.windowId) - output.writeShort(value.property) - output.writeShort(value.value) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftRecipeResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftRecipeResponsePacket.kt deleted file mode 100644 index 59b937e..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CraftRecipeResponsePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Place Ghost Recipe | 0x30 | play | clientbound - * - * @param windowId windowId - * @param recipe recipe - * @see https://wiki.vg/Protocol#Place_Ghost_Recipe - */ - -@MinecraftPacket(id = 0x30, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CraftRecipeResponsePacket( - val windowId: Byte, - val recipe: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftRecipeResponsePacket { - val windowId = input.readByte() - val recipe = input.readString() - - return CraftRecipeResponsePacket(windowId, recipe) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftRecipeResponsePacket) { - output.writeByte(value.windowId) - output.writeString(value.recipe) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CustomPayloadPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CustomPayloadPacket.kt deleted file mode 100644 index 9358b9a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/CustomPayloadPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Plugin Message (clientbound) | 0x16 | play | clientbound - * - * @param channel channel - * @param data data - * @see https://wiki.vg/Protocol#Plugin_Message_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x16, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class CustomPayloadPacket( - val channel: String, - val data: ByteArray, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CustomPayloadPacket { - val channel = input.readString() - val data = input.readRemainingByteArray() - - return CustomPayloadPacket(channel, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CustomPayloadPacket) { - output.writeString(value.channel) - output.writeRemainingByteArray(value.data) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeathCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeathCombatEventPacket.kt deleted file mode 100644 index b92c954..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeathCombatEventPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Combat Death | 0x36 | play | clientbound - * - * @param playerId playerId - * @param entityId entityId - * @param message message - * @see https://wiki.vg/Protocol#Combat_Death - */ - -@MinecraftPacket(id = 0x36, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class DeathCombatEventPacket( - val playerId: Int, // varint - val entityId: Int, - val message: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DeathCombatEventPacket { - val playerId = input.readVarInt() - val entityId = input.readInt() - val message = input.readString() - - return DeathCombatEventPacket(playerId, entityId, message) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DeathCombatEventPacket) { - output.writeVarInt(value.playerId) - output.writeInt(value.entityId) - output.writeString(value.message) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareCommandsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareCommandsPacket.kt deleted file mode 100644 index 80bcc32..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareCommandsPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Commands | 0x0f | play | clientbound - * - * @param rootIndex rootIndex - * @see https://wiki.vg/Protocol#Commands - */ - -@MinecraftPacket(id = 0x0f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class DeclareCommandsPacket( - val rootIndex: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DeclareCommandsPacket { - val rootIndex = input.readVarInt() - - return DeclareCommandsPacket(rootIndex) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DeclareCommandsPacket) { - output.writeVarInt(value.rootIndex) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareRecipesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareRecipesPacket.kt deleted file mode 100644 index 6318c9b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DeclareRecipesPacket.kt +++ /dev/null @@ -1,100 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Recipes | 0x6a | play | clientbound - * - * @param recipes list of DeclareRecipesPacketRecipes - * @see https://wiki.vg/Protocol#Update_Recipes - */ - -@MinecraftPacket(id = 0x6a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class DeclareRecipesPacket( - val recipes: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DeclareRecipesPacket { - val recipes = input.readVarIntArray { arrayInput -> - val type = arrayInput.readString() - val recipeId = arrayInput.readString() - val group = when (type) { - "minecraft:crafting_shapeless" -> arrayInput.readString() - "minecraft:crafting_shaped" -> arrayInput.readString() - "minecraft:stonecutting" -> arrayInput.readString() - else -> null - } - val width = when (type) { - "minecraft:crafting_shaped" -> arrayInput.readVarInt() - else -> null - } - val height = when (type) { - "minecraft:crafting_shaped" -> arrayInput.readVarInt() - else -> null - } - - return@readVarIntArray DeclareRecipesPacketRecipes(type, recipeId, group, width, height) - } - - return DeclareRecipesPacket(recipes) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DeclareRecipesPacket) { - output.writeVarIntArray(value.recipes) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.type) - arrayOutput.writeString(arrayValue.recipeId) - when (arrayValue.type) { - "minecraft:crafting_shapeless" -> arrayOutput.writeString(arrayValue.group!!) - "minecraft:crafting_shaped" -> arrayOutput.writeString(arrayValue.group!!) - "minecraft:stonecutting" -> arrayOutput.writeString(arrayValue.group!!) - else -> {} - } - when (arrayValue.type) { - else -> {} - } - when (arrayValue.type) { - else -> {} - } - when (arrayValue.type) { - "minecraft:crafting_shaped" -> arrayOutput.writeVarInt(arrayValue.width!!) - else -> {} - } - when (arrayValue.type) { - "minecraft:crafting_shaped" -> arrayOutput.writeVarInt(arrayValue.height!!) - else -> {} - } - when (arrayValue.type) { - else -> {} - } - when (arrayValue.type) { - else -> {} - } - when (arrayValue.type) { - else -> {} - } - when (arrayValue.type) { - else -> {} - } - } - } - } -} - -/** - * DeclareRecipesPacketRecipes - * - * @param type type - * @param recipeId recipeId - * @param group group - * @param width width - * @param height height -*/ -data class DeclareRecipesPacketRecipes( - val type: String, - val recipeId: String, - val group: String?, - val width: Int?, // varint - val height: Int?, // varint -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DifficultyPacket.kt deleted file mode 100644 index 367fb96..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/DifficultyPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Change Difficulty | 0x0b | play | clientbound - * - * @param difficulty difficulty - * @param difficultyLocked difficultyLocked - * @see https://wiki.vg/Protocol#Change_Difficulty - */ - -@MinecraftPacket(id = 0x0b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class DifficultyPacket( - val difficulty: UByte, - val difficultyLocked: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DifficultyPacket { - val difficulty = input.readUByte() - val difficultyLocked = input.readBoolean() - - return DifficultyPacket(difficulty, difficultyLocked) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DifficultyPacket) { - output.writeUByte(value.difficulty) - output.writeBoolean(value.difficultyLocked) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EndCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EndCombatEventPacket.kt deleted file mode 100644 index e87984c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EndCombatEventPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * End Combat | 0x34 | play | clientbound - * - * @param duration duration - * @param entityId entityId - * @see https://wiki.vg/Protocol#End_Combat - */ - -@MinecraftPacket(id = 0x34, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EndCombatEventPacket( - val duration: Int, // varint - val entityId: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EndCombatEventPacket { - val duration = input.readVarInt() - val entityId = input.readInt() - - return EndCombatEventPacket(duration, entityId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EndCombatEventPacket) { - output.writeVarInt(value.duration) - output.writeInt(value.entityId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EnterCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EnterCombatEventPacket.kt deleted file mode 100644 index 5f91c75..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EnterCombatEventPacket.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Enter Combat | 0x35 | play | clientbound - * - - * @see https://wiki.vg/Protocol#Enter_Combat - */ - -@MinecraftPacket(id = 0x35, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -class EnterCombatEventPacket() : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EnterCombatEventPacket { - return EnterCombatEventPacket() - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EnterCombatEventPacket) { - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityDestroyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityDestroyPacket.kt deleted file mode 100644 index a82ab6f..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityDestroyPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Remove Entities | 0x3b | play | clientbound - * - * @param entityIds entityIds - * @see https://wiki.vg/Protocol#Remove_Entities - */ - -@MinecraftPacket(id = 0x3b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityDestroyPacket( - val entityIds: List, // varint array of varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityDestroyPacket { - val entityIds = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } - - return EntityDestroyPacket(entityIds) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityDestroyPacket) { - output.writeVarIntArray(value.entityIds) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEffectPacket.kt deleted file mode 100644 index c10d7b8..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEffectPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.NBT -/** - * Entity Effect | 0x69 | play | clientbound - * - * @param entityId entityId - * @param effectId effectId - * @param amplifier amplifier - * @param duration duration - * @param hideParticles hideParticles - * @param hasFactorCodec factorCodec is present - * @param factorCodec factorCodec - * @see https://wiki.vg/Protocol#Entity_Effect - */ - -@MinecraftPacket(id = 0x69, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityEffectPacket( - val entityId: Int, // varint - val effectId: Int, // varint - val amplifier: Byte, - val duration: Int, // varint - val hideParticles: Byte, - val hasFactorCodec: Boolean, - val factorCodec: NBT?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityEffectPacket { - val entityId = input.readVarInt() - val effectId = input.readVarInt() - val amplifier = input.readByte() - val duration = input.readVarInt() - val hideParticles = input.readByte() - val hasFactorCodec = input.readBoolean() - val factorCodec = if (hasFactorCodec) input.readNbt() else null - - return EntityEffectPacket(entityId, effectId, amplifier, duration, hideParticles, hasFactorCodec, factorCodec) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityEffectPacket) { - output.writeVarInt(value.entityId) - output.writeVarInt(value.effectId) - output.writeByte(value.amplifier) - output.writeVarInt(value.duration) - output.writeByte(value.hideParticles) - output.writeBoolean(value.hasFactorCodec) - if (value.hasFactorCodec) output.writeNbt(value.factorCodec!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEquipmentPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEquipmentPacket.kt deleted file mode 100644 index cec658c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityEquipmentPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Equipment | 0x53 | play | clientbound - * - * @param entityId entityId - * @see https://wiki.vg/Protocol#Set_Equipment - */ - -@MinecraftPacket(id = 0x53, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityEquipmentPacket( - val entityId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityEquipmentPacket { - val entityId = input.readVarInt() - - return EntityEquipmentPacket(entityId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityEquipmentPacket) { - output.writeVarInt(value.entityId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityHeadRotationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityHeadRotationPacket.kt deleted file mode 100644 index 8ee8e1a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityHeadRotationPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Head Rotation | 0x3f | play | clientbound - * - * @param entityId entityId - * @param headYaw headYaw - * @see https://wiki.vg/Protocol#Set_Head_Rotation - */ - -@MinecraftPacket(id = 0x3f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityHeadRotationPacket( - val entityId: Int, // varint - val headYaw: Byte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityHeadRotationPacket { - val entityId = input.readVarInt() - val headYaw = input.readByte() - - return EntityHeadRotationPacket(entityId, headYaw) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityHeadRotationPacket) { - output.writeVarInt(value.entityId) - output.writeByte(value.headYaw) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityLookPacket.kt deleted file mode 100644 index b4751c3..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityLookPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Entity Rotation | 0x2a | play | clientbound - * - * @param entityId entityId - * @param yaw yaw - * @param pitch pitch - * @param onGround onGround - * @see https://wiki.vg/Protocol#Update_Entity_Rotation - */ - -@MinecraftPacket(id = 0x2a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityLookPacket( - val entityId: Int, // varint - val yaw: Byte, - val pitch: Byte, - val onGround: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityLookPacket { - val entityId = input.readVarInt() - val yaw = input.readByte() - val pitch = input.readByte() - val onGround = input.readBoolean() - - return EntityLookPacket(entityId, yaw, pitch, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityLookPacket) { - output.writeVarInt(value.entityId) - output.writeByte(value.yaw) - output.writeByte(value.pitch) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMetadataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMetadataPacket.kt deleted file mode 100644 index d44787a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMetadataPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Entity Metadata | 0x50 | play | clientbound - * - * @param entityId entityId - * @see https://wiki.vg/Protocol#Set_Entity_Metadata - */ - -@MinecraftPacket(id = 0x50, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityMetadataPacket( - val entityId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityMetadataPacket { - val entityId = input.readVarInt() - - return EntityMetadataPacket(entityId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityMetadataPacket) { - output.writeVarInt(value.entityId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMoveLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMoveLookPacket.kt deleted file mode 100644 index d16f433..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityMoveLookPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Entity Position and Rotation | 0x29 | play | clientbound - * - * @param entityId entityId - * @param dX dX - * @param dY dY - * @param dZ dZ - * @param yaw yaw - * @param pitch pitch - * @param onGround onGround - * @see https://wiki.vg/Protocol#Update_Entity_Position_and_Rotation - */ - -@MinecraftPacket(id = 0x29, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityMoveLookPacket( - val entityId: Int, // varint - val dX: Short, - val dY: Short, - val dZ: Short, - val yaw: Byte, - val pitch: Byte, - val onGround: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityMoveLookPacket { - val entityId = input.readVarInt() - val dX = input.readShort() - val dY = input.readShort() - val dZ = input.readShort() - val yaw = input.readByte() - val pitch = input.readByte() - val onGround = input.readBoolean() - - return EntityMoveLookPacket(entityId, dX, dY, dZ, yaw, pitch, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityMoveLookPacket) { - output.writeVarInt(value.entityId) - output.writeShort(value.dX) - output.writeShort(value.dY) - output.writeShort(value.dZ) - output.writeByte(value.yaw) - output.writeByte(value.pitch) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntitySoundEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntitySoundEffectPacket.kt deleted file mode 100644 index 8962714..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntitySoundEffectPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Entity Sound Effect | 0x5f | play | clientbound - * - * @param soundId soundId - * @param soundCategory soundCategory - * @param entityId entityId - * @param volume volume - * @param pitch pitch - * @param seed seed - * @see https://wiki.vg/Protocol#Entity_Sound_Effect - */ - -@MinecraftPacket(id = 0x5f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntitySoundEffectPacket( - val soundId: Int, // varint - val soundCategory: Int, // varint - val entityId: Int, // varint - val volume: Float, - val pitch: Float, - val seed: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntitySoundEffectPacket { - val soundId = input.readVarInt() - val soundCategory = input.readVarInt() - val entityId = input.readVarInt() - val volume = input.readFloat() - val pitch = input.readFloat() - val seed = input.readLong() - - return EntitySoundEffectPacket(soundId, soundCategory, entityId, volume, pitch, seed) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntitySoundEffectPacket) { - output.writeVarInt(value.soundId) - output.writeVarInt(value.soundCategory) - output.writeVarInt(value.entityId) - output.writeFloat(value.volume) - output.writeFloat(value.pitch) - output.writeLong(value.seed) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityStatusPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityStatusPacket.kt deleted file mode 100644 index 4b79602..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityStatusPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Entity Event | 0x1a | play | clientbound - * - * @param entityId entityId - * @param entityStatus entityStatus - * @see https://wiki.vg/Protocol#Entity_Event - */ - -@MinecraftPacket(id = 0x1a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityStatusPacket( - val entityId: Int, - val entityStatus: Byte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityStatusPacket { - val entityId = input.readInt() - val entityStatus = input.readByte() - - return EntityStatusPacket(entityId, entityStatus) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityStatusPacket) { - output.writeInt(value.entityId) - output.writeByte(value.entityStatus) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityTeleportPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityTeleportPacket.kt deleted file mode 100644 index 6980468..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityTeleportPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Teleport Entity | 0x66 | play | clientbound - * - * @param entityId entityId - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @param onGround onGround - * @see https://wiki.vg/Protocol#Teleport_Entity - */ - -@MinecraftPacket(id = 0x66, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityTeleportPacket( - val entityId: Int, // varint - val x: Double, - val y: Double, - val z: Double, - val yaw: Byte, - val pitch: Byte, - val onGround: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityTeleportPacket { - val entityId = input.readVarInt() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readByte() - val pitch = input.readByte() - val onGround = input.readBoolean() - - return EntityTeleportPacket(entityId, x, y, z, yaw, pitch, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityTeleportPacket) { - output.writeVarInt(value.entityId) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeByte(value.yaw) - output.writeByte(value.pitch) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityUpdateAttributesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityUpdateAttributesPacket.kt deleted file mode 100644 index e38f372..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityUpdateAttributesPacket.kt +++ /dev/null @@ -1,81 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Update Attributes | 0x68 | play | clientbound - * - * @param entityId entityId - * @param properties list of EntityUpdateAttributesPacketProperties - * @see https://wiki.vg/Protocol#Update_Attributes - */ - -@MinecraftPacket(id = 0x68, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityUpdateAttributesPacket( - val entityId: Int, // varint - val properties: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityUpdateAttributesPacket { - val entityId = input.readVarInt() - val properties = input.readVarIntArray { arrayInput -> - val key = arrayInput.readString() - val value = arrayInput.readDouble() - val modifiers = arrayInput.readVarIntArray { arrayInput1 -> - val uuid = arrayInput1.readUUID() - val amount = arrayInput1.readDouble() - val operation = arrayInput1.readByte() - - return@readVarIntArray EntityUpdateAttributesPacketModifiers(uuid, amount, operation) - } - - return@readVarIntArray EntityUpdateAttributesPacketProperties(key, value, modifiers) - } - - return EntityUpdateAttributesPacket(entityId, properties) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityUpdateAttributesPacket) { - output.writeVarInt(value.entityId) - - output.writeVarIntArray(value.properties) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.key) - arrayOutput.writeDouble(arrayValue.value) - - arrayOutput.writeVarIntArray(arrayValue.modifiers) { arrayValue1, arrayOutput1 -> - arrayOutput1.writeUUID(arrayValue1.uuid) - arrayOutput1.writeDouble(arrayValue1.amount) - arrayOutput1.writeByte(arrayValue1.operation) - } - } - } - } -} - -/** - * EntityUpdateAttributesPacketModifiers - * - * @param uuid uuid - * @param amount amount - * @param operation operation -*/ -data class EntityUpdateAttributesPacketModifiers( - val uuid: UUID, - val amount: Double, - val operation: Byte, -) - -/** - * EntityUpdateAttributesPacketProperties - * - * @param key key - * @param value value - * @param modifiers list of EntityUpdateAttributesPacketModifiers -*/ -data class EntityUpdateAttributesPacketProperties( - val key: String, - val value: Double, - val modifiers: List, // varint array -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityVelocityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityVelocityPacket.kt deleted file mode 100644 index 0caf0ac..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/EntityVelocityPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Entity Velocity | 0x52 | play | clientbound - * - * @param entityId entityId - * @param velocityX velocityX - * @param velocityY velocityY - * @param velocityZ velocityZ - * @see https://wiki.vg/Protocol#Set_Entity_Velocity - */ - -@MinecraftPacket(id = 0x52, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class EntityVelocityPacket( - val entityId: Int, // varint - val velocityX: Short, - val velocityY: Short, - val velocityZ: Short, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityVelocityPacket { - val entityId = input.readVarInt() - val velocityX = input.readShort() - val velocityY = input.readShort() - val velocityZ = input.readShort() - - return EntityVelocityPacket(entityId, velocityX, velocityY, velocityZ) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityVelocityPacket) { - output.writeVarInt(value.entityId) - output.writeShort(value.velocityX) - output.writeShort(value.velocityY) - output.writeShort(value.velocityZ) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExperiencePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExperiencePacket.kt deleted file mode 100644 index 20f5d42..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExperiencePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Experience | 0x54 | play | clientbound - * - * @param experienceBar experienceBar - * @param level level - * @param totalExperience totalExperience - * @see https://wiki.vg/Protocol#Set_Experience - */ - -@MinecraftPacket(id = 0x54, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ExperiencePacket( - val experienceBar: Float, - val level: Int, // varint - val totalExperience: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ExperiencePacket { - val experienceBar = input.readFloat() - val level = input.readVarInt() - val totalExperience = input.readVarInt() - - return ExperiencePacket(experienceBar, level, totalExperience) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ExperiencePacket) { - output.writeFloat(value.experienceBar) - output.writeVarInt(value.level) - output.writeVarInt(value.totalExperience) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExplosionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExplosionPacket.kt deleted file mode 100644 index 8b7f2b5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ExplosionPacket.kt +++ /dev/null @@ -1,82 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Explosion | 0x1b | play | clientbound - * - * @param x x - * @param y y - * @param z z - * @param radius radius - * @param affectedBlockOffsets list of ExplosionPacketAffectedBlockOffsets - * @param playerMotionX playerMotionX - * @param playerMotionY playerMotionY - * @param playerMotionZ playerMotionZ - * @see https://wiki.vg/Protocol#Explosion - */ - -@MinecraftPacket(id = 0x1b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ExplosionPacket( - val x: Float, - val y: Float, - val z: Float, - val radius: Float, - val affectedBlockOffsets: List, // varint array - val playerMotionX: Float, - val playerMotionY: Float, - val playerMotionZ: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ExplosionPacket { - val x = input.readFloat() - val y = input.readFloat() - val z = input.readFloat() - val radius = input.readFloat() - val affectedBlockOffsets = input.readVarIntArray { arrayInput -> - val x = arrayInput.readByte() - val y = arrayInput.readByte() - val z = arrayInput.readByte() - - return@readVarIntArray ExplosionPacketAffectedBlockOffsets(x, y, z) - } - val playerMotionX = input.readFloat() - val playerMotionY = input.readFloat() - val playerMotionZ = input.readFloat() - - return ExplosionPacket(x, y, z, radius, affectedBlockOffsets, playerMotionX, playerMotionY, playerMotionZ) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ExplosionPacket) { - output.writeFloat(value.x) - output.writeFloat(value.y) - output.writeFloat(value.z) - output.writeFloat(value.radius) - - output.writeVarIntArray(value.affectedBlockOffsets) { arrayValue, arrayOutput -> - arrayOutput.writeByte(arrayValue.x) - arrayOutput.writeByte(arrayValue.y) - arrayOutput.writeByte(arrayValue.z) - } - - output.writeFloat(value.playerMotionX) - output.writeFloat(value.playerMotionY) - output.writeFloat(value.playerMotionZ) - } - } -} - -/** - * ExplosionPacketAffectedBlockOffsets - * - * @param x x - * @param y y - * @param z z -*/ -data class ExplosionPacketAffectedBlockOffsets( - val x: Byte, - val y: Byte, - val z: Byte, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/FacePlayerPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/FacePlayerPacket.kt deleted file mode 100644 index c36e602..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/FacePlayerPacket.kt +++ /dev/null @@ -1,65 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Look At | 0x38 | play | clientbound - * - * @param feetEyes feet_eyes - * @param x x - * @param y y - * @param z z - * @param isEntity isEntity - * @param entityId entityId - * @param entityFeetEyes entity_feet_eyes - * @see https://wiki.vg/Protocol#Look_At - */ - -@MinecraftPacket(id = 0x38, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class FacePlayerPacket( - val feetEyes: Int, // varint - val x: Double, - val y: Double, - val z: Double, - val isEntity: Boolean, - val entityId: Int?, // varint - val entityFeetEyes: String?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): FacePlayerPacket { - val feetEyes = input.readVarInt() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val isEntity = input.readBoolean() - val entityId = when (isEntity) { - true -> input.readVarInt() - else -> null - } - val entityFeetEyes = when (isEntity) { - true -> input.readString() - else -> null - } - - return FacePlayerPacket(feetEyes, x, y, z, isEntity, entityId, entityFeetEyes) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: FacePlayerPacket) { - output.writeVarInt(value.feetEyes) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeBoolean(value.isEntity) - when (value.isEntity) { - true -> output.writeVarInt(value.entityId!!) - else -> {} - } - when (value.isEntity) { - true -> output.writeString(value.entityFeetEyes!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/GameStateChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/GameStateChangePacket.kt deleted file mode 100644 index fd919ec..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/GameStateChangePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Game Event | 0x1d | play | clientbound - * - * @param reason reason - * @param gameMode gameMode - * @see https://wiki.vg/Protocol#Game_Event - */ - -@MinecraftPacket(id = 0x1d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class GameStateChangePacket( - val reason: UByte, - val gameMode: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): GameStateChangePacket { - val reason = input.readUByte() - val gameMode = input.readFloat() - - return GameStateChangePacket(reason, gameMode) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: GameStateChangePacket) { - output.writeUByte(value.reason) - output.writeFloat(value.gameMode) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HeldItemSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HeldItemSlotPacket.kt deleted file mode 100644 index 7c852c7..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HeldItemSlotPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Held Item (clientbound) | 0x4a | play | clientbound - * - * @param slot slot - * @see https://wiki.vg/Protocol#Set_Held_Item_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x4a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class HeldItemSlotPacket( - val slot: Byte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): HeldItemSlotPacket { - val slot = input.readByte() - - return HeldItemSlotPacket(slot) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: HeldItemSlotPacket) { - output.writeByte(value.slot) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HideMessagePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HideMessagePacket.kt deleted file mode 100644 index 7c6ebc2..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/HideMessagePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Hide Message | 0x18 | play | clientbound - * - * @param signature signature - * @see https://wiki.vg/Protocol#Hide_Message - */ - -@MinecraftPacket(id = 0x18, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class HideMessagePacket( - val signature: ByteArray, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): HideMessagePacket { - val signature = input.readVarIntByteArray() - - return HideMessagePacket(signature) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: HideMessagePacket) { - output.writeVarIntByteArray(value.signature) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/InitializeWorldBorderPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/InitializeWorldBorderPacket.kt deleted file mode 100644 index 5c185b4..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/InitializeWorldBorderPacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Initialize World Border | 0x1f | play | clientbound - * - * @param x x - * @param z z - * @param oldDiameter oldDiameter - * @param newDiameter newDiameter - * @param speed speed - * @param portalTeleportBoundary portalTeleportBoundary - * @param warningBlocks warningBlocks - * @param warningTime warningTime - * @see https://wiki.vg/Protocol#Initialize_World_Border - */ - -@MinecraftPacket(id = 0x1f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class InitializeWorldBorderPacket( - val x: Double, - val z: Double, - val oldDiameter: Double, - val newDiameter: Double, - val speed: Int, // varint - val portalTeleportBoundary: Int, // varint - val warningBlocks: Int, // varint - val warningTime: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): InitializeWorldBorderPacket { - val x = input.readDouble() - val z = input.readDouble() - val oldDiameter = input.readDouble() - val newDiameter = input.readDouble() - val speed = input.readVarInt() - val portalTeleportBoundary = input.readVarInt() - val warningBlocks = input.readVarInt() - val warningTime = input.readVarInt() - - return InitializeWorldBorderPacket(x, z, oldDiameter, newDiameter, speed, portalTeleportBoundary, warningBlocks, warningTime) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: InitializeWorldBorderPacket) { - output.writeDouble(value.x) - output.writeDouble(value.z) - output.writeDouble(value.oldDiameter) - output.writeDouble(value.newDiameter) - output.writeVarInt(value.speed) - output.writeVarInt(value.portalTeleportBoundary) - output.writeVarInt(value.warningBlocks) - output.writeVarInt(value.warningTime) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KeepAlivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KeepAlivePacket.kt deleted file mode 100644 index 217bb56..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KeepAlivePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Keep Alive (clientbound) | 0x20 | play | clientbound - * - * @param keepAliveId keepAliveId - * @see https://wiki.vg/Protocol#Keep_Alive_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x20, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class KeepAlivePacket( - val keepAliveId: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KeepAlivePacket { - val keepAliveId = input.readLong() - - return KeepAlivePacket(keepAliveId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KeepAlivePacket) { - output.writeLong(value.keepAliveId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KickDisconnectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KickDisconnectPacket.kt deleted file mode 100644 index 0f0ace8..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/KickDisconnectPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Disconnect (play) | 0x19 | play | clientbound - * - * @param reason reason - * @see https://wiki.vg/Protocol#Disconnect_.28play.29 - */ - -@MinecraftPacket(id = 0x19, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class KickDisconnectPacket( - val reason: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KickDisconnectPacket { - val reason = input.readString() - - return KickDisconnectPacket(reason) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KickDisconnectPacket) { - output.writeString(value.reason) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/LoginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/LoginPacket.kt deleted file mode 100644 index 4a5b1f6..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/LoginPacket.kt +++ /dev/null @@ -1,102 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.NBT -import io.layercraft.packetlib.types.Position -/** - * Login (play) | 0x25 | play | clientbound - * - * @param entityId entityId - * @param isHardcore isHardcore - * @param gameMode gameMode - * @param previousGameMode previousGameMode - * @param worldNames worldNames - * @param dimensionCodec dimensionCodec - * @param worldType worldType - * @param worldName worldName - * @param hashedSeed hashedSeed - * @param maxPlayers maxPlayers - * @param viewDistance viewDistance - * @param simulationDistance simulationDistance - * @param reducedDebugInfo reducedDebugInfo - * @param enableRespawnScreen enableRespawnScreen - * @param isDebug isDebug - * @param isFlat isFlat - * @param hasDeath death is present - * @param dimensionName dimensionName - * @param location location - * @see https://wiki.vg/Protocol#Login_.28play.29 - */ - -@MinecraftPacket(id = 0x25, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class LoginPacket( - val entityId: Int, - val isHardcore: Boolean, - val gameMode: UByte, - val previousGameMode: Byte, - val worldNames: List, // varint array - val dimensionCodec: NBT, - val worldType: String, - val worldName: String, - val hashedSeed: Long, - val maxPlayers: Int, // varint - val viewDistance: Int, // varint - val simulationDistance: Int, // varint - val reducedDebugInfo: Boolean, - val enableRespawnScreen: Boolean, - val isDebug: Boolean, - val isFlat: Boolean, - val hasDeath: Boolean, - val dimensionName: String?, - val location: Position?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPacket { - val entityId = input.readInt() - val isHardcore = input.readBoolean() - val gameMode = input.readUByte() - val previousGameMode = input.readByte() - val worldNames = input.readVarIntArray { arrayInput -> arrayInput.readString() } - val dimensionCodec = input.readNbt() - val worldType = input.readString() - val worldName = input.readString() - val hashedSeed = input.readLong() - val maxPlayers = input.readVarInt() - val viewDistance = input.readVarInt() - val simulationDistance = input.readVarInt() - val reducedDebugInfo = input.readBoolean() - val enableRespawnScreen = input.readBoolean() - val isDebug = input.readBoolean() - val isFlat = input.readBoolean() - val hasDeath = input.readBoolean() - val dimensionName = if (hasDeath) input.readString() else null - val location = if (hasDeath) input.readPosition() else null - - return LoginPacket(entityId, isHardcore, gameMode, previousGameMode, worldNames, dimensionCodec, worldType, worldName, hashedSeed, maxPlayers, viewDistance, simulationDistance, reducedDebugInfo, enableRespawnScreen, isDebug, isFlat, hasDeath, dimensionName, location) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPacket) { - output.writeInt(value.entityId) - output.writeBoolean(value.isHardcore) - output.writeUByte(value.gameMode) - output.writeByte(value.previousGameMode) - output.writeVarIntArray(value.worldNames) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - output.writeNbt(value.dimensionCodec) - output.writeString(value.worldType) - output.writeString(value.worldName) - output.writeLong(value.hashedSeed) - output.writeVarInt(value.maxPlayers) - output.writeVarInt(value.viewDistance) - output.writeVarInt(value.simulationDistance) - output.writeBoolean(value.reducedDebugInfo) - output.writeBoolean(value.enableRespawnScreen) - output.writeBoolean(value.isDebug) - output.writeBoolean(value.isFlat) - output.writeBoolean(value.hasDeath) - if (value.hasDeath) output.writeString(value.dimensionName!!) - if (value.hasDeath) output.writePosition(value.location!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapChunkPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapChunkPacket.kt deleted file mode 100644 index 2a6580a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapChunkPacket.kt +++ /dev/null @@ -1,74 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.ChunkBlockEntity -import io.layercraft.packetlib.types.NBT -/** - * Chunk Data and Update Light | 0x21 | play | clientbound - * - * @param x x - * @param z z - * @param heightmaps heightmaps - * @param chunkData chunkData - * @param blockEntities blockEntities - * @param trustEdges trustEdges - * @param skyLightMask skyLightMask - * @param blockLightMask blockLightMask - * @param emptySkyLightMask emptySkyLightMask - * @param emptyBlockLightMask emptyBlockLightMask - * @param skyLight skyLight - * @param blockLight blockLight - * @see https://wiki.vg/Protocol#Chunk_Data_and_Update_Light - */ - -@MinecraftPacket(id = 0x21, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class MapChunkPacket( - val x: Int, - val z: Int, - val heightmaps: NBT, - val chunkData: ByteArray, - val blockEntities: List, // varint array - val trustEdges: Boolean, - val skyLightMask: List, // varint array - val blockLightMask: List, // varint array - val emptySkyLightMask: List, // varint array - val emptyBlockLightMask: List, // varint array - val skyLight: List>, // varint array - val blockLight: List>, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MapChunkPacket { - val x = input.readInt() - val z = input.readInt() - val heightmaps = input.readNbt() - val chunkData = input.readVarIntByteArray() - val blockEntities = input.readVarIntArray { arrayInput -> arrayInput.readChunkBlockEntity() } - val trustEdges = input.readBoolean() - val skyLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val blockLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val emptySkyLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val emptyBlockLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val skyLight = input.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readUByte() } } - val blockLight = input.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readUByte() } } - - return MapChunkPacket(x, z, heightmaps, chunkData, blockEntities, trustEdges, skyLightMask, blockLightMask, emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MapChunkPacket) { - output.writeInt(value.x) - output.writeInt(value.z) - output.writeNbt(value.heightmaps) - output.writeVarIntByteArray(value.chunkData) - output.writeVarIntArray(value.blockEntities) { arrayValue, arrayOutput -> arrayOutput.writeChunkBlockEntity(arrayValue) } - output.writeBoolean(value.trustEdges) - output.writeVarIntArray(value.skyLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.blockLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.emptySkyLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.emptyBlockLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.skyLight) { arrayValue1, arrayOutput1 -> arrayOutput1.writeVarIntArray(arrayValue1) { arrayValue, arrayOutput -> arrayOutput.writeUByte(arrayValue) } } - output.writeVarIntArray(value.blockLight) { arrayValue1, arrayOutput1 -> arrayOutput1.writeVarIntArray(arrayValue1) { arrayValue, arrayOutput -> arrayOutput.writeUByte(arrayValue) } } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapPacket.kt deleted file mode 100644 index 584b1f5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MapPacket.kt +++ /dev/null @@ -1,77 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Map Data | 0x26 | play | clientbound - * - * @param itemDamage itemDamage - * @param scale scale - * @param locked locked - * @param columns columns - * @param rows rows - * @param x x - * @param y y - * @param data data - * @see https://wiki.vg/Protocol#Map_Data - */ - -@MinecraftPacket(id = 0x26, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class MapPacket( - val itemDamage: Int, // varint - val scale: Byte, - val locked: Boolean, - val columns: UByte, - val rows: UByte?, - val x: UByte?, - val y: UByte?, - val data: ByteArray?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MapPacket { - val itemDamage = input.readVarInt() - val scale = input.readByte() - val locked = input.readBoolean() - val columns = input.readUByte() - val rows = when (columns.toInt()) { - 0 -> null - else -> input.readUByte() - } - val x = when (columns.toInt()) { - 0 -> null - else -> input.readUByte() - } - val y = when (columns.toInt()) { - 0 -> null - else -> input.readUByte() - } - val data = when (columns.toInt()) { - 0 -> null - else -> input.readVarIntByteArray() - } - - return MapPacket(itemDamage, scale, locked, columns, rows, x, y, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MapPacket) { - output.writeVarInt(value.itemDamage) - output.writeByte(value.scale) - output.writeBoolean(value.locked) - output.writeUByte(value.columns) - when (value.columns.toInt()) { - else -> output.writeUByte(value.rows!!) - } - when (value.columns.toInt()) { - else -> output.writeUByte(value.x!!) - } - when (value.columns.toInt()) { - else -> output.writeUByte(value.y!!) - } - when (value.columns.toInt()) { - else -> output.writeVarIntByteArray(value.data!!) - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MessageHeaderPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MessageHeaderPacket.kt deleted file mode 100644 index 0ffdd02..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MessageHeaderPacket.kt +++ /dev/null @@ -1 +0,0 @@ -// TODO \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MultiBlockChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MultiBlockChangePacket.kt deleted file mode 100644 index a54fd4a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/MultiBlockChangePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Bitfield -/** - * Update Section Blocks | 0x40 | play | clientbound - * - * @param chunkCoordinates chunkCoordinates (Name: x, Size: 22, Signed: True | Name: z, Size: 22, Signed: True | Name: y, Size: 20, Signed: True) - * @param suppressLightUpdates suppressLightUpdates - * @param records records - * @see https://wiki.vg/Protocol#Update_Section_Blocks - */ - -@MinecraftPacket(id = 0x40, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class MultiBlockChangePacket( - val chunkCoordinates: Bitfield, - val suppressLightUpdates: Boolean, - val records: List, // varint array of varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MultiBlockChangePacket { - val chunkCoordinates = Bitfield.valueOf(input.readBytes(64)) - val suppressLightUpdates = input.readBoolean() - val records = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } - - return MultiBlockChangePacket(chunkCoordinates, suppressLightUpdates, records) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MultiBlockChangePacket) { - output.writeBytes(value.chunkCoordinates.toByteArray()) - output.writeBoolean(value.suppressLightUpdates) - output.writeVarIntArray(value.records) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedEntitySpawnPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedEntitySpawnPacket.kt deleted file mode 100644 index e5ac1b0..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedEntitySpawnPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Spawn Player | 0x02 | play | clientbound - * - * @param entityId entityId - * @param playerUUID playerUUID - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @see https://wiki.vg/Protocol#Spawn_Player - */ - -@MinecraftPacket(id = 0x02, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class NamedEntitySpawnPacket( - val entityId: Int, // varint - val playerUUID: UUID, - val x: Double, - val y: Double, - val z: Double, - val yaw: Byte, - val pitch: Byte, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NamedEntitySpawnPacket { - val entityId = input.readVarInt() - val playerUUID = input.readUUID() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readByte() - val pitch = input.readByte() - - return NamedEntitySpawnPacket(entityId, playerUUID, x, y, z, yaw, pitch) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NamedEntitySpawnPacket) { - output.writeVarInt(value.entityId) - output.writeUUID(value.playerUUID) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeByte(value.yaw) - output.writeByte(value.pitch) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedSoundEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedSoundEffectPacket.kt deleted file mode 100644 index cad4743..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NamedSoundEffectPacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Custom Sound Effect | 0x17 | play | clientbound - * - * @param soundName soundName - * @param soundCategory soundCategory - * @param x x - * @param y y - * @param z z - * @param volume volume - * @param pitch pitch - * @param seed seed - * @see https://wiki.vg/Protocol#Custom_Sound_Effect - */ - -@MinecraftPacket(id = 0x17, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class NamedSoundEffectPacket( - val soundName: String, - val soundCategory: Int, // varint - val x: Int, - val y: Int, - val z: Int, - val volume: Float, - val pitch: Float, - val seed: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NamedSoundEffectPacket { - val soundName = input.readString() - val soundCategory = input.readVarInt() - val x = input.readInt() - val y = input.readInt() - val z = input.readInt() - val volume = input.readFloat() - val pitch = input.readFloat() - val seed = input.readLong() - - return NamedSoundEffectPacket(soundName, soundCategory, x, y, z, volume, pitch, seed) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NamedSoundEffectPacket) { - output.writeString(value.soundName) - output.writeVarInt(value.soundCategory) - output.writeInt(value.x) - output.writeInt(value.y) - output.writeInt(value.z) - output.writeFloat(value.volume) - output.writeFloat(value.pitch) - output.writeLong(value.seed) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NbtQueryResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NbtQueryResponsePacket.kt deleted file mode 100644 index 55cc50b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/NbtQueryResponsePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.NBT -/** - * Tag Query Response | 0x64 | play | clientbound - * - * @param transactionId transactionId - * @param nbt nbt - * @see https://wiki.vg/Protocol#Tag_Query_Response - */ - -@MinecraftPacket(id = 0x64, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class NbtQueryResponsePacket( - val transactionId: Int, // varint - val nbt: NBT, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NbtQueryResponsePacket { - val transactionId = input.readVarInt() - val nbt = input.readNbt() - - return NbtQueryResponsePacket(transactionId, nbt) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NbtQueryResponsePacket) { - output.writeVarInt(value.transactionId) - output.writeNbt(value.nbt) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenBookPacket.kt deleted file mode 100644 index 3854f15..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenBookPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Open Book | 0x2c | play | clientbound - * - * @param hand hand - * @see https://wiki.vg/Protocol#Open_Book - */ - -@MinecraftPacket(id = 0x2c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class OpenBookPacket( - val hand: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenBookPacket { - val hand = input.readVarInt() - - return OpenBookPacket(hand) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenBookPacket) { - output.writeVarInt(value.hand) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenHorseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenHorseWindowPacket.kt deleted file mode 100644 index a0f96f6..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenHorseWindowPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Open Horse Screen | 0x1e | play | clientbound - * - * @param windowId windowId - * @param nbSlots nbSlots - * @param entityId entityId - * @see https://wiki.vg/Protocol#Open_Horse_Screen - */ - -@MinecraftPacket(id = 0x1e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class OpenHorseWindowPacket( - val windowId: UByte, - val nbSlots: Int, // varint - val entityId: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenHorseWindowPacket { - val windowId = input.readUByte() - val nbSlots = input.readVarInt() - val entityId = input.readInt() - - return OpenHorseWindowPacket(windowId, nbSlots, entityId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenHorseWindowPacket) { - output.writeUByte(value.windowId) - output.writeVarInt(value.nbSlots) - output.writeInt(value.entityId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenSignEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenSignEntityPacket.kt deleted file mode 100644 index 824a5e6..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenSignEntityPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Open Sign Editor | 0x2e | play | clientbound - * - * @param location location - * @see https://wiki.vg/Protocol#Open_Sign_Editor - */ - -@MinecraftPacket(id = 0x2e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class OpenSignEntityPacket( - val location: Position, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenSignEntityPacket { - val location = input.readPosition() - - return OpenSignEntityPacket(location) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenSignEntityPacket) { - output.writePosition(value.location) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenWindowPacket.kt deleted file mode 100644 index 76e0c62..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/OpenWindowPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Open Screen | 0x2d | play | clientbound - * - * @param windowId windowId - * @param inventoryType inventoryType - * @param windowTitle windowTitle - * @see https://wiki.vg/Protocol#Open_Screen - */ - -@MinecraftPacket(id = 0x2d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class OpenWindowPacket( - val windowId: Int, // varint - val inventoryType: Int, // varint - val windowTitle: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenWindowPacket { - val windowId = input.readVarInt() - val inventoryType = input.readVarInt() - val windowTitle = input.readString() - - return OpenWindowPacket(windowId, inventoryType, windowTitle) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenWindowPacket) { - output.writeVarInt(value.windowId) - output.writeVarInt(value.inventoryType) - output.writeString(value.windowTitle) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PingPacket.kt deleted file mode 100644 index b8ffec7..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Ping (play) | 0x2f | play | clientbound - * - * @param id id - * @see https://wiki.vg/Protocol#Ping_.28play.29 - */ - -@MinecraftPacket(id = 0x2f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class PingPacket( - val id: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { - val id = input.readInt() - - return PingPacket(id) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { - output.writeInt(value.id) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerChatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerChatPacket.kt deleted file mode 100644 index 0ffdd02..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerChatPacket.kt +++ /dev/null @@ -1 +0,0 @@ -// TODO \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerInfoPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerInfoPacket.kt deleted file mode 100644 index 4a4220a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerInfoPacket.kt +++ /dev/null @@ -1,206 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Player Info | 0x37 | play | clientbound - * - * @param action action - * @param data list of PlayerInfoPacketData - * @see https://wiki.vg/Protocol#Player_Info - */ - -@MinecraftPacket(id = 0x37, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class PlayerInfoPacket( - val action: Int, // varint - val data: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PlayerInfoPacket { - val action = input.readVarInt() - val data = input.readVarIntArray { arrayInput -> - val uuid = arrayInput.readUUID() - val name = when (action) { - 0 -> arrayInput.readString() - else -> null - } - val properties = when (action) { - 0 -> arrayInput.readVarIntArray { arrayInput1 -> - val name = arrayInput1.readString() - val value = arrayInput1.readString() - val hasSignature = arrayInput1.readBoolean() - val signature = if (hasSignature) arrayInput1.readString() else null - - return@readVarIntArray PlayerInfoPacketProperties(name, value, hasSignature, signature) - } - else -> null - } - val gamemode = when (action) { - 0 -> arrayInput.readVarInt() - 1 -> arrayInput.readVarInt() - else -> null - } - val ping = when (action) { - 0 -> arrayInput.readVarInt() - 2 -> arrayInput.readVarInt() - else -> null - } - val hasDisplayName = when (action) { - 0 -> arrayInput.readBoolean() - 3 -> arrayInput.readBoolean() - else -> null - } - val displayName = when (action) { - 0 -> if (hasDisplayName!!) arrayInput.readString() else null - 3 -> if (hasDisplayName!!) arrayInput.readString() else null - else -> null - } - val hasTimestamp = when (action) { - 0 -> arrayInput.readBoolean() - else -> null - } - val timestamp = when (action) { - 0 -> if (hasTimestamp!!) arrayInput.readLong() else null - else -> null - } - val hasPublicKey = when (action) { - 0 -> arrayInput.readBoolean() - else -> null - } - val publicKey = when (action) { - 0 -> if (hasPublicKey!!) arrayInput.readVarIntByteArray() else null - else -> null - } - val hasSignature = when (action) { - 0 -> arrayInput.readBoolean() - else -> null - } - val signature = when (action) { - 0 -> if (hasSignature!!) arrayInput.readVarIntByteArray() else null - else -> null - } - - return@readVarIntArray PlayerInfoPacketData(uuid, name, properties, gamemode, ping, hasDisplayName, displayName, hasTimestamp, timestamp, hasPublicKey, publicKey, hasSignature, signature) - } - - return PlayerInfoPacket(action, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PlayerInfoPacket) { - output.writeVarInt(value.action) - - output.writeVarIntArray(value.data) { arrayValue, arrayOutput -> - arrayOutput.writeUUID(arrayValue.uuid) - when (value.action) { - 0 -> arrayOutput.writeString(arrayValue.name!!) - else -> {} - } - when (value.action) { - 0 -> - arrayOutput.writeVarIntArray(arrayValue.properties!!) { arrayValue1, arrayOutput1 -> - arrayOutput1.writeString(arrayValue1.name) - arrayOutput1.writeString(arrayValue1.value) - arrayOutput1.writeBoolean(arrayValue1.hasSignature) - if (arrayValue1.hasSignature) arrayOutput1.writeString(arrayValue1.signature!!) - } - - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeVarInt(arrayValue.gamemode!!) - 1 -> arrayOutput.writeVarInt(arrayValue.gamemode!!) - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeVarInt(arrayValue.ping!!) - 2 -> arrayOutput.writeVarInt(arrayValue.ping!!) - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeBoolean(arrayValue.hasDisplayName!!) - 3 -> arrayOutput.writeBoolean(arrayValue.hasDisplayName!!) - else -> {} - } - when (value.action) { - 0 -> if (arrayValue.hasDisplayName!!) arrayOutput.writeString(arrayValue.displayName!!) - 3 -> if (arrayValue.hasDisplayName!!) arrayOutput.writeString(arrayValue.displayName!!) - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeBoolean(arrayValue.hasTimestamp!!) - else -> {} - } - when (value.action) { - 0 -> if (arrayValue.hasTimestamp!!) arrayOutput.writeLong(arrayValue.timestamp!!) - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeBoolean(arrayValue.hasPublicKey!!) - else -> {} - } - when (value.action) { - 0 -> if (arrayValue.hasPublicKey!!) arrayOutput.writeVarIntByteArray(arrayValue.publicKey!!) - else -> {} - } - when (value.action) { - 0 -> arrayOutput.writeBoolean(arrayValue.hasSignature!!) - else -> {} - } - when (value.action) { - 0 -> if (arrayValue.hasSignature!!) arrayOutput.writeVarIntByteArray(arrayValue.signature!!) - else -> {} - } - } - } - } -} - -/** - * PlayerInfoPacketProperties - * - * @param name name - * @param value value - * @param hasSignature signature is present - * @param signature signature -*/ -data class PlayerInfoPacketProperties( - val name: String, - val value: String, - val hasSignature: Boolean, - val signature: String?, -) - -/** - * PlayerInfoPacketData - * - * @param uuid uuid - * @param name name - * @param properties list of PlayerInfoPacketProperties - * @param gamemode gamemode - * @param ping ping - * @param hasDisplayName hasDisplayName - * @param displayName displayName - * @param hasTimestamp hasTimestamp - * @param timestamp timestamp - * @param hasPublicKey hasPublicKey - * @param publicKey publicKey - * @param hasSignature hasSignature - * @param signature signature -*/ -data class PlayerInfoPacketData( - val uuid: UUID, - val name: String?, - val properties: List?, - val gamemode: Int?, // varint - val ping: Int?, // varint - val hasDisplayName: Boolean?, - val displayName: String?, - val hasTimestamp: Boolean?, - val timestamp: Long?, - val hasPublicKey: Boolean?, - val publicKey: ByteArray?, - val hasSignature: Boolean?, - val signature: ByteArray?, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerlistHeaderPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerlistHeaderPacket.kt deleted file mode 100644 index e15a4b3..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PlayerlistHeaderPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Tab List Header And Footer | 0x63 | play | clientbound - * - * @param header header - * @param footer footer - * @see https://wiki.vg/Protocol#Set_Tab_List_Header_And_Footer - */ - -@MinecraftPacket(id = 0x63, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class PlayerlistHeaderPacket( - val header: String, - val footer: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PlayerlistHeaderPacket { - val header = input.readString() - val footer = input.readString() - - return PlayerlistHeaderPacket(header, footer) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PlayerlistHeaderPacket) { - output.writeString(value.header) - output.writeString(value.footer) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PositionPacket.kt deleted file mode 100644 index b8e9059..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/PositionPacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Synchronize Player Position | 0x39 | play | clientbound - * - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @param flags flags - * @param teleportId teleportId - * @param dismountVehicle dismountVehicle - * @see https://wiki.vg/Protocol#Synchronize_Player_Position - */ - -@MinecraftPacket(id = 0x39, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class PositionPacket( - val x: Double, - val y: Double, - val z: Double, - val yaw: Float, - val pitch: Float, - val flags: Byte, - val teleportId: Int, // varint - val dismountVehicle: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionPacket { - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readFloat() - val pitch = input.readFloat() - val flags = input.readByte() - val teleportId = input.readVarInt() - val dismountVehicle = input.readBoolean() - - return PositionPacket(x, y, z, yaw, pitch, flags, teleportId, dismountVehicle) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionPacket) { - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeFloat(value.yaw) - output.writeFloat(value.pitch) - output.writeByte(value.flags) - output.writeVarInt(value.teleportId) - output.writeBoolean(value.dismountVehicle) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RelEntityMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RelEntityMovePacket.kt deleted file mode 100644 index fabc3eb..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RelEntityMovePacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Entity Position | 0x28 | play | clientbound - * - * @param entityId entityId - * @param dX dX - * @param dY dY - * @param dZ dZ - * @param onGround onGround - * @see https://wiki.vg/Protocol#Update_Entity_Position - */ - -@MinecraftPacket(id = 0x28, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class RelEntityMovePacket( - val entityId: Int, // varint - val dX: Short, - val dY: Short, - val dZ: Short, - val onGround: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RelEntityMovePacket { - val entityId = input.readVarInt() - val dX = input.readShort() - val dY = input.readShort() - val dZ = input.readShort() - val onGround = input.readBoolean() - - return RelEntityMovePacket(entityId, dX, dY, dZ, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RelEntityMovePacket) { - output.writeVarInt(value.entityId) - output.writeShort(value.dX) - output.writeShort(value.dY) - output.writeShort(value.dZ) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RemoveEntityEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RemoveEntityEffectPacket.kt deleted file mode 100644 index 32de5fb..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RemoveEntityEffectPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Remove Entity Effect | 0x3c | play | clientbound - * - * @param entityId entityId - * @param effectId effectId - * @see https://wiki.vg/Protocol#Remove_Entity_Effect - */ - -@MinecraftPacket(id = 0x3c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class RemoveEntityEffectPacket( - val entityId: Int, // varint - val effectId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RemoveEntityEffectPacket { - val entityId = input.readVarInt() - val effectId = input.readVarInt() - - return RemoveEntityEffectPacket(entityId, effectId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RemoveEntityEffectPacket) { - output.writeVarInt(value.entityId) - output.writeVarInt(value.effectId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ResourcePackSendPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ResourcePackSendPacket.kt deleted file mode 100644 index 240f5bf..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ResourcePackSendPacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Resource Pack (clientbound) | 0x3d | play | clientbound - * - * @param url url - * @param hash hash - * @param forced forced - * @param hasPromptMessage promptMessage is present - * @param promptMessage promptMessage - * @see https://wiki.vg/Protocol#Resource_Pack_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x3d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ResourcePackSendPacket( - val url: String, - val hash: String, - val forced: Boolean, - val hasPromptMessage: Boolean, - val promptMessage: String?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ResourcePackSendPacket { - val url = input.readString() - val hash = input.readString() - val forced = input.readBoolean() - val hasPromptMessage = input.readBoolean() - val promptMessage = if (hasPromptMessage) input.readString() else null - - return ResourcePackSendPacket(url, hash, forced, hasPromptMessage, promptMessage) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ResourcePackSendPacket) { - output.writeString(value.url) - output.writeString(value.hash) - output.writeBoolean(value.forced) - output.writeBoolean(value.hasPromptMessage) - if (value.hasPromptMessage) output.writeString(value.promptMessage!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RespawnPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RespawnPacket.kt deleted file mode 100644 index cde6630..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/RespawnPacket.kt +++ /dev/null @@ -1,69 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Respawn | 0x3e | play | clientbound - * - * @param dimension dimension - * @param worldName worldName - * @param hashedSeed hashedSeed - * @param gamemode gamemode - * @param previousGamemode previousGamemode - * @param isDebug isDebug - * @param isFlat isFlat - * @param copyMetadata copyMetadata - * @param hasDeath death is present - * @param dimensionName dimensionName - * @param location location - * @see https://wiki.vg/Protocol#Respawn - */ - -@MinecraftPacket(id = 0x3e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class RespawnPacket( - val dimension: String, - val worldName: String, - val hashedSeed: Long, - val gamemode: Byte, - val previousGamemode: UByte, - val isDebug: Boolean, - val isFlat: Boolean, - val copyMetadata: Boolean, - val hasDeath: Boolean, - val dimensionName: String?, - val location: Position?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RespawnPacket { - val dimension = input.readString() - val worldName = input.readString() - val hashedSeed = input.readLong() - val gamemode = input.readByte() - val previousGamemode = input.readUByte() - val isDebug = input.readBoolean() - val isFlat = input.readBoolean() - val copyMetadata = input.readBoolean() - val hasDeath = input.readBoolean() - val dimensionName = if (hasDeath) input.readString() else null - val location = if (hasDeath) input.readPosition() else null - - return RespawnPacket(dimension, worldName, hashedSeed, gamemode, previousGamemode, isDebug, isFlat, copyMetadata, hasDeath, dimensionName, location) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RespawnPacket) { - output.writeString(value.dimension) - output.writeString(value.worldName) - output.writeLong(value.hashedSeed) - output.writeByte(value.gamemode) - output.writeUByte(value.previousGamemode) - output.writeBoolean(value.isDebug) - output.writeBoolean(value.isFlat) - output.writeBoolean(value.copyMetadata) - output.writeBoolean(value.hasDeath) - if (value.hasDeath) output.writeString(value.dimensionName!!) - if (value.hasDeath) output.writePosition(value.location!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardDisplayObjectivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardDisplayObjectivePacket.kt deleted file mode 100644 index 8fc24ac..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardDisplayObjectivePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Display Objective | 0x4f | play | clientbound - * - * @param position position - * @param name name - * @see https://wiki.vg/Protocol#Display_Objective - */ - -@MinecraftPacket(id = 0x4f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ScoreboardDisplayObjectivePacket( - val position: Byte, - val name: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardDisplayObjectivePacket { - val position = input.readByte() - val name = input.readString() - - return ScoreboardDisplayObjectivePacket(position, name) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardDisplayObjectivePacket) { - output.writeByte(value.position) - output.writeString(value.name) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardObjectivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardObjectivePacket.kt deleted file mode 100644 index 9429a9a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardObjectivePacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Objectives | 0x56 | play | clientbound - * - * @param name name - * @param action action - * @param displayText displayText - * @param type type - * @see https://wiki.vg/Protocol#Update_Objectives - */ - -@MinecraftPacket(id = 0x56, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ScoreboardObjectivePacket( - val name: String, - val action: Byte, - val displayText: String?, - val type: Int?, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardObjectivePacket { - val name = input.readString() - val action = input.readByte() - val displayText = when (action.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val type = when (action.toInt()) { - 0 -> input.readVarInt() - 2 -> input.readVarInt() - else -> null - } - - return ScoreboardObjectivePacket(name, action, displayText, type) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardObjectivePacket) { - output.writeString(value.name) - output.writeByte(value.action) - when (value.action.toInt()) { - 0 -> output.writeString(value.displayText!!) - 2 -> output.writeString(value.displayText!!) - else -> {} - } - when (value.action.toInt()) { - 0 -> output.writeVarInt(value.type!!) - 2 -> output.writeVarInt(value.type!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardScorePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardScorePacket.kt deleted file mode 100644 index 41f376a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ScoreboardScorePacket.kt +++ /dev/null @@ -1,46 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Score | 0x59 | play | clientbound - * - * @param itemName itemName - * @param action action - * @param scoreName scoreName - * @param value value - * @see https://wiki.vg/Protocol#Update_Score - */ - -@MinecraftPacket(id = 0x59, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ScoreboardScorePacket( - val itemName: String, - val action: Int, // varint - val scoreName: String, - val value: Int?, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardScorePacket { - val itemName = input.readString() - val action = input.readVarInt() - val scoreName = input.readString() - val value = when (action) { - 1 -> null - else -> input.readVarInt() - } - - return ScoreboardScorePacket(itemName, action, scoreName, value) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardScorePacket) { - output.writeString(value.itemName) - output.writeVarInt(value.action) - output.writeString(value.scoreName) - when (value.action) { - else -> output.writeVarInt(value.value!!) - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SelectAdvancementTabPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SelectAdvancementTabPacket.kt deleted file mode 100644 index a10ec2b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SelectAdvancementTabPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Select Advancements Tab | 0x41 | play | clientbound - * - * @param hasId id is present - * @param id id - * @see https://wiki.vg/Protocol#Select_Advancements_Tab - */ - -@MinecraftPacket(id = 0x41, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SelectAdvancementTabPacket( - val hasId: Boolean, - val id: String?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SelectAdvancementTabPacket { - val hasId = input.readBoolean() - val id = if (hasId) input.readString() else null - - return SelectAdvancementTabPacket(hasId, id) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SelectAdvancementTabPacket) { - output.writeBoolean(value.hasId) - if (value.hasId) output.writeString(value.id!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ServerDataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ServerDataPacket.kt deleted file mode 100644 index e153555..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ServerDataPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Server Data | 0x42 | play | clientbound - * - * @param hasMotd motd is present - * @param motd motd - * @param hasIcon icon is present - * @param icon icon - * @param previewsChat previewsChat - * @param enforcesSecureChat enforcesSecureChat - * @see https://wiki.vg/Protocol#Server_Data - */ - -@MinecraftPacket(id = 0x42, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ServerDataPacket( - val hasMotd: Boolean, - val motd: String?, - val hasIcon: Boolean, - val icon: String?, - val previewsChat: Boolean, - val enforcesSecureChat: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ServerDataPacket { - val hasMotd = input.readBoolean() - val motd = if (hasMotd) input.readString() else null - val hasIcon = input.readBoolean() - val icon = if (hasIcon) input.readString() else null - val previewsChat = input.readBoolean() - val enforcesSecureChat = input.readBoolean() - - return ServerDataPacket(hasMotd, motd, hasIcon, icon, previewsChat, enforcesSecureChat) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ServerDataPacket) { - output.writeBoolean(value.hasMotd) - if (value.hasMotd) output.writeString(value.motd!!) - output.writeBoolean(value.hasIcon) - if (value.hasIcon) output.writeString(value.icon!!) - output.writeBoolean(value.previewsChat) - output.writeBoolean(value.enforcesSecureChat) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetCooldownPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetCooldownPacket.kt deleted file mode 100644 index ff774b2..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetCooldownPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Cooldown | 0x14 | play | clientbound - * - * @param itemID itemID - * @param cooldownTicks cooldownTicks - * @see https://wiki.vg/Protocol#Set_Cooldown - */ - -@MinecraftPacket(id = 0x14, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetCooldownPacket( - val itemID: Int, // varint - val cooldownTicks: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetCooldownPacket { - val itemID = input.readVarInt() - val cooldownTicks = input.readVarInt() - - return SetCooldownPacket(itemID, cooldownTicks) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetCooldownPacket) { - output.writeVarInt(value.itemID) - output.writeVarInt(value.cooldownTicks) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetPassengersPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetPassengersPacket.kt deleted file mode 100644 index 6ff4ffd..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetPassengersPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Passengers | 0x57 | play | clientbound - * - * @param entityId entityId - * @param passengers passengers - * @see https://wiki.vg/Protocol#Set_Passengers - */ - -@MinecraftPacket(id = 0x57, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetPassengersPacket( - val entityId: Int, // varint - val passengers: List, // varint array of varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetPassengersPacket { - val entityId = input.readVarInt() - val passengers = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } - - return SetPassengersPacket(entityId, passengers) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetPassengersPacket) { - output.writeVarInt(value.entityId) - output.writeVarIntArray(value.passengers) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetSlotPacket.kt deleted file mode 100644 index 9d158a5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetSlotPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Container Slot | 0x13 | play | clientbound - * - * @param windowId windowId - * @param stateId stateId - * @param slot slot - * @see https://wiki.vg/Protocol#Set_Container_Slot - */ - -@MinecraftPacket(id = 0x13, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetSlotPacket( - val windowId: Byte, - val stateId: Int, // varint - val slot: Short, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetSlotPacket { - val windowId = input.readByte() - val stateId = input.readVarInt() - val slot = input.readShort() - - return SetSlotPacket(windowId, stateId, slot) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetSlotPacket) { - output.writeByte(value.windowId) - output.writeVarInt(value.stateId) - output.writeShort(value.slot) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleSubtitlePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleSubtitlePacket.kt deleted file mode 100644 index bce0d6d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleSubtitlePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Subtitle Text | 0x5b | play | clientbound - * - * @param text text - * @see https://wiki.vg/Protocol#Set_Subtitle_Text - */ - -@MinecraftPacket(id = 0x5b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetTitleSubtitlePacket( - val text: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleSubtitlePacket { - val text = input.readString() - - return SetTitleSubtitlePacket(text) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleSubtitlePacket) { - output.writeString(value.text) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTextPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTextPacket.kt deleted file mode 100644 index 62509d0..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTextPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Title Text | 0x5d | play | clientbound - * - * @param text text - * @see https://wiki.vg/Protocol#Set_Title_Text - */ - -@MinecraftPacket(id = 0x5d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetTitleTextPacket( - val text: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleTextPacket { - val text = input.readString() - - return SetTitleTextPacket(text) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleTextPacket) { - output.writeString(value.text) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTimePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTimePacket.kt deleted file mode 100644 index 0c85720..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SetTitleTimePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Title Animation Times | 0x5e | play | clientbound - * - * @param fadeIn fadeIn - * @param stay stay - * @param fadeOut fadeOut - * @see https://wiki.vg/Protocol#Set_Title_Animation_Times - */ - -@MinecraftPacket(id = 0x5e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SetTitleTimePacket( - val fadeIn: Int, - val stay: Int, - val fadeOut: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleTimePacket { - val fadeIn = input.readInt() - val stay = input.readInt() - val fadeOut = input.readInt() - - return SetTitleTimePacket(fadeIn, stay, fadeOut) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleTimePacket) { - output.writeInt(value.fadeIn) - output.writeInt(value.stay) - output.writeInt(value.fadeOut) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ShouldDisplayChatPreviewPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ShouldDisplayChatPreviewPacket.kt deleted file mode 100644 index bc68ca1..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/ShouldDisplayChatPreviewPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Display Chat Preview | 0x4e | play | clientbound - * - * @param shouldDisplayChatPreview should_display_chat_preview - * @see https://wiki.vg/Protocol#Set_Display_Chat_Preview - */ - -@MinecraftPacket(id = 0x4e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class ShouldDisplayChatPreviewPacket( - val shouldDisplayChatPreview: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ShouldDisplayChatPreviewPacket { - val shouldDisplayChatPreview = input.readBoolean() - - return ShouldDisplayChatPreviewPacket(shouldDisplayChatPreview) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ShouldDisplayChatPreviewPacket) { - output.writeBoolean(value.shouldDisplayChatPreview) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SimulationDistancePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SimulationDistancePacket.kt deleted file mode 100644 index b4f378d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SimulationDistancePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Simulation Distance | 0x5a | play | clientbound - * - * @param distance distance - * @see https://wiki.vg/Protocol#Set_Simulation_Distance - */ - -@MinecraftPacket(id = 0x5a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SimulationDistancePacket( - val distance: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SimulationDistancePacket { - val distance = input.readVarInt() - - return SimulationDistancePacket(distance) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SimulationDistancePacket) { - output.writeVarInt(value.distance) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SoundEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SoundEffectPacket.kt deleted file mode 100644 index a004dec..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SoundEffectPacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Sound Effect | 0x60 | play | clientbound - * - * @param soundId soundId - * @param soundCategory soundCategory - * @param x x - * @param y y - * @param z z - * @param volume volume - * @param pitch pitch - * @param seed seed - * @see https://wiki.vg/Protocol#Sound_Effect - */ - -@MinecraftPacket(id = 0x60, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SoundEffectPacket( - val soundId: Int, // varint - val soundCategory: Int, // varint - val x: Int, - val y: Int, - val z: Int, - val volume: Float, - val pitch: Float, - val seed: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SoundEffectPacket { - val soundId = input.readVarInt() - val soundCategory = input.readVarInt() - val x = input.readInt() - val y = input.readInt() - val z = input.readInt() - val volume = input.readFloat() - val pitch = input.readFloat() - val seed = input.readLong() - - return SoundEffectPacket(soundId, soundCategory, x, y, z, volume, pitch, seed) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SoundEffectPacket) { - output.writeVarInt(value.soundId) - output.writeVarInt(value.soundCategory) - output.writeInt(value.x) - output.writeInt(value.y) - output.writeInt(value.z) - output.writeFloat(value.volume) - output.writeFloat(value.pitch) - output.writeLong(value.seed) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityExperienceOrbPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityExperienceOrbPacket.kt deleted file mode 100644 index 2d16c15..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityExperienceOrbPacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Spawn Experience Orb | 0x01 | play | clientbound - * - * @param entityId entityId - * @param x x - * @param y y - * @param z z - * @param count count - * @see https://wiki.vg/Protocol#Spawn_Experience_Orb - */ - -@MinecraftPacket(id = 0x01, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SpawnEntityExperienceOrbPacket( - val entityId: Int, // varint - val x: Double, - val y: Double, - val z: Double, - val count: Short, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnEntityExperienceOrbPacket { - val entityId = input.readVarInt() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val count = input.readShort() - - return SpawnEntityExperienceOrbPacket(entityId, x, y, z, count) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnEntityExperienceOrbPacket) { - output.writeVarInt(value.entityId) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeShort(value.count) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityPacket.kt deleted file mode 100644 index 438d164..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnEntityPacket.kt +++ /dev/null @@ -1,77 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Spawn Entity | 0x00 | play | clientbound - * - * @param entityId entityId - * @param objectUUID objectUUID - * @param type type - * @param x x - * @param y y - * @param z z - * @param pitch pitch - * @param yaw yaw - * @param headPitch headPitch - * @param objectData objectData - * @param velocityX velocityX - * @param velocityY velocityY - * @param velocityZ velocityZ - * @see https://wiki.vg/Protocol#Spawn_Entity - */ - -@MinecraftPacket(id = 0x00, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SpawnEntityPacket( - val entityId: Int, // varint - val objectUUID: UUID, - val type: Int, // varint - val x: Double, - val y: Double, - val z: Double, - val pitch: Byte, - val yaw: Byte, - val headPitch: Byte, - val objectData: Int, // varint - val velocityX: Short, - val velocityY: Short, - val velocityZ: Short, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnEntityPacket { - val entityId = input.readVarInt() - val objectUUID = input.readUUID() - val type = input.readVarInt() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val pitch = input.readByte() - val yaw = input.readByte() - val headPitch = input.readByte() - val objectData = input.readVarInt() - val velocityX = input.readShort() - val velocityY = input.readShort() - val velocityZ = input.readShort() - - return SpawnEntityPacket(entityId, objectUUID, type, x, y, z, pitch, yaw, headPitch, objectData, velocityX, velocityY, velocityZ) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnEntityPacket) { - output.writeVarInt(value.entityId) - output.writeUUID(value.objectUUID) - output.writeVarInt(value.type) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeByte(value.pitch) - output.writeByte(value.yaw) - output.writeByte(value.headPitch) - output.writeVarInt(value.objectData) - output.writeShort(value.velocityX) - output.writeShort(value.velocityY) - output.writeShort(value.velocityZ) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnPositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnPositionPacket.kt deleted file mode 100644 index 56ae0c1..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SpawnPositionPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Set Default Spawn Position | 0x4d | play | clientbound - * - * @param location location - * @param angle angle - * @see https://wiki.vg/Protocol#Set_Default_Spawn_Position - */ - -@MinecraftPacket(id = 0x4d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SpawnPositionPacket( - val location: Position, - val angle: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnPositionPacket { - val location = input.readPosition() - val angle = input.readFloat() - - return SpawnPositionPacket(location, angle) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnPositionPacket) { - output.writePosition(value.location) - output.writeFloat(value.angle) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StatisticsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StatisticsPacket.kt deleted file mode 100644 index 4437891..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StatisticsPacket.kt +++ /dev/null @@ -1,52 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Award Statistics | 0x04 | play | clientbound - * - * @param entries list of StatisticsPacketEntries - * @see https://wiki.vg/Protocol#Award_Statistics - */ - -@MinecraftPacket(id = 0x04, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class StatisticsPacket( - val entries: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): StatisticsPacket { - val entries = input.readVarIntArray { arrayInput -> - val categoryId = arrayInput.readVarInt() - val statisticId = arrayInput.readVarInt() - val value = arrayInput.readVarInt() - - return@readVarIntArray StatisticsPacketEntries(categoryId, statisticId, value) - } - - return StatisticsPacket(entries) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: StatisticsPacket) { - output.writeVarIntArray(value.entries) { arrayValue, arrayOutput -> - arrayOutput.writeVarInt(arrayValue.categoryId) - arrayOutput.writeVarInt(arrayValue.statisticId) - arrayOutput.writeVarInt(arrayValue.value) - } - } - } -} - -/** - * StatisticsPacketEntries - * - * @param categoryId categoryId - * @param statisticId statisticId - * @param value value -*/ -data class StatisticsPacketEntries( - val categoryId: Int, // varint - val statisticId: Int, // varint - val value: Int, // varint -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StopSoundPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StopSoundPacket.kt deleted file mode 100644 index 03d873f..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/StopSoundPacket.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Stop Sound | 0x61 | play | clientbound - * - * @param flags flags - * @param source source - * @param sound sound - * @see https://wiki.vg/Protocol#Stop_Sound - */ - -@MinecraftPacket(id = 0x61, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class StopSoundPacket( - val flags: Byte, - val source: Int?, // varint - val sound: String?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): StopSoundPacket { - val flags = input.readByte() - val source = when (flags.toInt()) { - 3 -> input.readVarInt() - 1 -> input.readVarInt() - else -> null - } - val sound = when (flags.toInt()) { - 3 -> input.readString() - 2 -> input.readString() - else -> null - } - - return StopSoundPacket(flags, source, sound) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: StopSoundPacket) { - output.writeByte(value.flags) - when (value.flags.toInt()) { - 3 -> output.writeVarInt(value.source!!) - 1 -> output.writeVarInt(value.source!!) - else -> {} - } - when (value.flags.toInt()) { - 3 -> output.writeString(value.sound!!) - 2 -> output.writeString(value.sound!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SystemChatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SystemChatPacket.kt deleted file mode 100644 index e64ae01..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/SystemChatPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * System Chat Message | 0x62 | play | clientbound - * - * @param content content - * @param isActionBar isActionBar - * @see https://wiki.vg/Protocol#System_Chat_Message - */ - -@MinecraftPacket(id = 0x62, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class SystemChatPacket( - val content: String, - val isActionBar: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SystemChatPacket { - val content = input.readString() - val isActionBar = input.readBoolean() - - return SystemChatPacket(content, isActionBar) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SystemChatPacket) { - output.writeString(value.content) - output.writeBoolean(value.isActionBar) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TabCompletePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TabCompletePacket.kt deleted file mode 100644 index a6da1f0..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TabCompletePacket.kt +++ /dev/null @@ -1,65 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Command Suggestions Response | 0x0e | play | clientbound - * - * @param transactionId transactionId - * @param start start - * @param length length - * @param matches list of TabCompletePacketMatches - * @see https://wiki.vg/Protocol#Command_Suggestions_Response - */ - -@MinecraftPacket(id = 0x0e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class TabCompletePacket( - val transactionId: Int, // varint - val start: Int, // varint - val length: Int, // varint - val matches: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TabCompletePacket { - val transactionId = input.readVarInt() - val start = input.readVarInt() - val length = input.readVarInt() - val matches = input.readVarIntArray { arrayInput -> - val match = arrayInput.readString() - val hasTooltip = arrayInput.readBoolean() - val tooltip = if (hasTooltip) arrayInput.readString() else null - - return@readVarIntArray TabCompletePacketMatches(match, hasTooltip, tooltip) - } - - return TabCompletePacket(transactionId, start, length, matches) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TabCompletePacket) { - output.writeVarInt(value.transactionId) - output.writeVarInt(value.start) - output.writeVarInt(value.length) - - output.writeVarIntArray(value.matches) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.match) - arrayOutput.writeBoolean(arrayValue.hasTooltip) - if (arrayValue.hasTooltip) arrayOutput.writeString(arrayValue.tooltip!!) - } - } - } -} - -/** - * TabCompletePacketMatches - * - * @param match match - * @param hasTooltip tooltip is present - * @param tooltip tooltip -*/ -data class TabCompletePacketMatches( - val match: String, - val hasTooltip: Boolean, - val tooltip: String?, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TagsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TagsPacket.kt deleted file mode 100644 index add8c6e..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TagsPacket.kt +++ /dev/null @@ -1,44 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Tags | 0x6b | play | clientbound - * - * @param tags list of TagsPacketTags - * @see https://wiki.vg/Protocol#Update_Tags - */ - -@MinecraftPacket(id = 0x6b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class TagsPacket( - val tags: List, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TagsPacket { - val tags = input.readVarIntArray { arrayInput -> - val tagType = arrayInput.readString() - - return@readVarIntArray TagsPacketTags(tagType) - } - - return TagsPacket(tags) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TagsPacket) { - output.writeVarIntArray(value.tags) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.tagType) - } - } - } -} - -/** - * TagsPacketTags - * - * @param tagType tagType -*/ -data class TagsPacketTags( - val tagType: String, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TeamsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TeamsPacket.kt deleted file mode 100644 index d6e816b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TeamsPacket.kt +++ /dev/null @@ -1,131 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Teams | 0x58 | play | clientbound - * - * @param team team - * @param mode mode - * @param name name - * @param friendlyFire friendlyFire - * @param nameTagVisibility nameTagVisibility - * @param collisionRule collisionRule - * @param formatting formatting - * @param prefix prefix - * @param suffix suffix - * @param players players - * @see https://wiki.vg/Protocol#Update_Teams - */ - -@MinecraftPacket(id = 0x58, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class TeamsPacket( - val team: String, - val mode: Byte, - val name: String?, - val friendlyFire: Byte?, - val nameTagVisibility: String?, - val collisionRule: String?, - val formatting: Int?, // varint - val prefix: String?, - val suffix: String?, - val players: List?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TeamsPacket { - val team = input.readString() - val mode = input.readByte() - val name = when (mode.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val friendlyFire = when (mode.toInt()) { - 0 -> input.readByte() - 2 -> input.readByte() - else -> null - } - val nameTagVisibility = when (mode.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val collisionRule = when (mode.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val formatting = when (mode.toInt()) { - 0 -> input.readVarInt() - 2 -> input.readVarInt() - else -> null - } - val prefix = when (mode.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val suffix = when (mode.toInt()) { - 0 -> input.readString() - 2 -> input.readString() - else -> null - } - val players = when (mode.toInt()) { - 0 -> input.readVarIntArray { arrayInput -> arrayInput.readString() } - 3 -> input.readVarIntArray { arrayInput -> arrayInput.readString() } - 4 -> input.readVarIntArray { arrayInput -> arrayInput.readString() } - else -> null - } - - return TeamsPacket(team, mode, name, friendlyFire, nameTagVisibility, collisionRule, formatting, prefix, suffix, players) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TeamsPacket) { - output.writeString(value.team) - output.writeByte(value.mode) - when (value.mode.toInt()) { - 0 -> output.writeString(value.name!!) - 2 -> output.writeString(value.name!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeByte(value.friendlyFire!!) - 2 -> output.writeByte(value.friendlyFire!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeString(value.nameTagVisibility!!) - 2 -> output.writeString(value.nameTagVisibility!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeString(value.collisionRule!!) - 2 -> output.writeString(value.collisionRule!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeVarInt(value.formatting!!) - 2 -> output.writeVarInt(value.formatting!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeString(value.prefix!!) - 2 -> output.writeString(value.prefix!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeString(value.suffix!!) - 2 -> output.writeString(value.suffix!!) - else -> {} - } - when (value.mode.toInt()) { - 0 -> output.writeVarIntArray(value.players!!) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - 3 -> output.writeVarIntArray(value.players!!) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - 4 -> output.writeVarIntArray(value.players!!) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TileEntityDataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TileEntityDataPacket.kt deleted file mode 100644 index f3dee73..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TileEntityDataPacket.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.NBT -import io.layercraft.packetlib.types.Position -/** - * Block Entity Data | 0x07 | play | clientbound - * - * @param location location - * @param action action - * @param nbtData nbtData - * @see https://wiki.vg/Protocol#Block_Entity_Data - */ - -@MinecraftPacket(id = 0x07, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class TileEntityDataPacket( - val location: Position, - val action: Int, // varint - val nbtData: NBT, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TileEntityDataPacket { - val location = input.readPosition() - val action = input.readVarInt() - val nbtData = input.readNbt() - - return TileEntityDataPacket(location, action, nbtData) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TileEntityDataPacket) { - output.writePosition(value.location) - output.writeVarInt(value.action) - output.writeNbt(value.nbtData) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TradeListPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TradeListPacket.kt deleted file mode 100644 index 4721c29..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/TradeListPacket.kt +++ /dev/null @@ -1,90 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Merchant Offers | 0x27 | play | clientbound - * - * @param windowId windowId - * @param trades list of TradeListPacketTrades - * @param villagerLevel villagerLevel - * @param experience experience - * @param isRegularVillager isRegularVillager - * @param canRestock canRestock - * @see https://wiki.vg/Protocol#Merchant_Offers - */ - -@MinecraftPacket(id = 0x27, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class TradeListPacket( - val windowId: Int, // varint - val trades: List, // varint array - val villagerLevel: Int, // varint - val experience: Int, // varint - val isRegularVillager: Boolean, - val canRestock: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TradeListPacket { - val windowId = input.readVarInt() - val trades = input.readVarIntArray { arrayInput -> - val tradeDisabled = arrayInput.readBoolean() - val nbTradeUses = arrayInput.readInt() - val maximumNbTradeUses = arrayInput.readInt() - val xp = arrayInput.readInt() - val specialPrice = arrayInput.readInt() - val priceMultiplier = arrayInput.readFloat() - val demand = arrayInput.readInt() - - return@readVarIntArray TradeListPacketTrades(tradeDisabled, nbTradeUses, maximumNbTradeUses, xp, specialPrice, priceMultiplier, demand) - } - val villagerLevel = input.readVarInt() - val experience = input.readVarInt() - val isRegularVillager = input.readBoolean() - val canRestock = input.readBoolean() - - return TradeListPacket(windowId, trades, villagerLevel, experience, isRegularVillager, canRestock) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TradeListPacket) { - output.writeVarInt(value.windowId) - - output.writeVarIntArray(value.trades) { arrayValue, arrayOutput -> - arrayOutput.writeBoolean(arrayValue.tradeDisabled) - arrayOutput.writeInt(arrayValue.nbTradeUses) - arrayOutput.writeInt(arrayValue.maximumNbTradeUses) - arrayOutput.writeInt(arrayValue.xp) - arrayOutput.writeInt(arrayValue.specialPrice) - arrayOutput.writeFloat(arrayValue.priceMultiplier) - arrayOutput.writeInt(arrayValue.demand) - } - - output.writeVarInt(value.villagerLevel) - output.writeVarInt(value.experience) - output.writeBoolean(value.isRegularVillager) - output.writeBoolean(value.canRestock) - } - } -} - -/** - * TradeListPacketTrades - * - * @param tradeDisabled tradeDisabled - * @param nbTradeUses nbTradeUses - * @param maximumNbTradeUses maximumNbTradeUses - * @param xp xp - * @param specialPrice specialPrice - * @param priceMultiplier priceMultiplier - * @param demand demand -*/ -data class TradeListPacketTrades( - val tradeDisabled: Boolean, - val nbTradeUses: Int, - val maximumNbTradeUses: Int, - val xp: Int, - val specialPrice: Int, - val priceMultiplier: Float, - val demand: Int, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnloadChunkPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnloadChunkPacket.kt deleted file mode 100644 index 82e562f..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnloadChunkPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Unload Chunk | 0x1c | play | clientbound - * - * @param chunkX chunkX - * @param chunkZ chunkZ - * @see https://wiki.vg/Protocol#Unload_Chunk - */ - -@MinecraftPacket(id = 0x1c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UnloadChunkPacket( - val chunkX: Int, - val chunkZ: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UnloadChunkPacket { - val chunkX = input.readInt() - val chunkZ = input.readInt() - - return UnloadChunkPacket(chunkX, chunkZ) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UnloadChunkPacket) { - output.writeInt(value.chunkX) - output.writeInt(value.chunkZ) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnlockRecipesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnlockRecipesPacket.kt deleted file mode 100644 index a752920..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UnlockRecipesPacket.kt +++ /dev/null @@ -1,75 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Recipe Book | 0x3a | play | clientbound - * - * @param action action - * @param craftingBookOpen craftingBookOpen - * @param filteringCraftable filteringCraftable - * @param smeltingBookOpen smeltingBookOpen - * @param filteringSmeltable filteringSmeltable - * @param blastFurnaceOpen blastFurnaceOpen - * @param filteringBlastFurnace filteringBlastFurnace - * @param smokerBookOpen smokerBookOpen - * @param filteringSmoker filteringSmoker - * @param recipes1 recipes1 - * @param recipes2 recipes2 - * @see https://wiki.vg/Protocol#Update_Recipe_Book - */ - -@MinecraftPacket(id = 0x3a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UnlockRecipesPacket( - val action: Int, // varint - val craftingBookOpen: Boolean, - val filteringCraftable: Boolean, - val smeltingBookOpen: Boolean, - val filteringSmeltable: Boolean, - val blastFurnaceOpen: Boolean, - val filteringBlastFurnace: Boolean, - val smokerBookOpen: Boolean, - val filteringSmoker: Boolean, - val recipes1: List, // varint array - val recipes2: List?, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UnlockRecipesPacket { - val action = input.readVarInt() - val craftingBookOpen = input.readBoolean() - val filteringCraftable = input.readBoolean() - val smeltingBookOpen = input.readBoolean() - val filteringSmeltable = input.readBoolean() - val blastFurnaceOpen = input.readBoolean() - val filteringBlastFurnace = input.readBoolean() - val smokerBookOpen = input.readBoolean() - val filteringSmoker = input.readBoolean() - val recipes1 = input.readVarIntArray { arrayInput -> arrayInput.readString() } - val recipes2 = when (action) { - 0 -> input.readVarIntArray { arrayInput -> arrayInput.readString() } - else -> null - } - - return UnlockRecipesPacket(action, craftingBookOpen, filteringCraftable, smeltingBookOpen, filteringSmeltable, blastFurnaceOpen, filteringBlastFurnace, smokerBookOpen, filteringSmoker, recipes1, recipes2) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UnlockRecipesPacket) { - output.writeVarInt(value.action) - output.writeBoolean(value.craftingBookOpen) - output.writeBoolean(value.filteringCraftable) - output.writeBoolean(value.smeltingBookOpen) - output.writeBoolean(value.filteringSmeltable) - output.writeBoolean(value.blastFurnaceOpen) - output.writeBoolean(value.filteringBlastFurnace) - output.writeBoolean(value.smokerBookOpen) - output.writeBoolean(value.filteringSmoker) - output.writeVarIntArray(value.recipes1) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - when (value.action) { - 0 -> output.writeVarIntArray(value.recipes2!!) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateHealthPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateHealthPacket.kt deleted file mode 100644 index 54f8388..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateHealthPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Health | 0x55 | play | clientbound - * - * @param health health - * @param food food - * @param foodSaturation foodSaturation - * @see https://wiki.vg/Protocol#Set_Health - */ - -@MinecraftPacket(id = 0x55, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UpdateHealthPacket( - val health: Float, - val food: Int, // varint - val foodSaturation: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateHealthPacket { - val health = input.readFloat() - val food = input.readVarInt() - val foodSaturation = input.readFloat() - - return UpdateHealthPacket(health, food, foodSaturation) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateHealthPacket) { - output.writeFloat(value.health) - output.writeVarInt(value.food) - output.writeFloat(value.foodSaturation) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateLightPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateLightPacket.kt deleted file mode 100644 index c3cc144..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateLightPacket.kt +++ /dev/null @@ -1,61 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Light | 0x24 | play | clientbound - * - * @param chunkX chunkX - * @param chunkZ chunkZ - * @param trustEdges trustEdges - * @param skyLightMask skyLightMask - * @param blockLightMask blockLightMask - * @param emptySkyLightMask emptySkyLightMask - * @param emptyBlockLightMask emptyBlockLightMask - * @param skyLight skyLight - * @param blockLight blockLight - * @see https://wiki.vg/Protocol#Update_Light - */ - -@MinecraftPacket(id = 0x24, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UpdateLightPacket( - val chunkX: Int, // varint - val chunkZ: Int, // varint - val trustEdges: Boolean, - val skyLightMask: List, // varint array - val blockLightMask: List, // varint array - val emptySkyLightMask: List, // varint array - val emptyBlockLightMask: List, // varint array - val skyLight: List>, // varint array - val blockLight: List>, // varint array -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateLightPacket { - val chunkX = input.readVarInt() - val chunkZ = input.readVarInt() - val trustEdges = input.readBoolean() - val skyLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val blockLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val emptySkyLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val emptyBlockLightMask = input.readVarIntArray { arrayInput -> arrayInput.readLong() } - val skyLight = input.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readUByte() } } - val blockLight = input.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readUByte() } } - - return UpdateLightPacket(chunkX, chunkZ, trustEdges, skyLightMask, blockLightMask, emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateLightPacket) { - output.writeVarInt(value.chunkX) - output.writeVarInt(value.chunkZ) - output.writeBoolean(value.trustEdges) - output.writeVarIntArray(value.skyLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.blockLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.emptySkyLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.emptyBlockLightMask) { arrayValue, arrayOutput -> arrayOutput.writeLong(arrayValue) } - output.writeVarIntArray(value.skyLight) { arrayValue1, arrayOutput1 -> arrayOutput1.writeVarIntArray(arrayValue1) { arrayValue, arrayOutput -> arrayOutput.writeUByte(arrayValue) } } - output.writeVarIntArray(value.blockLight) { arrayValue1, arrayOutput1 -> arrayOutput1.writeVarIntArray(arrayValue1) { arrayValue, arrayOutput -> arrayOutput.writeUByte(arrayValue) } } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateTimePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateTimePacket.kt deleted file mode 100644 index 80e6d69..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateTimePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Update Time | 0x5c | play | clientbound - * - * @param age age - * @param time time - * @see https://wiki.vg/Protocol#Update_Time - */ - -@MinecraftPacket(id = 0x5c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UpdateTimePacket( - val age: Long, - val time: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateTimePacket { - val age = input.readLong() - val time = input.readLong() - - return UpdateTimePacket(age, time) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateTimePacket) { - output.writeLong(value.age) - output.writeLong(value.time) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewDistancePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewDistancePacket.kt deleted file mode 100644 index 19ddc40..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewDistancePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Render Distance | 0x4c | play | clientbound - * - * @param viewDistance viewDistance - * @see https://wiki.vg/Protocol#Set_Render_Distance - */ - -@MinecraftPacket(id = 0x4c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UpdateViewDistancePacket( - val viewDistance: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateViewDistancePacket { - val viewDistance = input.readVarInt() - - return UpdateViewDistancePacket(viewDistance) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateViewDistancePacket) { - output.writeVarInt(value.viewDistance) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewPositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewPositionPacket.kt deleted file mode 100644 index 52ede67..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/UpdateViewPositionPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Center Chunk | 0x4b | play | clientbound - * - * @param chunkX chunkX - * @param chunkZ chunkZ - * @see https://wiki.vg/Protocol#Set_Center_Chunk - */ - -@MinecraftPacket(id = 0x4b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class UpdateViewPositionPacket( - val chunkX: Int, // varint - val chunkZ: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateViewPositionPacket { - val chunkX = input.readVarInt() - val chunkZ = input.readVarInt() - - return UpdateViewPositionPacket(chunkX, chunkZ) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateViewPositionPacket) { - output.writeVarInt(value.chunkX) - output.writeVarInt(value.chunkZ) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/VehicleMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/VehicleMovePacket.kt deleted file mode 100644 index 9224474..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/VehicleMovePacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Move Vehicle (clientbound) | 0x2b | play | clientbound - * - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @see https://wiki.vg/Protocol#Move_Vehicle_.28clientbound.29 - */ - -@MinecraftPacket(id = 0x2b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class VehicleMovePacket( - val x: Double, - val y: Double, - val z: Double, - val yaw: Float, - val pitch: Float, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): VehicleMovePacket { - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readFloat() - val pitch = input.readFloat() - - return VehicleMovePacket(x, y, z, yaw, pitch) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: VehicleMovePacket) { - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeFloat(value.yaw) - output.writeFloat(value.pitch) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WindowItemsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WindowItemsPacket.kt deleted file mode 100644 index dc2ef66..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WindowItemsPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Container Content | 0x11 | play | clientbound - * - * @param windowId windowId - * @param stateId stateId - * @see https://wiki.vg/Protocol#Set_Container_Content - */ - -@MinecraftPacket(id = 0x11, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WindowItemsPacket( - val windowId: UByte, - val stateId: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WindowItemsPacket { - val windowId = input.readUByte() - val stateId = input.readVarInt() - - return WindowItemsPacket(windowId, stateId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WindowItemsPacket) { - output.writeUByte(value.windowId) - output.writeVarInt(value.stateId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderCenterPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderCenterPacket.kt deleted file mode 100644 index e5324fa..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderCenterPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Border Center | 0x44 | play | clientbound - * - * @param x x - * @param z z - * @see https://wiki.vg/Protocol#Set_Border_Center - */ - -@MinecraftPacket(id = 0x44, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldBorderCenterPacket( - val x: Double, - val z: Double, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderCenterPacket { - val x = input.readDouble() - val z = input.readDouble() - - return WorldBorderCenterPacket(x, z) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderCenterPacket) { - output.writeDouble(value.x) - output.writeDouble(value.z) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderLerpSizePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderLerpSizePacket.kt deleted file mode 100644 index c89df13..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderLerpSizePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Border Lerp Size | 0x45 | play | clientbound - * - * @param oldDiameter oldDiameter - * @param newDiameter newDiameter - * @param speed speed - * @see https://wiki.vg/Protocol#Set_Border_Lerp_Size - */ - -@MinecraftPacket(id = 0x45, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldBorderLerpSizePacket( - val oldDiameter: Double, - val newDiameter: Double, - val speed: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderLerpSizePacket { - val oldDiameter = input.readDouble() - val newDiameter = input.readDouble() - val speed = input.readVarInt() - - return WorldBorderLerpSizePacket(oldDiameter, newDiameter, speed) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderLerpSizePacket) { - output.writeDouble(value.oldDiameter) - output.writeDouble(value.newDiameter) - output.writeVarInt(value.speed) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderSizePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderSizePacket.kt deleted file mode 100644 index 68ecd48..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderSizePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Border Size | 0x46 | play | clientbound - * - * @param diameter diameter - * @see https://wiki.vg/Protocol#Set_Border_Size - */ - -@MinecraftPacket(id = 0x46, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldBorderSizePacket( - val diameter: Double, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderSizePacket { - val diameter = input.readDouble() - - return WorldBorderSizePacket(diameter) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderSizePacket) { - output.writeDouble(value.diameter) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningDelayPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningDelayPacket.kt deleted file mode 100644 index afbb1a5..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningDelayPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Border Warning Delay | 0x47 | play | clientbound - * - * @param warningTime warningTime - * @see https://wiki.vg/Protocol#Set_Border_Warning_Delay - */ - -@MinecraftPacket(id = 0x47, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldBorderWarningDelayPacket( - val warningTime: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderWarningDelayPacket { - val warningTime = input.readVarInt() - - return WorldBorderWarningDelayPacket(warningTime) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderWarningDelayPacket) { - output.writeVarInt(value.warningTime) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningReachPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningReachPacket.kt deleted file mode 100644 index 717cf5c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldBorderWarningReachPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Border Warning Distance | 0x48 | play | clientbound - * - * @param warningBlocks warningBlocks - * @see https://wiki.vg/Protocol#Set_Border_Warning_Distance - */ - -@MinecraftPacket(id = 0x48, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldBorderWarningReachPacket( - val warningBlocks: Int, // varint -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderWarningReachPacket { - val warningBlocks = input.readVarInt() - - return WorldBorderWarningReachPacket(warningBlocks) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderWarningReachPacket) { - output.writeVarInt(value.warningBlocks) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldEventPacket.kt deleted file mode 100644 index 5ad3ca8..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldEventPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * World Event | 0x22 | play | clientbound - * - * @param effectId effectId - * @param location location - * @param data data - * @param global global - * @see https://wiki.vg/Protocol#World_Event - */ - -@MinecraftPacket(id = 0x22, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldEventPacket( - val effectId: Int, - val location: Position, - val data: Int, - val global: Boolean, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldEventPacket { - val effectId = input.readInt() - val location = input.readPosition() - val data = input.readInt() - val global = input.readBoolean() - - return WorldEventPacket(effectId, location, data, global) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldEventPacket) { - output.writeInt(value.effectId) - output.writePosition(value.location) - output.writeInt(value.data) - output.writeBoolean(value.global) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldParticlesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldParticlesPacket.kt deleted file mode 100644 index 8100032..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/clientbound/WorldParticlesPacket.kt +++ /dev/null @@ -1,65 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Particle | 0x23 | play | clientbound - * - * @param particleId particleId - * @param longDistance longDistance - * @param x x - * @param y y - * @param z z - * @param offsetX offsetX - * @param offsetY offsetY - * @param offsetZ offsetZ - * @param particleData particleData - * @param particles particles - * @see https://wiki.vg/Protocol#Particle_2 - */ - -@MinecraftPacket(id = 0x23, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) -data class WorldParticlesPacket( - val particleId: Int, // varint - val longDistance: Boolean, - val x: Double, - val y: Double, - val z: Double, - val offsetX: Float, - val offsetY: Float, - val offsetZ: Float, - val particleData: Float, - val particles: Int, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldParticlesPacket { - val particleId = input.readVarInt() - val longDistance = input.readBoolean() - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val offsetX = input.readFloat() - val offsetY = input.readFloat() - val offsetZ = input.readFloat() - val particleData = input.readFloat() - val particles = input.readInt() - - return WorldParticlesPacket(particleId, longDistance, x, y, z, offsetX, offsetY, offsetZ, particleData, particles) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldParticlesPacket) { - output.writeVarInt(value.particleId) - output.writeBoolean(value.longDistance) - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeFloat(value.offsetX) - output.writeFloat(value.offsetY) - output.writeFloat(value.offsetZ) - output.writeFloat(value.particleData) - output.writeInt(value.particles) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AbilitiesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AbilitiesPacket.kt deleted file mode 100644 index 9ddb1b7..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AbilitiesPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Player Abilities (serverbound) | 0x1c | play | serverbound - * - * @param flags flags - * @see https://wiki.vg/Protocol#Player_Abilities_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x1c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class AbilitiesPacket( - val flags: Byte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AbilitiesPacket { - val flags = input.readByte() - - return AbilitiesPacket(flags) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AbilitiesPacket) { - output.writeByte(value.flags) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AdvancementTabPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AdvancementTabPacket.kt deleted file mode 100644 index 289945c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/AdvancementTabPacket.kt +++ /dev/null @@ -1,40 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Seen Advancements | 0x25 | play | serverbound - * - * @param action action - * @param tabId tabId - * @see https://wiki.vg/Protocol#Seen_Advancements - */ - -@MinecraftPacket(id = 0x25, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class AdvancementTabPacket( - val action: Int, // varint - val tabId: String?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AdvancementTabPacket { - val action = input.readVarInt() - val tabId = when (action) { - 0 -> input.readString() - 1 -> null - else -> null - } - - return AdvancementTabPacket(action, tabId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AdvancementTabPacket) { - output.writeVarInt(value.action) - when (value.action) { - 0 -> output.writeString(value.tabId!!) - else -> {} - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ArmAnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ArmAnimationPacket.kt deleted file mode 100644 index 0a7eae1..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ArmAnimationPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Swing Arm | 0x2f | play | serverbound - * - * @param hand hand - * @see https://wiki.vg/Protocol#Swing_Arm - */ - -@MinecraftPacket(id = 0x2f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ArmAnimationPacket( - val hand: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ArmAnimationPacket { - val hand = input.readVarInt() - - return ArmAnimationPacket(hand) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ArmAnimationPacket) { - output.writeVarInt(value.hand) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockDigPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockDigPacket.kt deleted file mode 100644 index 109459f..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockDigPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Player Action | 0x1d | play | serverbound - * - * @param status status - * @param location location - * @param face face - * @param sequence sequence - * @see https://wiki.vg/Protocol#Player_Action - */ - -@MinecraftPacket(id = 0x1d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class BlockDigPacket( - val status: Int, // varint - val location: Position, - val face: Byte, - val sequence: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockDigPacket { - val status = input.readVarInt() - val location = input.readPosition() - val face = input.readByte() - val sequence = input.readVarInt() - - return BlockDigPacket(status, location, face, sequence) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockDigPacket) { - output.writeVarInt(value.status) - output.writePosition(value.location) - output.writeByte(value.face) - output.writeVarInt(value.sequence) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockPlacePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockPlacePacket.kt deleted file mode 100644 index d1a64da..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/BlockPlacePacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Use Item On | 0x31 | play | serverbound - * - * @param hand hand - * @param location location - * @param direction direction - * @param cursorX cursorX - * @param cursorY cursorY - * @param cursorZ cursorZ - * @param insideBlock insideBlock - * @param sequence sequence - * @see https://wiki.vg/Protocol#Use_Item_On - */ - -@MinecraftPacket(id = 0x31, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class BlockPlacePacket( - val hand: Int, // varint - val location: Position, - val direction: Int, // varint - val cursorX: Float, - val cursorY: Float, - val cursorZ: Float, - val insideBlock: Boolean, - val sequence: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockPlacePacket { - val hand = input.readVarInt() - val location = input.readPosition() - val direction = input.readVarInt() - val cursorX = input.readFloat() - val cursorY = input.readFloat() - val cursorZ = input.readFloat() - val insideBlock = input.readBoolean() - val sequence = input.readVarInt() - - return BlockPlacePacket(hand, location, direction, cursorX, cursorY, cursorZ, insideBlock, sequence) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockPlacePacket) { - output.writeVarInt(value.hand) - output.writePosition(value.location) - output.writeVarInt(value.direction) - output.writeFloat(value.cursorX) - output.writeFloat(value.cursorY) - output.writeFloat(value.cursorZ) - output.writeBoolean(value.insideBlock) - output.writeVarInt(value.sequence) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatCommandPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatCommandPacket.kt deleted file mode 100644 index dbc323d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatCommandPacket.kt +++ /dev/null @@ -1,78 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Chat Command | 0x04 | play | serverbound - * - * @param command command - * @param timestamp timestamp - * @param salt salt - * @param argumentSignatures list of ChatCommandPacketArgumentSignatures - * @param signedPreview signedPreview - * @param hasLastRejectedMessage lastRejectedMessage is present - * @param sender sender - * @param signature signature - * @see https://wiki.vg/Protocol#Chat_Command - */ - -@MinecraftPacket(id = 0x04, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ChatCommandPacket( - val command: String, - val timestamp: Long, - val salt: Long, - val argumentSignatures: List, // varint array - val signedPreview: Boolean, - val hasLastRejectedMessage: Boolean, - val sender: UUID?, - val signature: ByteArray?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatCommandPacket { - val command = input.readString() - val timestamp = input.readLong() - val salt = input.readLong() - val argumentSignatures = input.readVarIntArray { arrayInput -> - val argumentName = arrayInput.readString() - val signature = arrayInput.readVarIntByteArray() - - return@readVarIntArray ChatCommandPacketArgumentSignatures(argumentName, signature) - } - val signedPreview = input.readBoolean() - val hasLastRejectedMessage = input.readBoolean() - val sender = if (hasLastRejectedMessage) input.readUUID() else null - val signature = if (hasLastRejectedMessage) input.readVarIntByteArray() else null - - return ChatCommandPacket(command, timestamp, salt, argumentSignatures, signedPreview, hasLastRejectedMessage, sender, signature) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatCommandPacket) { - output.writeString(value.command) - output.writeLong(value.timestamp) - output.writeLong(value.salt) - - output.writeVarIntArray(value.argumentSignatures) { arrayValue, arrayOutput -> - arrayOutput.writeString(arrayValue.argumentName) - arrayOutput.writeVarIntByteArray(arrayValue.signature) - } - - output.writeBoolean(value.signedPreview) - output.writeBoolean(value.hasLastRejectedMessage) - if (value.hasLastRejectedMessage) output.writeUUID(value.sender!!) - if (value.hasLastRejectedMessage) output.writeVarIntByteArray(value.signature!!) - } - } -} - -/** - * ChatCommandPacketArgumentSignatures - * - * @param argumentName argumentName - * @param signature signature -*/ -data class ChatCommandPacketArgumentSignatures( - val argumentName: String, - val signature: ByteArray, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatMessagePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatMessagePacket.kt deleted file mode 100644 index baa37ac..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatMessagePacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Chat Message | 0x05 | play | serverbound - * - * @param message message - * @param timestamp timestamp - * @param salt salt - * @param signature signature - * @param signedPreview signedPreview - * @param hasLastRejectedMessage lastRejectedMessage is present - * @param sender sender - * @param signature signature - * @see https://wiki.vg/Protocol#Chat_Message - */ - -@MinecraftPacket(id = 0x05, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ChatMessagePacket( - val message: String, - val timestamp: Long, - val salt: Long, - val signature: ByteArray, - val signedPreview: Boolean, - val hasLastRejectedMessage: Boolean, - val sender: UUID?, - val signature2: ByteArray?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatMessagePacket { - val message = input.readString() - val timestamp = input.readLong() - val salt = input.readLong() - val signature = input.readVarIntByteArray() - val signedPreview = input.readBoolean() - val hasLastRejectedMessage = input.readBoolean() - val sender = if (hasLastRejectedMessage) input.readUUID() else null - val signature2 = if (hasLastRejectedMessage) input.readVarIntByteArray() else null - - return ChatMessagePacket(message, timestamp, salt, signature, signedPreview, hasLastRejectedMessage, sender, signature2) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatMessagePacket) { - output.writeString(value.message) - output.writeLong(value.timestamp) - output.writeLong(value.salt) - output.writeVarIntByteArray(value.signature) - output.writeBoolean(value.signedPreview) - output.writeBoolean(value.hasLastRejectedMessage) - if (value.hasLastRejectedMessage) output.writeUUID(value.sender!!) - if (value.hasLastRejectedMessage) output.writeVarIntByteArray(value.signature2!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatPreviewPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatPreviewPacket.kt deleted file mode 100644 index a8ae56d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ChatPreviewPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Chat Preview (serverbound) | 0x06 | play | serverbound - * - * @param query query - * @param message message - * @see https://wiki.vg/Protocol#Chat_Preview_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x06, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ChatPreviewPacket( - val query: Int, - val message: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatPreviewPacket { - val query = input.readInt() - val message = input.readString() - - return ChatPreviewPacket(query, message) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatPreviewPacket) { - output.writeInt(value.query) - output.writeString(value.message) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ClientCommandPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ClientCommandPacket.kt deleted file mode 100644 index 8c4e81a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ClientCommandPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Client Command | 0x07 | play | serverbound - * - * @param actionId actionId - * @see https://wiki.vg/Protocol#Client_Command - */ - -@MinecraftPacket(id = 0x07, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ClientCommandPacket( - val actionId: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ClientCommandPacket { - val actionId = input.readVarInt() - - return ClientCommandPacket(actionId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ClientCommandPacket) { - output.writeVarInt(value.actionId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CloseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CloseWindowPacket.kt deleted file mode 100644 index 3092915..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CloseWindowPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Close Container (serverbound) | 0x0c | play | serverbound - * - * @param windowId windowId - * @see https://wiki.vg/Protocol#Close_Container_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x0c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class CloseWindowPacket( - val windowId: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CloseWindowPacket { - val windowId = input.readUByte() - - return CloseWindowPacket(windowId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CloseWindowPacket) { - output.writeUByte(value.windowId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CraftRecipeRequestPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CraftRecipeRequestPacket.kt deleted file mode 100644 index 62d15c9..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CraftRecipeRequestPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Place Recipe | 0x1b | play | serverbound - * - * @param windowId windowId - * @param recipe recipe - * @param makeAll makeAll - * @see https://wiki.vg/Protocol#Place_Recipe - */ - -@MinecraftPacket(id = 0x1b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class CraftRecipeRequestPacket( - val windowId: Byte, - val recipe: String, - val makeAll: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftRecipeRequestPacket { - val windowId = input.readByte() - val recipe = input.readString() - val makeAll = input.readBoolean() - - return CraftRecipeRequestPacket(windowId, recipe, makeAll) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftRecipeRequestPacket) { - output.writeByte(value.windowId) - output.writeString(value.recipe) - output.writeBoolean(value.makeAll) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CustomPayloadPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CustomPayloadPacket.kt deleted file mode 100644 index 8b54bfd..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/CustomPayloadPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Plugin Message (serverbound) | 0x0d | play | serverbound - * - * @param channel channel - * @param data data - * @see https://wiki.vg/Protocol#Plugin_Message_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x0d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class CustomPayloadPacket( - val channel: String, - val data: ByteArray, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CustomPayloadPacket { - val channel = input.readString() - val data = input.readRemainingByteArray() - - return CustomPayloadPacket(channel, data) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CustomPayloadPacket) { - output.writeString(value.channel) - output.writeRemainingByteArray(value.data) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/DisplayedRecipePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/DisplayedRecipePacket.kt deleted file mode 100644 index 88ccbae..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/DisplayedRecipePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Seen Recipe | 0x22 | play | serverbound - * - * @param recipeId recipeId - * @see https://wiki.vg/Protocol#Set_Seen_Recipe - */ - -@MinecraftPacket(id = 0x22, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class DisplayedRecipePacket( - val recipeId: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DisplayedRecipePacket { - val recipeId = input.readString() - - return DisplayedRecipePacket(recipeId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DisplayedRecipePacket) { - output.writeString(value.recipeId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EditBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EditBookPacket.kt deleted file mode 100644 index 90b5fa1..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EditBookPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Edit Book | 0x0e | play | serverbound - * - * @param hand hand - * @param pages pages - * @param hasTitle title is present - * @param title title - * @see https://wiki.vg/Protocol#Edit_Book - */ - -@MinecraftPacket(id = 0x0e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class EditBookPacket( - val hand: Int, // varint - val pages: List, // varint array - val hasTitle: Boolean, - val title: String?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EditBookPacket { - val hand = input.readVarInt() - val pages = input.readVarIntArray { arrayInput -> arrayInput.readString() } - val hasTitle = input.readBoolean() - val title = if (hasTitle) input.readString() else null - - return EditBookPacket(hand, pages, hasTitle, title) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EditBookPacket) { - output.writeVarInt(value.hand) - output.writeVarIntArray(value.pages) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } - output.writeBoolean(value.hasTitle) - if (value.hasTitle) output.writeString(value.title!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EnchantItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EnchantItemPacket.kt deleted file mode 100644 index 6642905..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EnchantItemPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Click Container Button | 0x0a | play | serverbound - * - * @param windowId windowId - * @param enchantment enchantment - * @see https://wiki.vg/Protocol#Click_Container_Button - */ - -@MinecraftPacket(id = 0x0a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class EnchantItemPacket( - val windowId: Byte, - val enchantment: Byte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EnchantItemPacket { - val windowId = input.readByte() - val enchantment = input.readByte() - - return EnchantItemPacket(windowId, enchantment) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EnchantItemPacket) { - output.writeByte(value.windowId) - output.writeByte(value.enchantment) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EntityActionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EntityActionPacket.kt deleted file mode 100644 index c211a3d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/EntityActionPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Player Command | 0x1e | play | serverbound - * - * @param entityId entityId - * @param actionId actionId - * @param jumpBoost jumpBoost - * @see https://wiki.vg/Protocol#Player_Command - */ - -@MinecraftPacket(id = 0x1e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class EntityActionPacket( - val entityId: Int, // varint - val actionId: Int, // varint - val jumpBoost: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityActionPacket { - val entityId = input.readVarInt() - val actionId = input.readVarInt() - val jumpBoost = input.readVarInt() - - return EntityActionPacket(entityId, actionId, jumpBoost) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityActionPacket) { - output.writeVarInt(value.entityId) - output.writeVarInt(value.actionId) - output.writeVarInt(value.jumpBoost) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/FlyingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/FlyingPacket.kt deleted file mode 100644 index 494a14c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/FlyingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Player On Ground | 0x17 | play | serverbound - * - * @param onGround onGround - * @see https://wiki.vg/Protocol#Set_Player_On_Ground - */ - -@MinecraftPacket(id = 0x17, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class FlyingPacket( - val onGround: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): FlyingPacket { - val onGround = input.readBoolean() - - return FlyingPacket(onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: FlyingPacket) { - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/GenerateStructurePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/GenerateStructurePacket.kt deleted file mode 100644 index fcb9a33..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/GenerateStructurePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Jigsaw Generate | 0x11 | play | serverbound - * - * @param location location - * @param levels levels - * @param keepJigsaws keepJigsaws - * @see https://wiki.vg/Protocol#Jigsaw_Generate - */ - -@MinecraftPacket(id = 0x11, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class GenerateStructurePacket( - val location: Position, - val levels: Int, // varint - val keepJigsaws: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): GenerateStructurePacket { - val location = input.readPosition() - val levels = input.readVarInt() - val keepJigsaws = input.readBoolean() - - return GenerateStructurePacket(location, levels, keepJigsaws) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: GenerateStructurePacket) { - output.writePosition(value.location) - output.writeVarInt(value.levels) - output.writeBoolean(value.keepJigsaws) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/HeldItemSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/HeldItemSlotPacket.kt deleted file mode 100644 index 54094ab..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/HeldItemSlotPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Held Item (serverbound) | 0x28 | play | serverbound - * - * @param slotId slotId - * @see https://wiki.vg/Protocol#Set_Held_Item_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x28, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class HeldItemSlotPacket( - val slotId: Short, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): HeldItemSlotPacket { - val slotId = input.readShort() - - return HeldItemSlotPacket(slotId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: HeldItemSlotPacket) { - output.writeShort(value.slotId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/KeepAlivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/KeepAlivePacket.kt deleted file mode 100644 index 2912830..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/KeepAlivePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Keep Alive (serverbound) | 0x12 | play | serverbound - * - * @param keepAliveId keepAliveId - * @see https://wiki.vg/Protocol#Keep_Alive_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x12, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class KeepAlivePacket( - val keepAliveId: Long, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KeepAlivePacket { - val keepAliveId = input.readLong() - - return KeepAlivePacket(keepAliveId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KeepAlivePacket) { - output.writeLong(value.keepAliveId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LockDifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LockDifficultyPacket.kt deleted file mode 100644 index cb269c9..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LockDifficultyPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Lock Difficulty | 0x13 | play | serverbound - * - * @param locked locked - * @see https://wiki.vg/Protocol#Lock_Difficulty - */ - -@MinecraftPacket(id = 0x13, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class LockDifficultyPacket( - val locked: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LockDifficultyPacket { - val locked = input.readBoolean() - - return LockDifficultyPacket(locked) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LockDifficultyPacket) { - output.writeBoolean(value.locked) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LookPacket.kt deleted file mode 100644 index c2dbfa3..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/LookPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Player Rotation | 0x16 | play | serverbound - * - * @param yaw yaw - * @param pitch pitch - * @param onGround onGround - * @see https://wiki.vg/Protocol#Set_Player_Rotation - */ - -@MinecraftPacket(id = 0x16, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class LookPacket( - val yaw: Float, - val pitch: Float, - val onGround: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LookPacket { - val yaw = input.readFloat() - val pitch = input.readFloat() - val onGround = input.readBoolean() - - return LookPacket(yaw, pitch, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LookPacket) { - output.writeFloat(value.yaw) - output.writeFloat(value.pitch) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/MessageAcknowledgementPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/MessageAcknowledgementPacket.kt deleted file mode 100644 index ab42154..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/MessageAcknowledgementPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Message Acknowledgment | 0x03 | play | serverbound - * - * @param hasLastRejectedMessage lastRejectedMessage is present - * @param sender sender - * @param signature signature - * @see https://wiki.vg/Protocol#Message_Acknowledgment - */ - -@MinecraftPacket(id = 0x03, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class MessageAcknowledgementPacket( - val hasLastRejectedMessage: Boolean, - val sender: UUID?, - val signature: ByteArray?, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MessageAcknowledgementPacket { - val hasLastRejectedMessage = input.readBoolean() - val sender = if (hasLastRejectedMessage) input.readUUID() else null - val signature = if (hasLastRejectedMessage) input.readVarIntByteArray() else null - - return MessageAcknowledgementPacket(hasLastRejectedMessage, sender, signature) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MessageAcknowledgementPacket) { - output.writeBoolean(value.hasLastRejectedMessage) - if (value.hasLastRejectedMessage) output.writeUUID(value.sender!!) - if (value.hasLastRejectedMessage) output.writeVarIntByteArray(value.signature!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/NameItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/NameItemPacket.kt deleted file mode 100644 index 292719e..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/NameItemPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Rename Item | 0x23 | play | serverbound - * - * @param name name - * @see https://wiki.vg/Protocol#Rename_Item - */ - -@MinecraftPacket(id = 0x23, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class NameItemPacket( - val name: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NameItemPacket { - val name = input.readString() - - return NameItemPacket(name) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NameItemPacket) { - output.writeString(value.name) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PickItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PickItemPacket.kt deleted file mode 100644 index e550a49..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PickItemPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Pick Item | 0x1a | play | serverbound - * - * @param slot slot - * @see https://wiki.vg/Protocol#Pick_Item - */ - -@MinecraftPacket(id = 0x1a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class PickItemPacket( - val slot: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PickItemPacket { - val slot = input.readVarInt() - - return PickItemPacket(slot) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PickItemPacket) { - output.writeVarInt(value.slot) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PongPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PongPacket.kt deleted file mode 100644 index 6381aed..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PongPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Pong (play) | 0x20 | play | serverbound - * - * @param id id - * @see https://wiki.vg/Protocol#Pong_.28play.29 - */ - -@MinecraftPacket(id = 0x20, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class PongPacket( - val id: Int, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PongPacket { - val id = input.readInt() - - return PongPacket(id) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PongPacket) { - output.writeInt(value.id) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionLookPacket.kt deleted file mode 100644 index 2a570da..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionLookPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Player Position and Rotation | 0x15 | play | serverbound - * - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @param onGround onGround - * @see https://wiki.vg/Protocol#Set_Player_Position_and_Rotation - */ - -@MinecraftPacket(id = 0x15, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class PositionLookPacket( - val x: Double, - val y: Double, - val z: Double, - val yaw: Float, - val pitch: Float, - val onGround: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionLookPacket { - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readFloat() - val pitch = input.readFloat() - val onGround = input.readBoolean() - - return PositionLookPacket(x, y, z, yaw, pitch, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionLookPacket) { - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeFloat(value.yaw) - output.writeFloat(value.pitch) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionPacket.kt deleted file mode 100644 index 7bdd92c..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/PositionPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Player Position | 0x14 | play | serverbound - * - * @param x x - * @param y y - * @param z z - * @param onGround onGround - * @see https://wiki.vg/Protocol#Set_Player_Position - */ - -@MinecraftPacket(id = 0x14, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class PositionPacket( - val x: Double, - val y: Double, - val z: Double, - val onGround: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionPacket { - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val onGround = input.readBoolean() - - return PositionPacket(x, y, z, onGround) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionPacket) { - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeBoolean(value.onGround) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryBlockNbtPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryBlockNbtPacket.kt deleted file mode 100644 index f913017..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryBlockNbtPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Query Block Entity Tag | 0x01 | play | serverbound - * - * @param transactionId transactionId - * @param location location - * @see https://wiki.vg/Protocol#Query_Block_Entity_Tag - */ - -@MinecraftPacket(id = 0x01, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class QueryBlockNbtPacket( - val transactionId: Int, // varint - val location: Position, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): QueryBlockNbtPacket { - val transactionId = input.readVarInt() - val location = input.readPosition() - - return QueryBlockNbtPacket(transactionId, location) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: QueryBlockNbtPacket) { - output.writeVarInt(value.transactionId) - output.writePosition(value.location) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryEntityNbtPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryEntityNbtPacket.kt deleted file mode 100644 index ca8a423..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/QueryEntityNbtPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Query Entity Tag | 0x0f | play | serverbound - * - * @param transactionId transactionId - * @param entityId entityId - * @see https://wiki.vg/Protocol#Query_Entity_Tag - */ - -@MinecraftPacket(id = 0x0f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class QueryEntityNbtPacket( - val transactionId: Int, // varint - val entityId: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): QueryEntityNbtPacket { - val transactionId = input.readVarInt() - val entityId = input.readVarInt() - - return QueryEntityNbtPacket(transactionId, entityId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: QueryEntityNbtPacket) { - output.writeVarInt(value.transactionId) - output.writeVarInt(value.entityId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/RecipeBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/RecipeBookPacket.kt deleted file mode 100644 index 745cf7d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/RecipeBookPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Change Recipe Book Settings | 0x21 | play | serverbound - * - * @param bookId bookId - * @param bookOpen bookOpen - * @param filterActive filterActive - * @see https://wiki.vg/Protocol#Change_Recipe_Book_Settings - */ - -@MinecraftPacket(id = 0x21, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class RecipeBookPacket( - val bookId: Int, // varint - val bookOpen: Boolean, - val filterActive: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RecipeBookPacket { - val bookId = input.readVarInt() - val bookOpen = input.readBoolean() - val filterActive = input.readBoolean() - - return RecipeBookPacket(bookId, bookOpen, filterActive) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RecipeBookPacket) { - output.writeVarInt(value.bookId) - output.writeBoolean(value.bookOpen) - output.writeBoolean(value.filterActive) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ResourcePackReceivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ResourcePackReceivePacket.kt deleted file mode 100644 index 6cd939b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/ResourcePackReceivePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Resource Pack (serverbound) | 0x24 | play | serverbound - * - * @param result result - * @see https://wiki.vg/Protocol#Resource_Pack_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x24, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class ResourcePackReceivePacket( - val result: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ResourcePackReceivePacket { - val result = input.readVarInt() - - return ResourcePackReceivePacket(result) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ResourcePackReceivePacket) { - output.writeVarInt(value.result) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SelectTradePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SelectTradePacket.kt deleted file mode 100644 index a940628..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SelectTradePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Select Trade | 0x26 | play | serverbound - * - * @param slot slot - * @see https://wiki.vg/Protocol#Select_Trade - */ - -@MinecraftPacket(id = 0x26, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SelectTradePacket( - val slot: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SelectTradePacket { - val slot = input.readVarInt() - - return SelectTradePacket(slot) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SelectTradePacket) { - output.writeVarInt(value.slot) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetBeaconEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetBeaconEffectPacket.kt deleted file mode 100644 index 5546a03..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetBeaconEffectPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Beacon Effect | 0x27 | play | serverbound - * - * @param hasPrimaryEffect primary_effect is present - * @param primaryEffect primary_effect - * @param hasSecondaryEffect secondary_effect is present - * @param secondaryEffect secondary_effect - * @see https://wiki.vg/Protocol#Set_Beacon_Effect - */ - -@MinecraftPacket(id = 0x27, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SetBeaconEffectPacket( - val hasPrimaryEffect: Boolean, - val primaryEffect: Int?, // varint - val hasSecondaryEffect: Boolean, - val secondaryEffect: Int?, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetBeaconEffectPacket { - val hasPrimaryEffect = input.readBoolean() - val primaryEffect = if (hasPrimaryEffect) input.readVarInt() else null - val hasSecondaryEffect = input.readBoolean() - val secondaryEffect = if (hasSecondaryEffect) input.readVarInt() else null - - return SetBeaconEffectPacket(hasPrimaryEffect, primaryEffect, hasSecondaryEffect, secondaryEffect) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetBeaconEffectPacket) { - output.writeBoolean(value.hasPrimaryEffect) - if (value.hasPrimaryEffect) output.writeVarInt(value.primaryEffect!!) - output.writeBoolean(value.hasSecondaryEffect) - if (value.hasSecondaryEffect) output.writeVarInt(value.secondaryEffect!!) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetCreativeSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetCreativeSlotPacket.kt deleted file mode 100644 index 7b39b91..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetCreativeSlotPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Set Creative Mode Slot | 0x2b | play | serverbound - * - * @param slot slot - * @see https://wiki.vg/Protocol#Set_Creative_Mode_Slot - */ - -@MinecraftPacket(id = 0x2b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SetCreativeSlotPacket( - val slot: Short, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetCreativeSlotPacket { - val slot = input.readShort() - - return SetCreativeSlotPacket(slot) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetCreativeSlotPacket) { - output.writeShort(value.slot) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetDifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetDifficultyPacket.kt deleted file mode 100644 index ac4cac2..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SetDifficultyPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Change Difficulty | 0x02 | play | serverbound - * - * @param newDifficulty newDifficulty - * @see https://wiki.vg/Protocol#Change_Difficulty_2 - */ - -@MinecraftPacket(id = 0x02, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SetDifficultyPacket( - val newDifficulty: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetDifficultyPacket { - val newDifficulty = input.readUByte() - - return SetDifficultyPacket(newDifficulty) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetDifficultyPacket) { - output.writeUByte(value.newDifficulty) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SettingsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SettingsPacket.kt deleted file mode 100644 index 58501e4..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SettingsPacket.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Client Information | 0x08 | play | serverbound - * - * @param locale locale - * @param viewDistance viewDistance - * @param chatFlags chatFlags - * @param chatColors chatColors - * @param skinParts skinParts - * @param mainHand mainHand - * @param enableTextFiltering enableTextFiltering - * @param enableServerListing enableServerListing - * @see https://wiki.vg/Protocol#Client_Information - */ - -@MinecraftPacket(id = 0x08, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SettingsPacket( - val locale: String, - val viewDistance: Byte, - val chatFlags: Int, // varint - val chatColors: Boolean, - val skinParts: UByte, - val mainHand: Int, // varint - val enableTextFiltering: Boolean, - val enableServerListing: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SettingsPacket { - val locale = input.readString() - val viewDistance = input.readByte() - val chatFlags = input.readVarInt() - val chatColors = input.readBoolean() - val skinParts = input.readUByte() - val mainHand = input.readVarInt() - val enableTextFiltering = input.readBoolean() - val enableServerListing = input.readBoolean() - - return SettingsPacket(locale, viewDistance, chatFlags, chatColors, skinParts, mainHand, enableTextFiltering, enableServerListing) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SettingsPacket) { - output.writeString(value.locale) - output.writeByte(value.viewDistance) - output.writeVarInt(value.chatFlags) - output.writeBoolean(value.chatColors) - output.writeUByte(value.skinParts) - output.writeVarInt(value.mainHand) - output.writeBoolean(value.enableTextFiltering) - output.writeBoolean(value.enableServerListing) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SpectatePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SpectatePacket.kt deleted file mode 100644 index 3c2b4f9..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SpectatePacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Teleport To Entity | 0x30 | play | serverbound - * - * @param target target - * @see https://wiki.vg/Protocol#Teleport_To_Entity - */ - -@MinecraftPacket(id = 0x30, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SpectatePacket( - val target: UUID, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpectatePacket { - val target = input.readUUID() - - return SpectatePacket(target) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpectatePacket) { - output.writeUUID(value.target) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerBoatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerBoatPacket.kt deleted file mode 100644 index be205ed..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerBoatPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Paddle Boat | 0x19 | play | serverbound - * - * @param leftPaddle leftPaddle - * @param rightPaddle rightPaddle - * @see https://wiki.vg/Protocol#Paddle_Boat - */ - -@MinecraftPacket(id = 0x19, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SteerBoatPacket( - val leftPaddle: Boolean, - val rightPaddle: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SteerBoatPacket { - val leftPaddle = input.readBoolean() - val rightPaddle = input.readBoolean() - - return SteerBoatPacket(leftPaddle, rightPaddle) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SteerBoatPacket) { - output.writeBoolean(value.leftPaddle) - output.writeBoolean(value.rightPaddle) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerVehiclePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerVehiclePacket.kt deleted file mode 100644 index 6426cac..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/SteerVehiclePacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Player Input | 0x1f | play | serverbound - * - * @param sideways sideways - * @param forward forward - * @param jump jump - * @see https://wiki.vg/Protocol#Player_Input - */ - -@MinecraftPacket(id = 0x1f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SteerVehiclePacket( - val sideways: Float, - val forward: Float, - val jump: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SteerVehiclePacket { - val sideways = input.readFloat() - val forward = input.readFloat() - val jump = input.readUByte() - - return SteerVehiclePacket(sideways, forward, jump) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SteerVehiclePacket) { - output.writeFloat(value.sideways) - output.writeFloat(value.forward) - output.writeUByte(value.jump) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TabCompletePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TabCompletePacket.kt deleted file mode 100644 index cce3a5b..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TabCompletePacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Command Suggestions Request | 0x09 | play | serverbound - * - * @param transactionId transactionId - * @param text text - * @see https://wiki.vg/Protocol#Command_Suggestions_Request - */ - -@MinecraftPacket(id = 0x09, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class TabCompletePacket( - val transactionId: Int, // varint - val text: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TabCompletePacket { - val transactionId = input.readVarInt() - val text = input.readString() - - return TabCompletePacket(transactionId, text) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TabCompletePacket) { - output.writeVarInt(value.transactionId) - output.writeString(value.text) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TeleportConfirmPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TeleportConfirmPacket.kt deleted file mode 100644 index fb57c04..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/TeleportConfirmPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Confirm Teleportation | 0x00 | play | serverbound - * - * @param teleportId teleportId - * @see https://wiki.vg/Protocol#Confirm_Teleportation - */ - -@MinecraftPacket(id = 0x00, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class TeleportConfirmPacket( - val teleportId: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TeleportConfirmPacket { - val teleportId = input.readVarInt() - - return TeleportConfirmPacket(teleportId) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TeleportConfirmPacket) { - output.writeVarInt(value.teleportId) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockMinecartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockMinecartPacket.kt deleted file mode 100644 index b224085..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockMinecartPacket.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Program Command Block Minecart | 0x2a | play | serverbound - * - * @param entityId entityId - * @param command command - * @param trackOutput track_output - * @see https://wiki.vg/Protocol#Program_Command_Block_Minecart - */ - -@MinecraftPacket(id = 0x2a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UpdateCommandBlockMinecartPacket( - val entityId: Int, // varint - val command: String, - val trackOutput: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateCommandBlockMinecartPacket { - val entityId = input.readVarInt() - val command = input.readString() - val trackOutput = input.readBoolean() - - return UpdateCommandBlockMinecartPacket(entityId, command, trackOutput) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateCommandBlockMinecartPacket) { - output.writeVarInt(value.entityId) - output.writeString(value.command) - output.writeBoolean(value.trackOutput) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockPacket.kt deleted file mode 100644 index 86bac0a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateCommandBlockPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Program Command Block | 0x29 | play | serverbound - * - * @param location location - * @param command command - * @param mode mode - * @param flags flags - * @see https://wiki.vg/Protocol#Program_Command_Block - */ - -@MinecraftPacket(id = 0x29, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UpdateCommandBlockPacket( - val location: Position, - val command: String, - val mode: Int, // varint - val flags: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateCommandBlockPacket { - val location = input.readPosition() - val command = input.readString() - val mode = input.readVarInt() - val flags = input.readUByte() - - return UpdateCommandBlockPacket(location, command, mode, flags) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateCommandBlockPacket) { - output.writePosition(value.location) - output.writeString(value.command) - output.writeVarInt(value.mode) - output.writeUByte(value.flags) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateJigsawBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateJigsawBlockPacket.kt deleted file mode 100644 index 0279f3d..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateJigsawBlockPacket.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Program Jigsaw Block | 0x2c | play | serverbound - * - * @param location location - * @param name name - * @param target target - * @param pool pool - * @param finalState finalState - * @param jointType jointType - * @see https://wiki.vg/Protocol#Program_Jigsaw_Block - */ - -@MinecraftPacket(id = 0x2c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UpdateJigsawBlockPacket( - val location: Position, - val name: String, - val target: String, - val pool: String, - val finalState: String, - val jointType: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateJigsawBlockPacket { - val location = input.readPosition() - val name = input.readString() - val target = input.readString() - val pool = input.readString() - val finalState = input.readString() - val jointType = input.readString() - - return UpdateJigsawBlockPacket(location, name, target, pool, finalState, jointType) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateJigsawBlockPacket) { - output.writePosition(value.location) - output.writeString(value.name) - output.writeString(value.target) - output.writeString(value.pool) - output.writeString(value.finalState) - output.writeString(value.jointType) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateSignPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateSignPacket.kt deleted file mode 100644 index e478566..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateSignPacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Update Sign | 0x2e | play | serverbound - * - * @param location location - * @param text1 text1 - * @param text2 text2 - * @param text3 text3 - * @param text4 text4 - * @see https://wiki.vg/Protocol#Update_Sign - */ - -@MinecraftPacket(id = 0x2e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UpdateSignPacket( - val location: Position, - val text1: String, - val text2: String, - val text3: String, - val text4: String, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateSignPacket { - val location = input.readPosition() - val text1 = input.readString() - val text2 = input.readString() - val text3 = input.readString() - val text4 = input.readString() - - return UpdateSignPacket(location, text1, text2, text3, text4) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateSignPacket) { - output.writePosition(value.location) - output.writeString(value.text1) - output.writeString(value.text2) - output.writeString(value.text3) - output.writeString(value.text4) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateStructureBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateStructureBlockPacket.kt deleted file mode 100644 index 8ede369..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UpdateStructureBlockPacket.kt +++ /dev/null @@ -1,89 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import io.layercraft.packetlib.types.Position -/** - * Program Structure Block | 0x2d | play | serverbound - * - * @param location location - * @param action action - * @param mode mode - * @param name name - * @param offsetX offset_x - * @param offsetY offset_y - * @param offsetZ offset_z - * @param sizeX size_x - * @param sizeY size_y - * @param sizeZ size_z - * @param mirror mirror - * @param rotation rotation - * @param metadata metadata - * @param integrity integrity - * @param seed seed - * @param flags flags - * @see https://wiki.vg/Protocol#Program_Structure_Block - */ - -@MinecraftPacket(id = 0x2d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UpdateStructureBlockPacket( - val location: Position, - val action: Int, // varint - val mode: Int, // varint - val name: String, - val offsetX: Byte, - val offsetY: Byte, - val offsetZ: Byte, - val sizeX: Byte, - val sizeY: Byte, - val sizeZ: Byte, - val mirror: Int, // varint - val rotation: Int, // varint - val metadata: String, - val integrity: Float, - val seed: Int, // varint - val flags: UByte, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateStructureBlockPacket { - val location = input.readPosition() - val action = input.readVarInt() - val mode = input.readVarInt() - val name = input.readString() - val offsetX = input.readByte() - val offsetY = input.readByte() - val offsetZ = input.readByte() - val sizeX = input.readByte() - val sizeY = input.readByte() - val sizeZ = input.readByte() - val mirror = input.readVarInt() - val rotation = input.readVarInt() - val metadata = input.readString() - val integrity = input.readFloat() - val seed = input.readVarInt() - val flags = input.readUByte() - - return UpdateStructureBlockPacket(location, action, mode, name, offsetX, offsetY, offsetZ, sizeX, sizeY, sizeZ, mirror, rotation, metadata, integrity, seed, flags) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateStructureBlockPacket) { - output.writePosition(value.location) - output.writeVarInt(value.action) - output.writeVarInt(value.mode) - output.writeString(value.name) - output.writeByte(value.offsetX) - output.writeByte(value.offsetY) - output.writeByte(value.offsetZ) - output.writeByte(value.sizeX) - output.writeByte(value.sizeY) - output.writeByte(value.sizeZ) - output.writeVarInt(value.mirror) - output.writeVarInt(value.rotation) - output.writeString(value.metadata) - output.writeFloat(value.integrity) - output.writeVarInt(value.seed) - output.writeUByte(value.flags) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseEntityPacket.kt deleted file mode 100644 index 26acf90..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseEntityPacket.kt +++ /dev/null @@ -1,79 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Interact | 0x10 | play | serverbound - * - * @param target target - * @param mouse mouse - * @param x x - * @param y y - * @param z z - * @param hand hand - * @param sneaking sneaking - * @see https://wiki.vg/Protocol#Interact - */ - -@MinecraftPacket(id = 0x10, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UseEntityPacket( - val target: Int, // varint - val mouse: Int, // varint - val x: Float?, - val y: Float?, - val z: Float?, - val hand: Int?, // varint - val sneaking: Boolean, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UseEntityPacket { - val target = input.readVarInt() - val mouse = input.readVarInt() - val x = when (mouse) { - 2 -> input.readFloat() - else -> null - } - val y = when (mouse) { - 2 -> input.readFloat() - else -> null - } - val z = when (mouse) { - 2 -> input.readFloat() - else -> null - } - val hand = when (mouse) { - 0 -> input.readVarInt() - 2 -> input.readVarInt() - else -> null - } - val sneaking = input.readBoolean() - - return UseEntityPacket(target, mouse, x, y, z, hand, sneaking) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UseEntityPacket) { - output.writeVarInt(value.target) - output.writeVarInt(value.mouse) - when (value.mouse) { - 2 -> output.writeFloat(value.x!!) - else -> {} - } - when (value.mouse) { - 2 -> output.writeFloat(value.y!!) - else -> {} - } - when (value.mouse) { - 2 -> output.writeFloat(value.z!!) - else -> {} - } - when (value.mouse) { - 0 -> output.writeVarInt(value.hand!!) - 2 -> output.writeVarInt(value.hand!!) - else -> {} - } - output.writeBoolean(value.sneaking) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseItemPacket.kt deleted file mode 100644 index 3f16d9f..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/UseItemPacket.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Use Item | 0x32 | play | serverbound - * - * @param hand hand - * @param sequence sequence - * @see https://wiki.vg/Protocol#Use_Item - */ - -@MinecraftPacket(id = 0x32, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class UseItemPacket( - val hand: Int, // varint - val sequence: Int, // varint -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UseItemPacket { - val hand = input.readVarInt() - val sequence = input.readVarInt() - - return UseItemPacket(hand, sequence) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UseItemPacket) { - output.writeVarInt(value.hand) - output.writeVarInt(value.sequence) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/VehicleMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/VehicleMovePacket.kt deleted file mode 100644 index e091b27..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/VehicleMovePacket.kt +++ /dev/null @@ -1,45 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Move Vehicle (serverbound) | 0x18 | play | serverbound - * - * @param x x - * @param y y - * @param z z - * @param yaw yaw - * @param pitch pitch - * @see https://wiki.vg/Protocol#Move_Vehicle_.28serverbound.29 - */ - -@MinecraftPacket(id = 0x18, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class VehicleMovePacket( - val x: Double, - val y: Double, - val z: Double, - val yaw: Float, - val pitch: Float, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): VehicleMovePacket { - val x = input.readDouble() - val y = input.readDouble() - val z = input.readDouble() - val yaw = input.readFloat() - val pitch = input.readFloat() - - return VehicleMovePacket(x, y, z, yaw, pitch) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: VehicleMovePacket) { - output.writeDouble(value.x) - output.writeDouble(value.y) - output.writeDouble(value.z) - output.writeFloat(value.yaw) - output.writeFloat(value.pitch) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/WindowClickPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/WindowClickPacket.kt deleted file mode 100644 index 4224b90..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/play/serverbound/WindowClickPacket.kt +++ /dev/null @@ -1,65 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Click Container | 0x0b | play | serverbound - * - * @param windowId windowId - * @param stateId stateId - * @param slot slot - * @param mouseButton mouseButton - * @param mode mode - * @param changedSlots list of WindowClickPacketChangedSlots - * @see https://wiki.vg/Protocol#Click_Container - */ - -@MinecraftPacket(id = 0x0b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class WindowClickPacket( - val windowId: UByte, - val stateId: Int, // varint - val slot: Short, - val mouseButton: Byte, - val mode: Int, // varint - val changedSlots: List, // varint array -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WindowClickPacket { - val windowId = input.readUByte() - val stateId = input.readVarInt() - val slot = input.readShort() - val mouseButton = input.readByte() - val mode = input.readVarInt() - val changedSlots = input.readVarIntArray { arrayInput -> - val location = arrayInput.readShort() - - return@readVarIntArray WindowClickPacketChangedSlots(location) - } - - return WindowClickPacket(windowId, stateId, slot, mouseButton, mode, changedSlots) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WindowClickPacket) { - output.writeUByte(value.windowId) - output.writeVarInt(value.stateId) - output.writeShort(value.slot) - output.writeByte(value.mouseButton) - output.writeVarInt(value.mode) - - output.writeVarIntArray(value.changedSlots) { arrayValue, arrayOutput -> - arrayOutput.writeShort(arrayValue.location) - } - } - } -} - -/** - * WindowClickPacketChangedSlots - * - * @param location location -*/ -data class WindowClickPacketChangedSlots( - val location: Short, -) \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/PingPacket.kt deleted file mode 100644 index e047693..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/PingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.status.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Ping Response | 0x01 | status | clientbound - * - * @param time time - * @see https://wiki.vg/Protocol#Ping_Response - */ - -@MinecraftPacket(id = 0x01, state = PacketState.STATUS, direction = PacketDirection.CLIENTBOUND) -data class PingPacket( - val time: Long, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { - val time = input.readLong() - - return PingPacket(time) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { - output.writeLong(value.time) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/ServerInfoPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/ServerInfoPacket.kt deleted file mode 100644 index 65c00ec..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/clientbound/ServerInfoPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.status.clientbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Status Response | 0x00 | status | clientbound - * - * @param response response - * @see https://wiki.vg/Protocol#Status_Response - */ - -@MinecraftPacket(id = 0x00, state = PacketState.STATUS, direction = PacketDirection.CLIENTBOUND) -data class ServerInfoPacket( - val response: String, -) : ClientBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ServerInfoPacket { - val response = input.readString() - - return ServerInfoPacket(response) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ServerInfoPacket) { - output.writeString(value.response) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingPacket.kt deleted file mode 100644 index 0b64fd4..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingPacket.kt +++ /dev/null @@ -1,29 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.status.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Ping Request | 0x01 | status | serverbound - * - * @param time time - * @see https://wiki.vg/Protocol#Ping_Request - */ - -@MinecraftPacket(id = 0x01, state = PacketState.STATUS, direction = PacketDirection.SERVERBOUND) -data class PingPacket( - val time: Long, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { - val time = input.readLong() - - return PingPacket(time) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { - output.writeLong(value.time) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingStartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingStartPacket.kt deleted file mode 100644 index aac4bb4..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_2/status/serverbound/PingStartPacket.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_2.status.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface - -/** - * Status Request | 0x00 | status | serverbound - * - - * @see https://wiki.vg/Protocol#Status_Request - */ - -@MinecraftPacket(id = 0x00, state = PacketState.STATUS, direction = PacketDirection.SERVERBOUND) -class PingStartPacket() : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingStartPacket { - return PingStartPacket() - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingStartPacket) { - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/LegacyServerListPingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/LegacyServerListPingPacket.kt index 78e774b..5e9f087 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/LegacyServerListPingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/LegacyServerListPingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Legacy Server List Ping | 0xfe | handshaking | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Legacy_Server_List_Ping */ -@MinecraftPacket(id = 0xfe, state = PacketState.HANDSHAKING, direction = PacketDirection.SERVERBOUND) data class LegacyServerListPingPacket( val payload: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LegacyServerListPingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LegacyServerListPingPacket { val payload = input.readUByte() return LegacyServerListPingPacket(payload) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LegacyServerListPingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LegacyServerListPingPacket) { output.writeUByte(value.payload) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/SetProtocolPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/SetProtocolPacket.kt index 2b62bf7..ea7769f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/SetProtocolPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/handshaking/serverbound/SetProtocolPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Handshake | 0x00 | handshaking | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Handshake */ -@MinecraftPacket(id = 0x00, state = PacketState.HANDSHAKING, direction = PacketDirection.SERVERBOUND) data class SetProtocolPacket( val protocolVersion: Int, // varint val serverHost: String, @@ -22,7 +21,7 @@ data class SetProtocolPacket( val nextState: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetProtocolPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetProtocolPacket { val protocolVersion = input.readVarInt() val serverHost = input.readString() val serverPort = input.readUShort() @@ -31,7 +30,7 @@ data class SetProtocolPacket( return SetProtocolPacket(protocolVersion, serverHost, serverPort, nextState) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetProtocolPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetProtocolPacket) { output.writeVarInt(value.protocolVersion) output.writeString(value.serverHost) output.writeUShort(value.serverPort) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/CompressPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/CompressPacket.kt index b962f87..9eede76 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/CompressPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/CompressPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Compression | 0x03 | login | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Compression */ -@MinecraftPacket(id = 0x03, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) data class CompressPacket( val threshold: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CompressPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CompressPacket { val threshold = input.readVarInt() return CompressPacket(threshold) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CompressPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CompressPacket) { output.writeVarInt(value.threshold) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/DisconnectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/DisconnectPacket.kt index 7e8114e..77f3310 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/DisconnectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/DisconnectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Disconnect (login) | 0x00 | login | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Disconnect_.28login.29 */ -@MinecraftPacket(id = 0x00, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) data class DisconnectPacket( val reason: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DisconnectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): DisconnectPacket { val reason = input.readString() return DisconnectPacket(reason) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DisconnectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: DisconnectPacket) { output.writeString(value.reason) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/EncryptionBeginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/EncryptionBeginPacket.kt index b076836..578fff7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/EncryptionBeginPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/EncryptionBeginPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Encryption Request | 0x01 | login | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Encryption_Request */ -@MinecraftPacket(id = 0x01, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) data class EncryptionBeginPacket( val serverId: String, val publicKey: ByteArray, val verifyToken: ByteArray, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EncryptionBeginPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EncryptionBeginPacket { val serverId = input.readString() val publicKey = input.readVarIntByteArray() val verifyToken = input.readVarIntByteArray() @@ -28,7 +27,7 @@ data class EncryptionBeginPacket( return EncryptionBeginPacket(serverId, publicKey, verifyToken) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EncryptionBeginPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EncryptionBeginPacket) { output.writeString(value.serverId) output.writeVarIntByteArray(value.publicKey) output.writeVarIntByteArray(value.verifyToken) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/LoginPluginRequestPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/LoginPluginRequestPacket.kt index 34ddba2..1ea7f11 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/LoginPluginRequestPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/LoginPluginRequestPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Login Plugin Request | 0x04 | login | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Login_Plugin_Request */ -@MinecraftPacket(id = 0x04, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) data class LoginPluginRequestPacket( val messageId: Int, // varint val channel: String, val data: ByteArray, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPluginRequestPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LoginPluginRequestPacket { val messageId = input.readVarInt() val channel = input.readString() val data = input.readRemainingByteArray() @@ -28,7 +27,7 @@ data class LoginPluginRequestPacket( return LoginPluginRequestPacket(messageId, channel, data) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPluginRequestPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LoginPluginRequestPacket) { output.writeVarInt(value.messageId) output.writeString(value.channel) output.writeRemainingByteArray(value.data) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/SuccessPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/SuccessPacket.kt index 0c1499e..d30d52d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/SuccessPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/clientbound/SuccessPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Login Success | 0x02 | login | clientbound @@ -13,14 +13,13 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Login_Success */ -@MinecraftPacket(id = 0x02, state = PacketState.LOGIN, direction = PacketDirection.CLIENTBOUND) data class SuccessPacket( val uuid: UUID, val username: String, val properties: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SuccessPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SuccessPacket { val uuid = input.readUUID() val username = input.readString() val properties = input.readVarIntArray { arrayInput -> @@ -29,13 +28,13 @@ data class SuccessPacket( val hasSignature = arrayInput.readBoolean() val signature = if (hasSignature) arrayInput.readString() else null - return@readVarIntArray SuccessPacketProperties(name, value, hasSignature, signature) + SuccessPacketProperties(name, value, hasSignature, signature) } return SuccessPacket(uuid, username, properties) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SuccessPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SuccessPacket) { output.writeUUID(value.uuid) output.writeString(value.username) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/EncryptionBeginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/EncryptionBeginPacket.kt index 763b732..ee8c56f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/EncryptionBeginPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/EncryptionBeginPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Encryption Response | 0x01 | login | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Encryption_Response */ -@MinecraftPacket(id = 0x01, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) data class EncryptionBeginPacket( val sharedSecret: ByteArray, val verifyToken: ByteArray, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EncryptionBeginPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EncryptionBeginPacket { val sharedSecret = input.readVarIntByteArray() val verifyToken = input.readVarIntByteArray() return EncryptionBeginPacket(sharedSecret, verifyToken) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EncryptionBeginPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EncryptionBeginPacket) { output.writeVarIntByteArray(value.sharedSecret) output.writeVarIntByteArray(value.verifyToken) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginPluginResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginPluginResponsePacket.kt index c5539c0..7a2bbde 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginPluginResponsePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginPluginResponsePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Login Plugin Response | 0x02 | login | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Login_Plugin_Response */ -@MinecraftPacket(id = 0x02, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) data class LoginPluginResponsePacket( val messageId: Int, // varint val hasData: Boolean, val data: ByteArray?, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPluginResponsePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LoginPluginResponsePacket { val messageId = input.readVarInt() val hasData = input.readBoolean() val data = if (hasData) input.readRemainingByteArray() else null @@ -28,7 +27,7 @@ data class LoginPluginResponsePacket( return LoginPluginResponsePacket(messageId, hasData, data) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPluginResponsePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LoginPluginResponsePacket) { output.writeVarInt(value.messageId) output.writeBoolean(value.hasData) if (value.hasData) output.writeRemainingByteArray(value.data!!) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginStartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginStartPacket.kt index 2d85d3c..c0f5942 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginStartPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/login/serverbound/LoginStartPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.login.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Login Start | 0x00 | login | serverbound @@ -13,14 +13,13 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Login_Start */ -@MinecraftPacket(id = 0x00, state = PacketState.LOGIN, direction = PacketDirection.SERVERBOUND) data class LoginStartPacket( val username: String, val hasPlayerUUID: Boolean, val playerUUID: UUID?, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginStartPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LoginStartPacket { val username = input.readString() val hasPlayerUUID = input.readBoolean() val playerUUID = if (hasPlayerUUID) input.readUUID() else null @@ -28,7 +27,7 @@ data class LoginStartPacket( return LoginStartPacket(username, hasPlayerUUID, playerUUID) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginStartPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LoginStartPacket) { output.writeString(value.username) output.writeBoolean(value.hasPlayerUUID) if (value.hasPlayerUUID) output.writeUUID(value.playerUUID!!) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AbilitiesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AbilitiesPacket.kt index c1ee1b0..f63c6f8 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AbilitiesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AbilitiesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Player Abilities | 0x30 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Player_Abilities */ -@MinecraftPacket(id = 0x30, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class AbilitiesPacket( val flags: Byte, val flyingSpeed: Float, val walkingSpeed: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AbilitiesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AbilitiesPacket { val flags = input.readByte() val flyingSpeed = input.readFloat() val walkingSpeed = input.readFloat() @@ -28,7 +27,7 @@ data class AbilitiesPacket( return AbilitiesPacket(flags, flyingSpeed, walkingSpeed) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AbilitiesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AbilitiesPacket) { output.writeByte(value.flags) output.writeFloat(value.flyingSpeed) output.writeFloat(value.walkingSpeed) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AcknowledgePlayerDiggingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AcknowledgePlayerDiggingPacket.kt index c493007..bcba058 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AcknowledgePlayerDiggingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AcknowledgePlayerDiggingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Acknowledge Block Change | 0x05 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Acknowledge_Block_Change */ -@MinecraftPacket(id = 0x05, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class AcknowledgePlayerDiggingPacket( val sequenceId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AcknowledgePlayerDiggingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AcknowledgePlayerDiggingPacket { val sequenceId = input.readVarInt() return AcknowledgePlayerDiggingPacket(sequenceId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AcknowledgePlayerDiggingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AcknowledgePlayerDiggingPacket) { output.writeVarInt(value.sequenceId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ActionBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ActionBarPacket.kt index 75f512c..666d2a1 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ActionBarPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ActionBarPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Action Bar Text | 0x42 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Action_Bar_Text */ -@MinecraftPacket(id = 0x42, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ActionBarPacket( val text: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ActionBarPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ActionBarPacket { val text = input.readString() return ActionBarPacket(text) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ActionBarPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ActionBarPacket) { output.writeString(value.text) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AdvancementsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AdvancementsPacket.kt index c382012..5d7569c 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AdvancementsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AdvancementsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Advancements | 0x65 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Advancements */ -@MinecraftPacket(id = 0x65, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class AdvancementsPacket( val reset: Boolean, val advancementMapping: List, // varint array @@ -22,7 +21,7 @@ data class AdvancementsPacket( val progressMapping: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AdvancementsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AdvancementsPacket { val reset = input.readBoolean() val advancementMapping = input.readVarIntArray { arrayInput -> val key = arrayInput.readString() @@ -37,11 +36,11 @@ data class AdvancementsPacket( val criteria = arrayInput.readVarIntArray { arrayInput -> val key = arrayInput.readString() - return@readVarIntArray AdvancementsPacketCriteria(key) + AdvancementsPacketCriteria(key) } val requirements = arrayInput.readVarIntArray { arrayInput1 -> arrayInput1.readVarIntArray { arrayInput -> arrayInput.readString() } } - return@readVarIntArray AdvancementsPacketAdvancementMapping(key, hasParentId, parentId, hasDisplayData, title, description, frameType, xCord, yCord, criteria, requirements) + AdvancementsPacketAdvancementMapping(key, hasParentId, parentId, hasDisplayData, title, description, frameType, xCord, yCord, criteria, requirements) } val identifiers = input.readVarIntArray { arrayInput -> arrayInput.readString() } val progressMapping = input.readVarIntArray { arrayInput -> @@ -51,16 +50,16 @@ data class AdvancementsPacket( val hasCriterionProgress = arrayInput1.readBoolean() val criterionProgress = if (hasCriterionProgress) arrayInput1.readLong() else null - return@readVarIntArray AdvancementsPacketValue(criterionIdentifier, hasCriterionProgress, criterionProgress) + AdvancementsPacketValue(criterionIdentifier, hasCriterionProgress, criterionProgress) } - return@readVarIntArray AdvancementsPacketProgressMapping(key, value) + AdvancementsPacketProgressMapping(key, value) } return AdvancementsPacket(reset, advancementMapping, identifiers, progressMapping) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AdvancementsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AdvancementsPacket) { output.writeBoolean(value.reset) output.writeVarIntArray(value.advancementMapping) { arrayValue, arrayOutput -> diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AnimationPacket.kt index 980f564..6a2d3e1 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AnimationPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AnimationPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Entity Animation | 0x03 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Entity_Animation */ -@MinecraftPacket(id = 0x03, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class AnimationPacket( val entityId: Int, // varint val animation: UByte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AnimationPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AnimationPacket { val entityId = input.readVarInt() val animation = input.readUByte() return AnimationPacket(entityId, animation) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AnimationPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AnimationPacket) { output.writeVarInt(value.entityId) output.writeUByte(value.animation) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AttachEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AttachEntityPacket.kt index 1292631..2ab87f3 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AttachEntityPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/AttachEntityPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Link Entities | 0x4f | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Link_Entities */ -@MinecraftPacket(id = 0x4f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class AttachEntityPacket( val entityId: Int, val vehicleId: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AttachEntityPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AttachEntityPacket { val entityId = input.readInt() val vehicleId = input.readInt() return AttachEntityPacket(entityId, vehicleId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AttachEntityPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AttachEntityPacket) { output.writeInt(value.entityId) output.writeInt(value.vehicleId) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockActionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockActionPacket.kt index ba5561b..9ec24a7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockActionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockActionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Block Action | 0x08 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Block_Action */ -@MinecraftPacket(id = 0x08, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class BlockActionPacket( val location: Position, val byte1: UByte, @@ -22,7 +21,7 @@ data class BlockActionPacket( val blockId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockActionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BlockActionPacket { val location = input.readPosition() val byte1 = input.readUByte() val byte2 = input.readUByte() @@ -31,7 +30,7 @@ data class BlockActionPacket( return BlockActionPacket(location, byte1, byte2, blockId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockActionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BlockActionPacket) { output.writePosition(value.location) output.writeUByte(value.byte1) output.writeUByte(value.byte2) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockBreakAnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockBreakAnimationPacket.kt index ce5b58f..c251dc4 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockBreakAnimationPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockBreakAnimationPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Set Block Destroy Stage | 0x06 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Set_Block_Destroy_Stage */ -@MinecraftPacket(id = 0x06, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class BlockBreakAnimationPacket( val entityId: Int, // varint val location: Position, val destroyStage: Byte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockBreakAnimationPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BlockBreakAnimationPacket { val entityId = input.readVarInt() val location = input.readPosition() val destroyStage = input.readByte() @@ -28,7 +27,7 @@ data class BlockBreakAnimationPacket( return BlockBreakAnimationPacket(entityId, location, destroyStage) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockBreakAnimationPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BlockBreakAnimationPacket) { output.writeVarInt(value.entityId) output.writePosition(value.location) output.writeByte(value.destroyStage) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockChangePacket.kt index 2e000ad..bede239 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockChangePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BlockChangePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Block Update | 0x09 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Block_Update */ -@MinecraftPacket(id = 0x09, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class BlockChangePacket( val location: Position, val type: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockChangePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BlockChangePacket { val location = input.readPosition() val type = input.readVarInt() return BlockChangePacket(location, type) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockChangePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BlockChangePacket) { output.writePosition(value.location) output.writeVarInt(value.type) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BossBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BossBarPacket.kt index b635202..9b2337d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BossBarPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/BossBarPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Boss Bar | 0x0a | play | clientbound @@ -17,7 +17,6 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Boss_Bar */ -@MinecraftPacket(id = 0x0a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class BossBarPacket( val entityUUID: UUID, val action: Int, // varint @@ -28,7 +27,7 @@ data class BossBarPacket( val flags: UByte?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BossBarPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BossBarPacket { val entityUUID = input.readUUID() val action = input.readVarInt() val title = when (action) { @@ -60,7 +59,7 @@ data class BossBarPacket( return BossBarPacket(entityUUID, action, title, health, color, dividers, flags) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BossBarPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BossBarPacket) { output.writeUUID(value.entityUUID) output.writeVarInt(value.action) when (value.action) { diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CameraPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CameraPacket.kt index d2ae614..3d6f5a6 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CameraPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CameraPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Camera | 0x48 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Camera */ -@MinecraftPacket(id = 0x48, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CameraPacket( val cameraId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CameraPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CameraPacket { val cameraId = input.readVarInt() return CameraPacket(cameraId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CameraPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CameraPacket) { output.writeVarInt(value.cameraId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ChatSuggestionsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ChatSuggestionsPacket.kt index 6f92a2c..ca4867d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ChatSuggestionsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ChatSuggestionsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Chat Suggestions | 0x14 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Chat_Suggestions */ -@MinecraftPacket(id = 0x14, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ChatSuggestionsPacket( val action: Int, // varint val entries: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatSuggestionsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ChatSuggestionsPacket { val action = input.readVarInt() val entries = input.readVarIntArray { arrayInput -> arrayInput.readString() } return ChatSuggestionsPacket(action, entries) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatSuggestionsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ChatSuggestionsPacket) { output.writeVarInt(value.action) output.writeVarIntArray(value.entries) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ClearTitlesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ClearTitlesPacket.kt index f142086..a24da17 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ClearTitlesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ClearTitlesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Clear Titles | 0x0c | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Clear_Titles */ -@MinecraftPacket(id = 0x0c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ClearTitlesPacket( val reset: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ClearTitlesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ClearTitlesPacket { val reset = input.readBoolean() return ClearTitlesPacket(reset) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ClearTitlesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ClearTitlesPacket) { output.writeBoolean(value.reset) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CloseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CloseWindowPacket.kt index 449379f..fb1d77e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CloseWindowPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CloseWindowPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Close Container | 0x0f | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Close_Container */ -@MinecraftPacket(id = 0x0f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CloseWindowPacket( val windowId: UByte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CloseWindowPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CloseWindowPacket { val windowId = input.readUByte() return CloseWindowPacket(windowId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CloseWindowPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CloseWindowPacket) { output.writeUByte(value.windowId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CollectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CollectPacket.kt index 6e05cc3..7989226 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CollectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CollectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Pickup Item | 0x63 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Pickup_Item */ -@MinecraftPacket(id = 0x63, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CollectPacket( val collectedEntityId: Int, // varint val collectorEntityId: Int, // varint val pickupItemCount: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CollectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CollectPacket { val collectedEntityId = input.readVarInt() val collectorEntityId = input.readVarInt() val pickupItemCount = input.readVarInt() @@ -28,7 +27,7 @@ data class CollectPacket( return CollectPacket(collectedEntityId, collectorEntityId, pickupItemCount) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CollectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CollectPacket) { output.writeVarInt(value.collectedEntityId) output.writeVarInt(value.collectorEntityId) output.writeVarInt(value.pickupItemCount) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftProgressBarPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftProgressBarPacket.kt index ed9908e..6ae5531 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftProgressBarPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftProgressBarPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Container Property | 0x11 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Container_Property */ -@MinecraftPacket(id = 0x11, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CraftProgressBarPacket( val windowId: UByte, val property: Short, val value: Short, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftProgressBarPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CraftProgressBarPacket { val windowId = input.readUByte() val property = input.readShort() val value = input.readShort() @@ -28,7 +27,7 @@ data class CraftProgressBarPacket( return CraftProgressBarPacket(windowId, property, value) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftProgressBarPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CraftProgressBarPacket) { output.writeUByte(value.windowId) output.writeShort(value.property) output.writeShort(value.value) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftRecipeResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftRecipeResponsePacket.kt index 0d83862..aec86e3 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftRecipeResponsePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CraftRecipeResponsePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Place Ghost Recipe | 0x2f | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Place_Ghost_Recipe */ -@MinecraftPacket(id = 0x2f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CraftRecipeResponsePacket( val windowId: Byte, val recipe: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftRecipeResponsePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CraftRecipeResponsePacket { val windowId = input.readByte() val recipe = input.readString() return CraftRecipeResponsePacket(windowId, recipe) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftRecipeResponsePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CraftRecipeResponsePacket) { output.writeByte(value.windowId) output.writeString(value.recipe) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CustomPayloadPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CustomPayloadPacket.kt index 68815f2..8c26ac3 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CustomPayloadPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/CustomPayloadPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Plugin Message | 0x15 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Plugin_Message */ -@MinecraftPacket(id = 0x15, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class CustomPayloadPacket( val channel: String, val data: ByteArray, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CustomPayloadPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CustomPayloadPacket { val channel = input.readString() val data = input.readRemainingByteArray() return CustomPayloadPacket(channel, data) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CustomPayloadPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CustomPayloadPacket) { output.writeString(value.channel) output.writeRemainingByteArray(value.data) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeathCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeathCombatEventPacket.kt index 13da987..011cbd8 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeathCombatEventPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeathCombatEventPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Combat Death | 0x34 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Combat_Death */ -@MinecraftPacket(id = 0x34, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class DeathCombatEventPacket( val playerId: Int, // varint val entityId: Int, val message: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DeathCombatEventPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): DeathCombatEventPacket { val playerId = input.readVarInt() val entityId = input.readInt() val message = input.readString() @@ -28,7 +27,7 @@ data class DeathCombatEventPacket( return DeathCombatEventPacket(playerId, entityId, message) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DeathCombatEventPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: DeathCombatEventPacket) { output.writeVarInt(value.playerId) output.writeInt(value.entityId) output.writeString(value.message) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeclareCommandsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeclareCommandsPacket.kt index 7d6245e..20b1184 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeclareCommandsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DeclareCommandsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Commands | 0x0e | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Commands */ -@MinecraftPacket(id = 0x0e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class DeclareCommandsPacket( val rootIndex: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DeclareCommandsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): DeclareCommandsPacket { val rootIndex = input.readVarInt() return DeclareCommandsPacket(rootIndex) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DeclareCommandsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: DeclareCommandsPacket) { output.writeVarInt(value.rootIndex) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DifficultyPacket.kt index fa0c77d..0523d57 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DifficultyPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/DifficultyPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Change Difficulty | 0x0b | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Change_Difficulty */ -@MinecraftPacket(id = 0x0b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class DifficultyPacket( val difficulty: UByte, val difficultyLocked: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DifficultyPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): DifficultyPacket { val difficulty = input.readUByte() val difficultyLocked = input.readBoolean() return DifficultyPacket(difficulty, difficultyLocked) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DifficultyPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: DifficultyPacket) { output.writeUByte(value.difficulty) output.writeBoolean(value.difficultyLocked) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EndCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EndCombatEventPacket.kt index f858b4b..2f5609d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EndCombatEventPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EndCombatEventPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * End Combat | 0x32 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#End_Combat */ -@MinecraftPacket(id = 0x32, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EndCombatEventPacket( val duration: Int, // varint val entityId: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EndCombatEventPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EndCombatEventPacket { val duration = input.readVarInt() val entityId = input.readInt() return EndCombatEventPacket(duration, entityId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EndCombatEventPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EndCombatEventPacket) { output.writeVarInt(value.duration) output.writeInt(value.entityId) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EnterCombatEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EnterCombatEventPacket.kt index 5998794..08f68ef 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EnterCombatEventPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EnterCombatEventPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Enter Combat | 0x33 | play | clientbound @@ -11,14 +11,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Enter_Combat */ -@MinecraftPacket(id = 0x33, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) class EnterCombatEventPacket() : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EnterCombatEventPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EnterCombatEventPacket { return EnterCombatEventPacket() } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EnterCombatEventPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EnterCombatEventPacket) { } } } \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityDestroyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityDestroyPacket.kt index 5f0d479..988f087 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityDestroyPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityDestroyPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Remove Entities | 0x3a | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Remove_Entities */ -@MinecraftPacket(id = 0x3a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityDestroyPacket( val entityIds: List, // varint array of varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityDestroyPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityDestroyPacket { val entityIds = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } return EntityDestroyPacket(entityIds) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityDestroyPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityDestroyPacket) { output.writeVarIntArray(value.entityIds) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEffectPacket.kt index c357cc5..0ce4d75 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEffectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEffectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.NBT /** * Entity Effect | 0x68 | play | clientbound @@ -17,7 +17,6 @@ import io.layercraft.packetlib.types.NBT * @see https://wiki.vg/Protocol#Entity_Effect */ -@MinecraftPacket(id = 0x68, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityEffectPacket( val entityId: Int, // varint val effectId: Int, // varint @@ -28,7 +27,7 @@ data class EntityEffectPacket( val factorCodec: NBT?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityEffectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityEffectPacket { val entityId = input.readVarInt() val effectId = input.readVarInt() val amplifier = input.readByte() @@ -40,7 +39,7 @@ data class EntityEffectPacket( return EntityEffectPacket(entityId, effectId, amplifier, duration, hideParticles, hasFactorCodec, factorCodec) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityEffectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityEffectPacket) { output.writeVarInt(value.entityId) output.writeVarInt(value.effectId) output.writeByte(value.amplifier) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEquipmentPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEquipmentPacket.kt index 57e69a8..2f340c6 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEquipmentPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityEquipmentPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Equipment | 0x51 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Equipment */ -@MinecraftPacket(id = 0x51, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityEquipmentPacket( val entityId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityEquipmentPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityEquipmentPacket { val entityId = input.readVarInt() return EntityEquipmentPacket(entityId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityEquipmentPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityEquipmentPacket) { output.writeVarInt(value.entityId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityHeadRotationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityHeadRotationPacket.kt index 7b9b2ae..9b6155e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityHeadRotationPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityHeadRotationPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Head Rotation | 0x3e | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Head_Rotation */ -@MinecraftPacket(id = 0x3e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityHeadRotationPacket( val entityId: Int, // varint val headYaw: Byte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityHeadRotationPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityHeadRotationPacket { val entityId = input.readVarInt() val headYaw = input.readByte() return EntityHeadRotationPacket(entityId, headYaw) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityHeadRotationPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityHeadRotationPacket) { output.writeVarInt(value.entityId) output.writeByte(value.headYaw) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityLookPacket.kt index 66e0bca..0baf687 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityLookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityLookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Entity Rotation | 0x29 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Entity_Rotation */ -@MinecraftPacket(id = 0x29, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityLookPacket( val entityId: Int, // varint val yaw: Byte, @@ -22,7 +21,7 @@ data class EntityLookPacket( val onGround: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityLookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityLookPacket { val entityId = input.readVarInt() val yaw = input.readByte() val pitch = input.readByte() @@ -31,7 +30,7 @@ data class EntityLookPacket( return EntityLookPacket(entityId, yaw, pitch, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityLookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityLookPacket) { output.writeVarInt(value.entityId) output.writeByte(value.yaw) output.writeByte(value.pitch) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMetadataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMetadataPacket.kt index 8ef9738..d24a47a 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMetadataPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMetadataPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Entity Metadata | 0x4e | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Entity_Metadata */ -@MinecraftPacket(id = 0x4e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityMetadataPacket( val entityId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityMetadataPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityMetadataPacket { val entityId = input.readVarInt() return EntityMetadataPacket(entityId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityMetadataPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityMetadataPacket) { output.writeVarInt(value.entityId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMoveLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMoveLookPacket.kt index 177142e..1f5e61e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMoveLookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityMoveLookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Entity Position and Rotation | 0x28 | play | clientbound @@ -17,7 +17,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Entity_Position_and_Rotation */ -@MinecraftPacket(id = 0x28, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityMoveLookPacket( val entityId: Int, // varint val dX: Short, @@ -28,7 +27,7 @@ data class EntityMoveLookPacket( val onGround: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityMoveLookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityMoveLookPacket { val entityId = input.readVarInt() val dX = input.readShort() val dY = input.readShort() @@ -40,7 +39,7 @@ data class EntityMoveLookPacket( return EntityMoveLookPacket(entityId, dX, dY, dZ, yaw, pitch, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityMoveLookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityMoveLookPacket) { output.writeVarInt(value.entityId) output.writeShort(value.dX) output.writeShort(value.dY) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntitySoundEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntitySoundEffectPacket.kt index 0b2f3c0..2030d00 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntitySoundEffectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntitySoundEffectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Entity Sound Effect | 0x5d | play | clientbound @@ -16,7 +16,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Entity_Sound_Effect */ -@MinecraftPacket(id = 0x5d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntitySoundEffectPacket( val soundId: Int, // varint val soundCategory: Int, // varint @@ -26,7 +25,7 @@ data class EntitySoundEffectPacket( val seed: Long, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntitySoundEffectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntitySoundEffectPacket { val soundId = input.readVarInt() val soundCategory = input.readVarInt() val entityId = input.readVarInt() @@ -37,7 +36,7 @@ data class EntitySoundEffectPacket( return EntitySoundEffectPacket(soundId, soundCategory, entityId, volume, pitch, seed) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntitySoundEffectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntitySoundEffectPacket) { output.writeVarInt(value.soundId) output.writeVarInt(value.soundCategory) output.writeVarInt(value.entityId) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityStatusPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityStatusPacket.kt index 7aacaa9..3cf0b54 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityStatusPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityStatusPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Entity Event | 0x19 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Entity_Event */ -@MinecraftPacket(id = 0x19, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityStatusPacket( val entityId: Int, val entityStatus: Byte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityStatusPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityStatusPacket { val entityId = input.readInt() val entityStatus = input.readByte() return EntityStatusPacket(entityId, entityStatus) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityStatusPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityStatusPacket) { output.writeInt(value.entityId) output.writeByte(value.entityStatus) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityTeleportPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityTeleportPacket.kt index c54ea8d..1fd2cd0 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityTeleportPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityTeleportPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Teleport Entity | 0x64 | play | clientbound @@ -17,7 +17,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Teleport_Entity */ -@MinecraftPacket(id = 0x64, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityTeleportPacket( val entityId: Int, // varint val x: Double, @@ -28,7 +27,7 @@ data class EntityTeleportPacket( val onGround: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityTeleportPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityTeleportPacket { val entityId = input.readVarInt() val x = input.readDouble() val y = input.readDouble() @@ -40,7 +39,7 @@ data class EntityTeleportPacket( return EntityTeleportPacket(entityId, x, y, z, yaw, pitch, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityTeleportPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityTeleportPacket) { output.writeVarInt(value.entityId) output.writeDouble(value.x) output.writeDouble(value.y) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityUpdateAttributesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityUpdateAttributesPacket.kt index f4d3bb1..7bd8205 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityUpdateAttributesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityUpdateAttributesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Update Attributes | 0x66 | play | clientbound @@ -12,13 +12,12 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Update_Attributes */ -@MinecraftPacket(id = 0x66, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityUpdateAttributesPacket( val entityId: Int, // varint val properties: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityUpdateAttributesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityUpdateAttributesPacket { val entityId = input.readVarInt() val properties = input.readVarIntArray { arrayInput -> val key = arrayInput.readString() @@ -28,16 +27,16 @@ data class EntityUpdateAttributesPacket( val amount = arrayInput1.readDouble() val operation = arrayInput1.readByte() - return@readVarIntArray EntityUpdateAttributesPacketModifiers(uuid, amount, operation) + EntityUpdateAttributesPacketModifiers(uuid, amount, operation) } - return@readVarIntArray EntityUpdateAttributesPacketProperties(key, value, modifiers) + EntityUpdateAttributesPacketProperties(key, value, modifiers) } return EntityUpdateAttributesPacket(entityId, properties) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityUpdateAttributesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityUpdateAttributesPacket) { output.writeVarInt(value.entityId) output.writeVarIntArray(value.properties) { arrayValue, arrayOutput -> diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityVelocityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityVelocityPacket.kt index 94c4e05..ef66881 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityVelocityPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/EntityVelocityPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Entity Velocity | 0x50 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Entity_Velocity */ -@MinecraftPacket(id = 0x50, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class EntityVelocityPacket( val entityId: Int, // varint val velocityX: Short, @@ -22,7 +21,7 @@ data class EntityVelocityPacket( val velocityZ: Short, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityVelocityPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityVelocityPacket { val entityId = input.readVarInt() val velocityX = input.readShort() val velocityY = input.readShort() @@ -31,7 +30,7 @@ data class EntityVelocityPacket( return EntityVelocityPacket(entityId, velocityX, velocityY, velocityZ) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityVelocityPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityVelocityPacket) { output.writeVarInt(value.entityId) output.writeShort(value.velocityX) output.writeShort(value.velocityY) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExperiencePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExperiencePacket.kt index 5f75814..aa1faa4 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExperiencePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExperiencePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Experience | 0x52 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Experience */ -@MinecraftPacket(id = 0x52, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ExperiencePacket( val experienceBar: Float, val totalExperience: Int, // varint val level: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ExperiencePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ExperiencePacket { val experienceBar = input.readFloat() val totalExperience = input.readVarInt() val level = input.readVarInt() @@ -28,7 +27,7 @@ data class ExperiencePacket( return ExperiencePacket(experienceBar, totalExperience, level) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ExperiencePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ExperiencePacket) { output.writeFloat(value.experienceBar) output.writeVarInt(value.totalExperience) output.writeVarInt(value.level) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExplosionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExplosionPacket.kt index cb8fe2a..4e5bab0 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExplosionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ExplosionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Explosion | 0x1a | play | clientbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Explosion */ -@MinecraftPacket(id = 0x1a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ExplosionPacket( val x: Double, val y: Double, @@ -30,7 +29,7 @@ data class ExplosionPacket( val playerMotionZ: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ExplosionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ExplosionPacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -40,7 +39,7 @@ data class ExplosionPacket( val y = arrayInput.readByte() val z = arrayInput.readByte() - return@readVarIntArray ExplosionPacketAffectedBlockOffsets(x, y, z) + ExplosionPacketAffectedBlockOffsets(x, y, z) } val playerMotionX = input.readFloat() val playerMotionY = input.readFloat() @@ -49,7 +48,7 @@ data class ExplosionPacket( return ExplosionPacket(x, y, z, radius, affectedBlockOffsets, playerMotionX, playerMotionY, playerMotionZ) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ExplosionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ExplosionPacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FacePlayerPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FacePlayerPacket.kt index ab879b9..eba2306 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FacePlayerPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FacePlayerPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Look At | 0x37 | play | clientbound @@ -17,7 +17,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Look_At */ -@MinecraftPacket(id = 0x37, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class FacePlayerPacket( val feetEyes: Int, // varint val x: Double, @@ -28,7 +27,7 @@ data class FacePlayerPacket( val entityFeetEyes: String?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): FacePlayerPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): FacePlayerPacket { val feetEyes = input.readVarInt() val x = input.readDouble() val y = input.readDouble() @@ -46,7 +45,7 @@ data class FacePlayerPacket( return FacePlayerPacket(feetEyes, x, y, z, isEntity, entityId, entityFeetEyes) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: FacePlayerPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: FacePlayerPacket) { output.writeVarInt(value.feetEyes) output.writeDouble(value.x) output.writeDouble(value.y) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FeatureFlagsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FeatureFlagsPacket.kt index 7c6fcc6..cdca057 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FeatureFlagsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/FeatureFlagsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Feature Flags | 0x67 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Feature_Flags */ -@MinecraftPacket(id = 0x67, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class FeatureFlagsPacket( val features: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): FeatureFlagsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): FeatureFlagsPacket { val features = input.readVarIntArray { arrayInput -> arrayInput.readString() } return FeatureFlagsPacket(features) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: FeatureFlagsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: FeatureFlagsPacket) { output.writeVarIntArray(value.features) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/GameStateChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/GameStateChangePacket.kt index b1c0e88..2e208f6 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/GameStateChangePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/GameStateChangePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Game Event | 0x1c | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Game_Event */ -@MinecraftPacket(id = 0x1c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class GameStateChangePacket( val reason: UByte, val gameMode: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): GameStateChangePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): GameStateChangePacket { val reason = input.readUByte() val gameMode = input.readFloat() return GameStateChangePacket(reason, gameMode) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: GameStateChangePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: GameStateChangePacket) { output.writeUByte(value.reason) output.writeFloat(value.gameMode) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/HeldItemSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/HeldItemSlotPacket.kt index 3071c97..2bdc3db 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/HeldItemSlotPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/HeldItemSlotPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Held Item | 0x49 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Held_Item */ -@MinecraftPacket(id = 0x49, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class HeldItemSlotPacket( val slot: Byte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): HeldItemSlotPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): HeldItemSlotPacket { val slot = input.readByte() return HeldItemSlotPacket(slot) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: HeldItemSlotPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: HeldItemSlotPacket) { output.writeByte(value.slot) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/InitializeWorldBorderPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/InitializeWorldBorderPacket.kt index 4dfc6b0..dbb49cd 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/InitializeWorldBorderPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/InitializeWorldBorderPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Initialize World Border | 0x1e | play | clientbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Initialize_World_Border */ -@MinecraftPacket(id = 0x1e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class InitializeWorldBorderPacket( val x: Double, val z: Double, @@ -30,7 +29,7 @@ data class InitializeWorldBorderPacket( val warningTime: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): InitializeWorldBorderPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): InitializeWorldBorderPacket { val x = input.readDouble() val z = input.readDouble() val oldDiameter = input.readDouble() @@ -43,7 +42,7 @@ data class InitializeWorldBorderPacket( return InitializeWorldBorderPacket(x, z, oldDiameter, newDiameter, speed, portalTeleportBoundary, warningBlocks, warningTime) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: InitializeWorldBorderPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: InitializeWorldBorderPacket) { output.writeDouble(value.x) output.writeDouble(value.z) output.writeDouble(value.oldDiameter) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KeepAlivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KeepAlivePacket.kt index 9a0dbee..042f92f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KeepAlivePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KeepAlivePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Keep Alive | 0x1f | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Keep_Alive */ -@MinecraftPacket(id = 0x1f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class KeepAlivePacket( val keepAliveId: Long, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KeepAlivePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): KeepAlivePacket { val keepAliveId = input.readLong() return KeepAlivePacket(keepAliveId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KeepAlivePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: KeepAlivePacket) { output.writeLong(value.keepAliveId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KickDisconnectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KickDisconnectPacket.kt index fa841d5..9288254 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KickDisconnectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/KickDisconnectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Disconnect (play) | 0x17 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Disconnect_.28play.29 */ -@MinecraftPacket(id = 0x17, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class KickDisconnectPacket( val reason: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KickDisconnectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): KickDisconnectPacket { val reason = input.readString() return KickDisconnectPacket(reason) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KickDisconnectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: KickDisconnectPacket) { output.writeString(value.reason) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/LoginPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/LoginPacket.kt index c46fd61..9036b08 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/LoginPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/LoginPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.NBT import io.layercraft.packetlib.types.Position /** @@ -30,7 +30,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Login_.28play.29 */ -@MinecraftPacket(id = 0x24, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class LoginPacket( val entityId: Int, val isHardcore: Boolean, @@ -53,7 +52,7 @@ data class LoginPacket( val location: Position?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LoginPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LoginPacket { val entityId = input.readInt() val isHardcore = input.readBoolean() val gameMode = input.readUByte() @@ -77,7 +76,7 @@ data class LoginPacket( return LoginPacket(entityId, isHardcore, gameMode, previousGameMode, worldNames, dimensionCodec, worldType, worldName, hashedSeed, maxPlayers, viewDistance, simulationDistance, reducedDebugInfo, enableRespawnScreen, isDebug, isFlat, hasDeath, dimensionName, location) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LoginPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LoginPacket) { output.writeInt(value.entityId) output.writeBoolean(value.isHardcore) output.writeUByte(value.gameMode) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapChunkPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapChunkPacket.kt index 2f2a247..ce31683 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapChunkPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapChunkPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.ChunkBlockEntity import io.layercraft.packetlib.types.NBT /** @@ -23,7 +23,6 @@ import io.layercraft.packetlib.types.NBT * @see https://wiki.vg/Protocol#Chunk_Data_and_Update_Light */ -@MinecraftPacket(id = 0x20, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class MapChunkPacket( val x: Int, val z: Int, @@ -39,7 +38,7 @@ data class MapChunkPacket( val blockLight: List>, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MapChunkPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): MapChunkPacket { val x = input.readInt() val z = input.readInt() val heightmaps = input.readNbt() @@ -56,7 +55,7 @@ data class MapChunkPacket( return MapChunkPacket(x, z, heightmaps, chunkData, blockEntities, trustEdges, skyLightMask, blockLightMask, emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MapChunkPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: MapChunkPacket) { output.writeInt(value.x) output.writeInt(value.z) output.writeNbt(value.heightmaps) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapPacket.kt index 79fe13c..b193acb 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MapPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Map Data | 0x25 | play | clientbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Map_Data */ -@MinecraftPacket(id = 0x25, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class MapPacket( val itemDamage: Int, // varint val scale: Byte, @@ -30,7 +29,7 @@ data class MapPacket( val data: ByteArray?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MapPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): MapPacket { val itemDamage = input.readVarInt() val scale = input.readByte() val locked = input.readBoolean() @@ -55,7 +54,7 @@ data class MapPacket( return MapPacket(itemDamage, scale, locked, columns, rows, x, y, data) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MapPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: MapPacket) { output.writeVarInt(value.itemDamage) output.writeByte(value.scale) output.writeBoolean(value.locked) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MultiBlockChangePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MultiBlockChangePacket.kt index 04678fa..d1247f7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MultiBlockChangePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/MultiBlockChangePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Bitfield /** * Update Section Blocks | 0x3f | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.types.Bitfield * @see https://wiki.vg/Protocol#Update_Section_Blocks */ -@MinecraftPacket(id = 0x3f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class MultiBlockChangePacket( val chunkCoordinates: Bitfield, val suppressLightUpdates: Boolean, val records: List, // varint array of varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MultiBlockChangePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): MultiBlockChangePacket { val chunkCoordinates = Bitfield.valueOf(input.readBytes(64)) val suppressLightUpdates = input.readBoolean() val records = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } @@ -28,7 +27,7 @@ data class MultiBlockChangePacket( return MultiBlockChangePacket(chunkCoordinates, suppressLightUpdates, records) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MultiBlockChangePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: MultiBlockChangePacket) { output.writeBytes(value.chunkCoordinates.toByteArray()) output.writeBoolean(value.suppressLightUpdates) output.writeVarIntArray(value.records) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NamedEntitySpawnPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NamedEntitySpawnPacket.kt index 56259e6..195a869 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NamedEntitySpawnPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NamedEntitySpawnPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Spawn Player | 0x02 | play | clientbound @@ -17,7 +17,6 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Spawn_Player */ -@MinecraftPacket(id = 0x02, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class NamedEntitySpawnPacket( val entityId: Int, // varint val playerUUID: UUID, @@ -28,7 +27,7 @@ data class NamedEntitySpawnPacket( val pitch: Byte, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NamedEntitySpawnPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): NamedEntitySpawnPacket { val entityId = input.readVarInt() val playerUUID = input.readUUID() val x = input.readDouble() @@ -40,7 +39,7 @@ data class NamedEntitySpawnPacket( return NamedEntitySpawnPacket(entityId, playerUUID, x, y, z, yaw, pitch) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NamedEntitySpawnPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: NamedEntitySpawnPacket) { output.writeVarInt(value.entityId) output.writeUUID(value.playerUUID) output.writeDouble(value.x) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NbtQueryResponsePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NbtQueryResponsePacket.kt index b9efa62..6efb176 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NbtQueryResponsePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/NbtQueryResponsePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.NBT /** * Tag Query Response | 0x62 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.types.NBT * @see https://wiki.vg/Protocol#Tag_Query_Response */ -@MinecraftPacket(id = 0x62, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class NbtQueryResponsePacket( val transactionId: Int, // varint val nbt: NBT, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NbtQueryResponsePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): NbtQueryResponsePacket { val transactionId = input.readVarInt() val nbt = input.readNbt() return NbtQueryResponsePacket(transactionId, nbt) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NbtQueryResponsePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: NbtQueryResponsePacket) { output.writeVarInt(value.transactionId) output.writeNbt(value.nbt) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenBookPacket.kt index 2b328ad..2844589 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenBookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenBookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Open Book | 0x2b | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Open_Book */ -@MinecraftPacket(id = 0x2b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class OpenBookPacket( val hand: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenBookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): OpenBookPacket { val hand = input.readVarInt() return OpenBookPacket(hand) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenBookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: OpenBookPacket) { output.writeVarInt(value.hand) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenHorseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenHorseWindowPacket.kt index 0617fbd..94a6198 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenHorseWindowPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenHorseWindowPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Open Horse Screen | 0x1d | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Open_Horse_Screen */ -@MinecraftPacket(id = 0x1d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class OpenHorseWindowPacket( val windowId: UByte, val nbSlots: Int, // varint val entityId: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenHorseWindowPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): OpenHorseWindowPacket { val windowId = input.readUByte() val nbSlots = input.readVarInt() val entityId = input.readInt() @@ -28,7 +27,7 @@ data class OpenHorseWindowPacket( return OpenHorseWindowPacket(windowId, nbSlots, entityId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenHorseWindowPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: OpenHorseWindowPacket) { output.writeUByte(value.windowId) output.writeVarInt(value.nbSlots) output.writeInt(value.entityId) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenSignEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenSignEntityPacket.kt index 2bcb5b0..9631868 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenSignEntityPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenSignEntityPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Open Sign Editor | 0x2d | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Open_Sign_Editor */ -@MinecraftPacket(id = 0x2d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class OpenSignEntityPacket( val location: Position, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenSignEntityPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): OpenSignEntityPacket { val location = input.readPosition() return OpenSignEntityPacket(location) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenSignEntityPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: OpenSignEntityPacket) { output.writePosition(value.location) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenWindowPacket.kt index 47e0b04..6a1d822 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenWindowPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/OpenWindowPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Open Screen | 0x2c | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Open_Screen */ -@MinecraftPacket(id = 0x2c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class OpenWindowPacket( val windowId: Int, // varint val inventoryType: Int, // varint val windowTitle: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): OpenWindowPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): OpenWindowPacket { val windowId = input.readVarInt() val inventoryType = input.readVarInt() val windowTitle = input.readString() @@ -28,7 +27,7 @@ data class OpenWindowPacket( return OpenWindowPacket(windowId, inventoryType, windowTitle) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: OpenWindowPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: OpenWindowPacket) { output.writeVarInt(value.windowId) output.writeVarInt(value.inventoryType) output.writeString(value.windowTitle) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PingPacket.kt index 17ca157..64738f7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Ping (play) | 0x2e | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Ping_.28play.29 */ -@MinecraftPacket(id = 0x2e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class PingPacket( val id: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PingPacket { val id = input.readInt() return PingPacket(id) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PingPacket) { output.writeInt(value.id) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerRemovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerRemovePacket.kt index 93b3d49..eb5188b 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerRemovePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerRemovePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Player Info Remove | 0x35 | play | clientbound @@ -11,18 +11,17 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Player_Info_Remove */ -@MinecraftPacket(id = 0x35, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class PlayerRemovePacket( val players: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PlayerRemovePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PlayerRemovePacket { val players = input.readVarIntArray { arrayInput -> arrayInput.readUUID() } return PlayerRemovePacket(players) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PlayerRemovePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PlayerRemovePacket) { output.writeVarIntArray(value.players) { arrayValue, arrayOutput -> arrayOutput.writeUUID(arrayValue) } } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerlistHeaderPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerlistHeaderPacket.kt index 76d6f48..80f3c0d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerlistHeaderPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PlayerlistHeaderPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Tab List Header And Footer | 0x61 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Tab_List_Header_And_Footer */ -@MinecraftPacket(id = 0x61, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class PlayerlistHeaderPacket( val header: String, val footer: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PlayerlistHeaderPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PlayerlistHeaderPacket { val header = input.readString() val footer = input.readString() return PlayerlistHeaderPacket(header, footer) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PlayerlistHeaderPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PlayerlistHeaderPacket) { output.writeString(value.header) output.writeString(value.footer) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PositionPacket.kt index 2a68ef6..8b53791 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PositionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/PositionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Synchronize Player Position | 0x38 | play | clientbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Synchronize_Player_Position */ -@MinecraftPacket(id = 0x38, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class PositionPacket( val x: Double, val y: Double, @@ -30,7 +29,7 @@ data class PositionPacket( val dismountVehicle: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PositionPacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -43,7 +42,7 @@ data class PositionPacket( return PositionPacket(x, y, z, yaw, pitch, flags, teleportId, dismountVehicle) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PositionPacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ProfilelessChatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ProfilelessChatPacket.kt index 54ebdc8..7f69737 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ProfilelessChatPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ProfilelessChatPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Disguised Chat Message | 0x18 | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Disguised_Chat_Message */ -@MinecraftPacket(id = 0x18, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ProfilelessChatPacket( val message: String, val type: Int, // varint @@ -24,7 +23,7 @@ data class ProfilelessChatPacket( val target: String?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ProfilelessChatPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ProfilelessChatPacket { val message = input.readString() val type = input.readVarInt() val name = input.readString() @@ -34,7 +33,7 @@ data class ProfilelessChatPacket( return ProfilelessChatPacket(message, type, name, hasTarget, target) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ProfilelessChatPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ProfilelessChatPacket) { output.writeString(value.message) output.writeVarInt(value.type) output.writeString(value.name) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RelEntityMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RelEntityMovePacket.kt index 3ab6cea..0abf944 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RelEntityMovePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RelEntityMovePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Entity Position | 0x27 | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Entity_Position */ -@MinecraftPacket(id = 0x27, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class RelEntityMovePacket( val entityId: Int, // varint val dX: Short, @@ -24,7 +23,7 @@ data class RelEntityMovePacket( val onGround: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RelEntityMovePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): RelEntityMovePacket { val entityId = input.readVarInt() val dX = input.readShort() val dY = input.readShort() @@ -34,7 +33,7 @@ data class RelEntityMovePacket( return RelEntityMovePacket(entityId, dX, dY, dZ, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RelEntityMovePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: RelEntityMovePacket) { output.writeVarInt(value.entityId) output.writeShort(value.dX) output.writeShort(value.dY) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RemoveEntityEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RemoveEntityEffectPacket.kt index d10ce25..3cf5ff8 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RemoveEntityEffectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RemoveEntityEffectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Remove Entity Effect | 0x3b | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Remove_Entity_Effect */ -@MinecraftPacket(id = 0x3b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class RemoveEntityEffectPacket( val entityId: Int, // varint val effectId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RemoveEntityEffectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): RemoveEntityEffectPacket { val entityId = input.readVarInt() val effectId = input.readVarInt() return RemoveEntityEffectPacket(entityId, effectId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RemoveEntityEffectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: RemoveEntityEffectPacket) { output.writeVarInt(value.entityId) output.writeVarInt(value.effectId) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ResourcePackSendPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ResourcePackSendPacket.kt index e744ac1..b74ac73 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ResourcePackSendPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ResourcePackSendPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Resource Pack | 0x3c | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Resource_Pack */ -@MinecraftPacket(id = 0x3c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ResourcePackSendPacket( val url: String, val hash: String, @@ -24,7 +23,7 @@ data class ResourcePackSendPacket( val promptMessage: String?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ResourcePackSendPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ResourcePackSendPacket { val url = input.readString() val hash = input.readString() val forced = input.readBoolean() @@ -34,7 +33,7 @@ data class ResourcePackSendPacket( return ResourcePackSendPacket(url, hash, forced, hasPromptMessage, promptMessage) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ResourcePackSendPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ResourcePackSendPacket) { output.writeString(value.url) output.writeString(value.hash) output.writeBoolean(value.forced) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RespawnPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RespawnPacket.kt index 4608009..6160274 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RespawnPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/RespawnPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Respawn | 0x3d | play | clientbound @@ -21,7 +21,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Respawn */ -@MinecraftPacket(id = 0x3d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class RespawnPacket( val dimension: String, val worldName: String, @@ -36,7 +35,7 @@ data class RespawnPacket( val location: Position?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RespawnPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): RespawnPacket { val dimension = input.readString() val worldName = input.readString() val hashedSeed = input.readLong() @@ -52,7 +51,7 @@ data class RespawnPacket( return RespawnPacket(dimension, worldName, hashedSeed, gamemode, previousGamemode, isDebug, isFlat, copyMetadata, hasDeath, dimensionName, location) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RespawnPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: RespawnPacket) { output.writeString(value.dimension) output.writeString(value.worldName) output.writeLong(value.hashedSeed) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardDisplayObjectivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardDisplayObjectivePacket.kt index ef58aa8..afe729c 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardDisplayObjectivePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardDisplayObjectivePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Display Objective | 0x4d | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Display_Objective */ -@MinecraftPacket(id = 0x4d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ScoreboardDisplayObjectivePacket( val position: Byte, val name: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardDisplayObjectivePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ScoreboardDisplayObjectivePacket { val position = input.readByte() val name = input.readString() return ScoreboardDisplayObjectivePacket(position, name) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardDisplayObjectivePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ScoreboardDisplayObjectivePacket) { output.writeByte(value.position) output.writeString(value.name) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardObjectivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardObjectivePacket.kt index 6646db2..e2ff634 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardObjectivePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardObjectivePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Objectives | 0x54 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Objectives */ -@MinecraftPacket(id = 0x54, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ScoreboardObjectivePacket( val name: String, val action: Byte, @@ -22,7 +21,7 @@ data class ScoreboardObjectivePacket( val type: Int?, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardObjectivePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ScoreboardObjectivePacket { val name = input.readString() val action = input.readByte() val displayText = when (action.toInt()) { @@ -39,7 +38,7 @@ data class ScoreboardObjectivePacket( return ScoreboardObjectivePacket(name, action, displayText, type) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardObjectivePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ScoreboardObjectivePacket) { output.writeString(value.name) output.writeByte(value.action) when (value.action.toInt()) { diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardScorePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardScorePacket.kt index d8104e4..65e746e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardScorePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ScoreboardScorePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Score | 0x57 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Score */ -@MinecraftPacket(id = 0x57, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ScoreboardScorePacket( val itemName: String, val action: Int, // varint @@ -22,7 +21,7 @@ data class ScoreboardScorePacket( val value: Int?, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ScoreboardScorePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ScoreboardScorePacket { val itemName = input.readString() val action = input.readVarInt() val scoreName = input.readString() @@ -34,7 +33,7 @@ data class ScoreboardScorePacket( return ScoreboardScorePacket(itemName, action, scoreName, value) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ScoreboardScorePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ScoreboardScorePacket) { output.writeString(value.itemName) output.writeVarInt(value.action) output.writeString(value.scoreName) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SelectAdvancementTabPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SelectAdvancementTabPacket.kt index 5869698..beb18b2 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SelectAdvancementTabPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SelectAdvancementTabPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Select Advancements Tab | 0x40 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Select_Advancements_Tab */ -@MinecraftPacket(id = 0x40, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SelectAdvancementTabPacket( val hasId: Boolean, val id: String?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SelectAdvancementTabPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SelectAdvancementTabPacket { val hasId = input.readBoolean() val id = if (hasId) input.readString() else null return SelectAdvancementTabPacket(hasId, id) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SelectAdvancementTabPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SelectAdvancementTabPacket) { output.writeBoolean(value.hasId) if (value.hasId) output.writeString(value.id!!) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ServerDataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ServerDataPacket.kt index 4370a8a..14563d9 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ServerDataPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/ServerDataPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Server Data | 0x41 | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Server_Data */ -@MinecraftPacket(id = 0x41, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class ServerDataPacket( val hasMotd: Boolean, val motd: String?, @@ -24,7 +23,7 @@ data class ServerDataPacket( val enforcesSecureChat: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ServerDataPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ServerDataPacket { val hasMotd = input.readBoolean() val motd = if (hasMotd) input.readString() else null val hasIcon = input.readBoolean() @@ -34,7 +33,7 @@ data class ServerDataPacket( return ServerDataPacket(hasMotd, motd, hasIcon, icon, enforcesSecureChat) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ServerDataPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ServerDataPacket) { output.writeBoolean(value.hasMotd) if (value.hasMotd) output.writeString(value.motd!!) output.writeBoolean(value.hasIcon) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetCooldownPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetCooldownPacket.kt index 34cefe7..a4a7632 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetCooldownPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetCooldownPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Cooldown | 0x13 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Cooldown */ -@MinecraftPacket(id = 0x13, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetCooldownPacket( val itemID: Int, // varint val cooldownTicks: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetCooldownPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetCooldownPacket { val itemID = input.readVarInt() val cooldownTicks = input.readVarInt() return SetCooldownPacket(itemID, cooldownTicks) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetCooldownPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetCooldownPacket) { output.writeVarInt(value.itemID) output.writeVarInt(value.cooldownTicks) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetPassengersPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetPassengersPacket.kt index a1f414f..b6fbd38 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetPassengersPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetPassengersPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Passengers | 0x55 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Passengers */ -@MinecraftPacket(id = 0x55, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetPassengersPacket( val entityId: Int, // varint val passengers: List, // varint array of varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetPassengersPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetPassengersPacket { val entityId = input.readVarInt() val passengers = input.readVarIntArray { arrayInput -> arrayInput.readVarInt() } return SetPassengersPacket(entityId, passengers) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetPassengersPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetPassengersPacket) { output.writeVarInt(value.entityId) output.writeVarIntArray(value.passengers) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetSlotPacket.kt index c490f2a..09b158e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetSlotPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetSlotPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Container Slot | 0x12 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Container_Slot */ -@MinecraftPacket(id = 0x12, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetSlotPacket( val windowId: Byte, val stateId: Int, // varint val slot: Short, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetSlotPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetSlotPacket { val windowId = input.readByte() val stateId = input.readVarInt() val slot = input.readShort() @@ -28,7 +27,7 @@ data class SetSlotPacket( return SetSlotPacket(windowId, stateId, slot) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetSlotPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetSlotPacket) { output.writeByte(value.windowId) output.writeVarInt(value.stateId) output.writeShort(value.slot) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleSubtitlePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleSubtitlePacket.kt index 563cd2a..dd36e04 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleSubtitlePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleSubtitlePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Subtitle Text | 0x59 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Subtitle_Text */ -@MinecraftPacket(id = 0x59, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetTitleSubtitlePacket( val text: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleSubtitlePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetTitleSubtitlePacket { val text = input.readString() return SetTitleSubtitlePacket(text) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleSubtitlePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetTitleSubtitlePacket) { output.writeString(value.text) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTextPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTextPacket.kt index 5c88ef4..31a99ae 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTextPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTextPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Title Text | 0x5b | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Title_Text */ -@MinecraftPacket(id = 0x5b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetTitleTextPacket( val text: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleTextPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetTitleTextPacket { val text = input.readString() return SetTitleTextPacket(text) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleTextPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetTitleTextPacket) { output.writeString(value.text) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTimePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTimePacket.kt index 23397f0..9144648 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTimePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SetTitleTimePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Title Animation Times | 0x5c | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Title_Animation_Times */ -@MinecraftPacket(id = 0x5c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SetTitleTimePacket( val fadeIn: Int, val stay: Int, val fadeOut: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetTitleTimePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetTitleTimePacket { val fadeIn = input.readInt() val stay = input.readInt() val fadeOut = input.readInt() @@ -28,7 +27,7 @@ data class SetTitleTimePacket( return SetTitleTimePacket(fadeIn, stay, fadeOut) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetTitleTimePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetTitleTimePacket) { output.writeInt(value.fadeIn) output.writeInt(value.stay) output.writeInt(value.fadeOut) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SimulationDistancePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SimulationDistancePacket.kt index ccb0c47..bf9b679 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SimulationDistancePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SimulationDistancePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Simulation Distance | 0x58 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Simulation_Distance */ -@MinecraftPacket(id = 0x58, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SimulationDistancePacket( val distance: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SimulationDistancePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SimulationDistancePacket { val distance = input.readVarInt() return SimulationDistancePacket(distance) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SimulationDistancePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SimulationDistancePacket) { output.writeVarInt(value.distance) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SoundEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SoundEffectPacket.kt index 3ece858..e9daaca 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SoundEffectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SoundEffectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Sound Effect | 0x5e | play | clientbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Sound_Effect */ -@MinecraftPacket(id = 0x5e, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SoundEffectPacket( val soundId: Int, // varint val soundCategory: Int, // varint @@ -30,7 +29,7 @@ data class SoundEffectPacket( val seed: Long, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SoundEffectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SoundEffectPacket { val soundId = input.readVarInt() val soundCategory = input.readVarInt() val x = input.readInt() @@ -43,7 +42,7 @@ data class SoundEffectPacket( return SoundEffectPacket(soundId, soundCategory, x, y, z, volume, pitch, seed) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SoundEffectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SoundEffectPacket) { output.writeVarInt(value.soundId) output.writeVarInt(value.soundCategory) output.writeInt(value.x) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityExperienceOrbPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityExperienceOrbPacket.kt index eb4b6b5..5608f47 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityExperienceOrbPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityExperienceOrbPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Spawn Experience Orb | 0x01 | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Spawn_Experience_Orb */ -@MinecraftPacket(id = 0x01, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SpawnEntityExperienceOrbPacket( val entityId: Int, // varint val x: Double, @@ -24,7 +23,7 @@ data class SpawnEntityExperienceOrbPacket( val count: Short, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnEntityExperienceOrbPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SpawnEntityExperienceOrbPacket { val entityId = input.readVarInt() val x = input.readDouble() val y = input.readDouble() @@ -34,7 +33,7 @@ data class SpawnEntityExperienceOrbPacket( return SpawnEntityExperienceOrbPacket(entityId, x, y, z, count) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnEntityExperienceOrbPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SpawnEntityExperienceOrbPacket) { output.writeVarInt(value.entityId) output.writeDouble(value.x) output.writeDouble(value.y) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityPacket.kt index 9fcf6d8..97e8b1a 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnEntityPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Spawn Entity | 0x00 | play | clientbound @@ -23,7 +23,6 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Spawn_Entity */ -@MinecraftPacket(id = 0x00, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SpawnEntityPacket( val entityId: Int, // varint val objectUUID: UUID, @@ -40,7 +39,7 @@ data class SpawnEntityPacket( val velocityZ: Short, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnEntityPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SpawnEntityPacket { val entityId = input.readVarInt() val objectUUID = input.readUUID() val type = input.readVarInt() @@ -58,7 +57,7 @@ data class SpawnEntityPacket( return SpawnEntityPacket(entityId, objectUUID, type, x, y, z, pitch, yaw, headPitch, objectData, velocityX, velocityY, velocityZ) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnEntityPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SpawnEntityPacket) { output.writeVarInt(value.entityId) output.writeUUID(value.objectUUID) output.writeVarInt(value.type) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnPositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnPositionPacket.kt index 6c875b7..804535c 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnPositionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SpawnPositionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Set Default Spawn Position | 0x4c | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Set_Default_Spawn_Position */ -@MinecraftPacket(id = 0x4c, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SpawnPositionPacket( val location: Position, val angle: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpawnPositionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SpawnPositionPacket { val location = input.readPosition() val angle = input.readFloat() return SpawnPositionPacket(location, angle) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpawnPositionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SpawnPositionPacket) { output.writePosition(value.location) output.writeFloat(value.angle) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StatisticsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StatisticsPacket.kt index 9635ce8..8bcf59b 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StatisticsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StatisticsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Award Statistics | 0x04 | play | clientbound @@ -11,24 +11,23 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Award_Statistics */ -@MinecraftPacket(id = 0x04, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class StatisticsPacket( val entries: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): StatisticsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): StatisticsPacket { val entries = input.readVarIntArray { arrayInput -> val categoryId = arrayInput.readVarInt() val statisticId = arrayInput.readVarInt() val value = arrayInput.readVarInt() - return@readVarIntArray StatisticsPacketEntries(categoryId, statisticId, value) + StatisticsPacketEntries(categoryId, statisticId, value) } return StatisticsPacket(entries) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: StatisticsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: StatisticsPacket) { output.writeVarIntArray(value.entries) { arrayValue, arrayOutput -> arrayOutput.writeVarInt(arrayValue.categoryId) arrayOutput.writeVarInt(arrayValue.statisticId) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StopSoundPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StopSoundPacket.kt index c3dd5c9..ed3b135 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StopSoundPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/StopSoundPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Stop Sound | 0x5f | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Stop_Sound */ -@MinecraftPacket(id = 0x5f, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class StopSoundPacket( val flags: Byte, val source: Int?, // varint val sound: String?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): StopSoundPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): StopSoundPacket { val flags = input.readByte() val source = when (flags.toInt()) { 3 -> input.readVarInt() @@ -36,7 +35,7 @@ data class StopSoundPacket( return StopSoundPacket(flags, source, sound) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: StopSoundPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: StopSoundPacket) { output.writeByte(value.flags) when (value.flags.toInt()) { 3 -> output.writeVarInt(value.source!!) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SystemChatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SystemChatPacket.kt index 3f2f06a..c6d8084 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SystemChatPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/SystemChatPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * System Chat Message | 0x60 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#System_Chat_Message */ -@MinecraftPacket(id = 0x60, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class SystemChatPacket( val content: String, val isActionBar: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SystemChatPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SystemChatPacket { val content = input.readString() val isActionBar = input.readBoolean() return SystemChatPacket(content, isActionBar) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SystemChatPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SystemChatPacket) { output.writeString(value.content) output.writeBoolean(value.isActionBar) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TabCompletePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TabCompletePacket.kt index f891b61..5ed2575 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TabCompletePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TabCompletePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Command Suggestions Response | 0x0d | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Command_Suggestions_Response */ -@MinecraftPacket(id = 0x0d, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class TabCompletePacket( val transactionId: Int, // varint val start: Int, // varint @@ -22,7 +21,7 @@ data class TabCompletePacket( val matches: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TabCompletePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TabCompletePacket { val transactionId = input.readVarInt() val start = input.readVarInt() val length = input.readVarInt() @@ -31,13 +30,13 @@ data class TabCompletePacket( val hasTooltip = arrayInput.readBoolean() val tooltip = if (hasTooltip) arrayInput.readString() else null - return@readVarIntArray TabCompletePacketMatches(match, hasTooltip, tooltip) + TabCompletePacketMatches(match, hasTooltip, tooltip) } return TabCompletePacket(transactionId, start, length, matches) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TabCompletePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TabCompletePacket) { output.writeVarInt(value.transactionId) output.writeVarInt(value.start) output.writeVarInt(value.length) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TagsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TagsPacket.kt index fc0b75f..f9a8ab4 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TagsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TagsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Tags | 0x6a | play | clientbound @@ -11,22 +11,21 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Tags */ -@MinecraftPacket(id = 0x6a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class TagsPacket( val tags: List, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TagsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TagsPacket { val tags = input.readVarIntArray { arrayInput -> val tagType = arrayInput.readString() - return@readVarIntArray TagsPacketTags(tagType) + TagsPacketTags(tagType) } return TagsPacket(tags) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TagsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TagsPacket) { output.writeVarIntArray(value.tags) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue.tagType) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TeamsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TeamsPacket.kt index ba3c4d7..feff121 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TeamsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TeamsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Teams | 0x56 | play | clientbound @@ -20,7 +20,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Teams */ -@MinecraftPacket(id = 0x56, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class TeamsPacket( val team: String, val mode: Byte, @@ -34,7 +33,7 @@ data class TeamsPacket( val players: List?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TeamsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TeamsPacket { val team = input.readString() val mode = input.readByte() val name = when (mode.toInt()) { @@ -82,7 +81,7 @@ data class TeamsPacket( return TeamsPacket(team, mode, name, friendlyFire, nameTagVisibility, collisionRule, formatting, prefix, suffix, players) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TeamsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TeamsPacket) { output.writeString(value.team) output.writeByte(value.mode) when (value.mode.toInt()) { diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TileEntityDataPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TileEntityDataPacket.kt index 92c5d1b..cb45bb0 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TileEntityDataPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TileEntityDataPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.NBT import io.layercraft.packetlib.types.Position /** @@ -14,14 +14,13 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Block_Entity_Data */ -@MinecraftPacket(id = 0x07, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class TileEntityDataPacket( val location: Position, val action: Int, // varint val nbtData: NBT, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TileEntityDataPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TileEntityDataPacket { val location = input.readPosition() val action = input.readVarInt() val nbtData = input.readNbt() @@ -29,7 +28,7 @@ data class TileEntityDataPacket( return TileEntityDataPacket(location, action, nbtData) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TileEntityDataPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TileEntityDataPacket) { output.writePosition(value.location) output.writeVarInt(value.action) output.writeNbt(value.nbtData) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TradeListPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TradeListPacket.kt index 9fc7aa8..93c2663 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TradeListPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/TradeListPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Merchant Offers | 0x26 | play | clientbound @@ -16,7 +16,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Merchant_Offers */ -@MinecraftPacket(id = 0x26, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class TradeListPacket( val windowId: Int, // varint val trades: List, // varint array @@ -26,7 +25,7 @@ data class TradeListPacket( val canRestock: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TradeListPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TradeListPacket { val windowId = input.readVarInt() val trades = input.readVarIntArray { arrayInput -> val tradeDisabled = arrayInput.readBoolean() @@ -37,7 +36,7 @@ data class TradeListPacket( val priceMultiplier = arrayInput.readFloat() val demand = arrayInput.readInt() - return@readVarIntArray TradeListPacketTrades(tradeDisabled, nbTradeUses, maximumNbTradeUses, xp, specialPrice, priceMultiplier, demand) + TradeListPacketTrades(tradeDisabled, nbTradeUses, maximumNbTradeUses, xp, specialPrice, priceMultiplier, demand) } val villagerLevel = input.readVarInt() val experience = input.readVarInt() @@ -47,7 +46,7 @@ data class TradeListPacket( return TradeListPacket(windowId, trades, villagerLevel, experience, isRegularVillager, canRestock) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TradeListPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TradeListPacket) { output.writeVarInt(value.windowId) output.writeVarIntArray(value.trades) { arrayValue, arrayOutput -> diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnloadChunkPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnloadChunkPacket.kt index 9fefed3..5836cf5 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnloadChunkPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnloadChunkPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Unload Chunk | 0x1b | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Unload_Chunk */ -@MinecraftPacket(id = 0x1b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UnloadChunkPacket( val chunkX: Int, val chunkZ: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UnloadChunkPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UnloadChunkPacket { val chunkX = input.readInt() val chunkZ = input.readInt() return UnloadChunkPacket(chunkX, chunkZ) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UnloadChunkPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UnloadChunkPacket) { output.writeInt(value.chunkX) output.writeInt(value.chunkZ) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnlockRecipesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnlockRecipesPacket.kt index 82cf1fd..4323bd1 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnlockRecipesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UnlockRecipesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Recipe Book | 0x39 | play | clientbound @@ -21,7 +21,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Recipe_Book */ -@MinecraftPacket(id = 0x39, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UnlockRecipesPacket( val action: Int, // varint val craftingBookOpen: Boolean, @@ -36,7 +35,7 @@ data class UnlockRecipesPacket( val recipes2: List?, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UnlockRecipesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UnlockRecipesPacket { val action = input.readVarInt() val craftingBookOpen = input.readBoolean() val filteringCraftable = input.readBoolean() @@ -55,7 +54,7 @@ data class UnlockRecipesPacket( return UnlockRecipesPacket(action, craftingBookOpen, filteringCraftable, smeltingBookOpen, filteringSmeltable, blastFurnaceOpen, filteringBlastFurnace, smokerBookOpen, filteringSmoker, recipes1, recipes2) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UnlockRecipesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UnlockRecipesPacket) { output.writeVarInt(value.action) output.writeBoolean(value.craftingBookOpen) output.writeBoolean(value.filteringCraftable) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateHealthPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateHealthPacket.kt index c479cd9..ef2ff7f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateHealthPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateHealthPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Health | 0x53 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Health */ -@MinecraftPacket(id = 0x53, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UpdateHealthPacket( val health: Float, val food: Int, // varint val foodSaturation: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateHealthPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateHealthPacket { val health = input.readFloat() val food = input.readVarInt() val foodSaturation = input.readFloat() @@ -28,7 +27,7 @@ data class UpdateHealthPacket( return UpdateHealthPacket(health, food, foodSaturation) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateHealthPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateHealthPacket) { output.writeFloat(value.health) output.writeVarInt(value.food) output.writeFloat(value.foodSaturation) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateLightPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateLightPacket.kt index 3fc87aa..bd24dd7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateLightPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateLightPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Light | 0x23 | play | clientbound @@ -19,7 +19,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Light */ -@MinecraftPacket(id = 0x23, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UpdateLightPacket( val chunkX: Int, // varint val chunkZ: Int, // varint @@ -32,7 +31,7 @@ data class UpdateLightPacket( val blockLight: List>, // varint array ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateLightPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateLightPacket { val chunkX = input.readVarInt() val chunkZ = input.readVarInt() val trustEdges = input.readBoolean() @@ -46,7 +45,7 @@ data class UpdateLightPacket( return UpdateLightPacket(chunkX, chunkZ, trustEdges, skyLightMask, blockLightMask, emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateLightPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateLightPacket) { output.writeVarInt(value.chunkX) output.writeVarInt(value.chunkZ) output.writeBoolean(value.trustEdges) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateTimePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateTimePacket.kt index fc27e3b..217813f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateTimePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateTimePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Update Time | 0x5a | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Update_Time */ -@MinecraftPacket(id = 0x5a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UpdateTimePacket( val age: Long, val time: Long, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateTimePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateTimePacket { val age = input.readLong() val time = input.readLong() return UpdateTimePacket(age, time) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateTimePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateTimePacket) { output.writeLong(value.age) output.writeLong(value.time) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewDistancePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewDistancePacket.kt index bc2be5d..116e87d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewDistancePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewDistancePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Render Distance | 0x4b | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Render_Distance */ -@MinecraftPacket(id = 0x4b, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UpdateViewDistancePacket( val viewDistance: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateViewDistancePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateViewDistancePacket { val viewDistance = input.readVarInt() return UpdateViewDistancePacket(viewDistance) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateViewDistancePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateViewDistancePacket) { output.writeVarInt(value.viewDistance) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewPositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewPositionPacket.kt index 464a714..55864a5 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewPositionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/UpdateViewPositionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Center Chunk | 0x4a | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Center_Chunk */ -@MinecraftPacket(id = 0x4a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class UpdateViewPositionPacket( val chunkX: Int, // varint val chunkZ: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateViewPositionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateViewPositionPacket { val chunkX = input.readVarInt() val chunkZ = input.readVarInt() return UpdateViewPositionPacket(chunkX, chunkZ) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateViewPositionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateViewPositionPacket) { output.writeVarInt(value.chunkX) output.writeVarInt(value.chunkZ) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/VehicleMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/VehicleMovePacket.kt index 47a3351..5bec980 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/VehicleMovePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/VehicleMovePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Move Vehicle | 0x2a | play | clientbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Move_Vehicle */ -@MinecraftPacket(id = 0x2a, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class VehicleMovePacket( val x: Double, val y: Double, @@ -24,7 +23,7 @@ data class VehicleMovePacket( val pitch: Float, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): VehicleMovePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): VehicleMovePacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -34,7 +33,7 @@ data class VehicleMovePacket( return VehicleMovePacket(x, y, z, yaw, pitch) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: VehicleMovePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: VehicleMovePacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WindowItemsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WindowItemsPacket.kt index 8d4dba2..bf428de 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WindowItemsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WindowItemsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Container Content | 0x10 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Container_Content */ -@MinecraftPacket(id = 0x10, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WindowItemsPacket( val windowId: UByte, val stateId: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WindowItemsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WindowItemsPacket { val windowId = input.readUByte() val stateId = input.readVarInt() return WindowItemsPacket(windowId, stateId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WindowItemsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WindowItemsPacket) { output.writeUByte(value.windowId) output.writeVarInt(value.stateId) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderCenterPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderCenterPacket.kt index d4eb96e..bd55419 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderCenterPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderCenterPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Border Center | 0x43 | play | clientbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Border_Center */ -@MinecraftPacket(id = 0x43, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldBorderCenterPacket( val x: Double, val z: Double, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderCenterPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldBorderCenterPacket { val x = input.readDouble() val z = input.readDouble() return WorldBorderCenterPacket(x, z) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderCenterPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldBorderCenterPacket) { output.writeDouble(value.x) output.writeDouble(value.z) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderLerpSizePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderLerpSizePacket.kt index 7575299..be40efc 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderLerpSizePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderLerpSizePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Border Lerp Size | 0x44 | play | clientbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Border_Lerp_Size */ -@MinecraftPacket(id = 0x44, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldBorderLerpSizePacket( val oldDiameter: Double, val newDiameter: Double, val speed: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderLerpSizePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldBorderLerpSizePacket { val oldDiameter = input.readDouble() val newDiameter = input.readDouble() val speed = input.readVarInt() @@ -28,7 +27,7 @@ data class WorldBorderLerpSizePacket( return WorldBorderLerpSizePacket(oldDiameter, newDiameter, speed) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderLerpSizePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldBorderLerpSizePacket) { output.writeDouble(value.oldDiameter) output.writeDouble(value.newDiameter) output.writeVarInt(value.speed) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderSizePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderSizePacket.kt index 2b7e706..efed8c9 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderSizePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderSizePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Border Size | 0x45 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Border_Size */ -@MinecraftPacket(id = 0x45, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldBorderSizePacket( val diameter: Double, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderSizePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldBorderSizePacket { val diameter = input.readDouble() return WorldBorderSizePacket(diameter) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderSizePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldBorderSizePacket) { output.writeDouble(value.diameter) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningDelayPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningDelayPacket.kt index e56d342..ed4b49d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningDelayPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningDelayPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Border Warning Delay | 0x46 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Border_Warning_Delay */ -@MinecraftPacket(id = 0x46, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldBorderWarningDelayPacket( val warningTime: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderWarningDelayPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldBorderWarningDelayPacket { val warningTime = input.readVarInt() return WorldBorderWarningDelayPacket(warningTime) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderWarningDelayPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldBorderWarningDelayPacket) { output.writeVarInt(value.warningTime) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningReachPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningReachPacket.kt index 9c42219..5ef08cb 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningReachPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldBorderWarningReachPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Border Warning Distance | 0x47 | play | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Border_Warning_Distance */ -@MinecraftPacket(id = 0x47, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldBorderWarningReachPacket( val warningBlocks: Int, // varint ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldBorderWarningReachPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldBorderWarningReachPacket { val warningBlocks = input.readVarInt() return WorldBorderWarningReachPacket(warningBlocks) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldBorderWarningReachPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldBorderWarningReachPacket) { output.writeVarInt(value.warningBlocks) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldEventPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldEventPacket.kt index e6bdf9a..dc2c32d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldEventPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldEventPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * World Event | 0x21 | play | clientbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#World_Event */ -@MinecraftPacket(id = 0x21, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldEventPacket( val effectId: Int, val location: Position, @@ -22,7 +21,7 @@ data class WorldEventPacket( val global: Boolean, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldEventPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldEventPacket { val effectId = input.readInt() val location = input.readPosition() val data = input.readInt() @@ -31,7 +30,7 @@ data class WorldEventPacket( return WorldEventPacket(effectId, location, data, global) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldEventPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldEventPacket) { output.writeInt(value.effectId) output.writePosition(value.location) output.writeInt(value.data) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldParticlesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldParticlesPacket.kt index c82aeb4..802dc44 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldParticlesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/clientbound/WorldParticlesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Particle | 0x22 | play | clientbound @@ -20,7 +20,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Particle_2 */ -@MinecraftPacket(id = 0x22, state = PacketState.PLAY, direction = PacketDirection.CLIENTBOUND) data class WorldParticlesPacket( val particleId: Int, // varint val longDistance: Boolean, @@ -34,7 +33,7 @@ data class WorldParticlesPacket( val particles: Int, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WorldParticlesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WorldParticlesPacket { val particleId = input.readVarInt() val longDistance = input.readBoolean() val x = input.readDouble() @@ -49,7 +48,7 @@ data class WorldParticlesPacket( return WorldParticlesPacket(particleId, longDistance, x, y, z, offsetX, offsetY, offsetZ, particleData, particles) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WorldParticlesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WorldParticlesPacket) { output.writeVarInt(value.particleId) output.writeBoolean(value.longDistance) output.writeDouble(value.x) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AbilitiesPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AbilitiesPacket.kt index df5bfd8..eaee212 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AbilitiesPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AbilitiesPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Player Abilities | 0x1b | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Player_Abilities_2 */ -@MinecraftPacket(id = 0x1b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class AbilitiesPacket( val flags: Byte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AbilitiesPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AbilitiesPacket { val flags = input.readByte() return AbilitiesPacket(flags) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AbilitiesPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AbilitiesPacket) { output.writeByte(value.flags) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AdvancementTabPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AdvancementTabPacket.kt index 2ded96d..40b9f25 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AdvancementTabPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/AdvancementTabPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Seen Advancements | 0x25 | play | serverbound @@ -12,13 +12,12 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Seen_Advancements */ -@MinecraftPacket(id = 0x25, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class AdvancementTabPacket( val action: Int, // varint val tabId: String?, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): AdvancementTabPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): AdvancementTabPacket { val action = input.readVarInt() val tabId = when (action) { 0 -> input.readString() @@ -29,7 +28,7 @@ data class AdvancementTabPacket( return AdvancementTabPacket(action, tabId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: AdvancementTabPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: AdvancementTabPacket) { output.writeVarInt(value.action) when (value.action) { 0 -> output.writeString(value.tabId!!) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ArmAnimationPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ArmAnimationPacket.kt index c6338a0..3985504 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ArmAnimationPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ArmAnimationPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Swing Arm | 0x2f | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Swing_Arm */ -@MinecraftPacket(id = 0x2f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class ArmAnimationPacket( val hand: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ArmAnimationPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ArmAnimationPacket { val hand = input.readVarInt() return ArmAnimationPacket(hand) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ArmAnimationPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ArmAnimationPacket) { output.writeVarInt(value.hand) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockDigPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockDigPacket.kt index b5a6ff7..17b72a6 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockDigPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockDigPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Player Action | 0x1c | play | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Player_Action */ -@MinecraftPacket(id = 0x1c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class BlockDigPacket( val status: Int, // varint val location: Position, @@ -22,7 +21,7 @@ data class BlockDigPacket( val sequence: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockDigPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BlockDigPacket { val status = input.readVarInt() val location = input.readPosition() val face = input.readByte() @@ -31,7 +30,7 @@ data class BlockDigPacket( return BlockDigPacket(status, location, face, sequence) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockDigPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BlockDigPacket) { output.writeVarInt(value.status) output.writePosition(value.location) output.writeByte(value.face) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockPlacePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockPlacePacket.kt index 6e784a8..dc8bdcb 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockPlacePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/BlockPlacePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Use Item On | 0x31 | play | serverbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Use_Item_On */ -@MinecraftPacket(id = 0x31, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class BlockPlacePacket( val hand: Int, // varint val location: Position, @@ -30,7 +29,7 @@ data class BlockPlacePacket( val sequence: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): BlockPlacePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): BlockPlacePacket { val hand = input.readVarInt() val location = input.readPosition() val direction = input.readVarInt() @@ -43,7 +42,7 @@ data class BlockPlacePacket( return BlockPlacePacket(hand, location, direction, cursorX, cursorY, cursorZ, insideBlock, sequence) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: BlockPlacePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: BlockPlacePacket) { output.writeVarInt(value.hand) output.writePosition(value.location) output.writeVarInt(value.direction) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ChatSessionUpdatePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ChatSessionUpdatePacket.kt index 8f98f81..32f406e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ChatSessionUpdatePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ChatSessionUpdatePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Player Session | 0x20 | play | serverbound @@ -14,7 +14,6 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Player_Session */ -@MinecraftPacket(id = 0x20, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class ChatSessionUpdatePacket( val sessionUUID: UUID, val expireTime: Long, @@ -22,7 +21,7 @@ data class ChatSessionUpdatePacket( val signature: ByteArray, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ChatSessionUpdatePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ChatSessionUpdatePacket { val sessionUUID = input.readUUID() val expireTime = input.readLong() val publicKey = input.readVarIntByteArray() @@ -31,7 +30,7 @@ data class ChatSessionUpdatePacket( return ChatSessionUpdatePacket(sessionUUID, expireTime, publicKey, signature) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ChatSessionUpdatePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ChatSessionUpdatePacket) { output.writeUUID(value.sessionUUID) output.writeLong(value.expireTime) output.writeVarIntByteArray(value.publicKey) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ClientCommandPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ClientCommandPacket.kt index 1cc6506..151373b 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ClientCommandPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ClientCommandPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Client Command | 0x06 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Client_Command */ -@MinecraftPacket(id = 0x06, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class ClientCommandPacket( val actionId: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ClientCommandPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ClientCommandPacket { val actionId = input.readVarInt() return ClientCommandPacket(actionId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ClientCommandPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ClientCommandPacket) { output.writeVarInt(value.actionId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CloseWindowPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CloseWindowPacket.kt index 2a80d50..d38fe24 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CloseWindowPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CloseWindowPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Close Container | 0x0b | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Close_Container_2 */ -@MinecraftPacket(id = 0x0b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class CloseWindowPacket( val windowId: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CloseWindowPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CloseWindowPacket { val windowId = input.readUByte() return CloseWindowPacket(windowId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CloseWindowPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CloseWindowPacket) { output.writeUByte(value.windowId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CraftRecipeRequestPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CraftRecipeRequestPacket.kt index 77ea9fe..158dad3 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CraftRecipeRequestPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CraftRecipeRequestPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Place Recipe | 0x1a | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Place_Recipe */ -@MinecraftPacket(id = 0x1a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class CraftRecipeRequestPacket( val windowId: Byte, val recipe: String, val makeAll: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CraftRecipeRequestPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CraftRecipeRequestPacket { val windowId = input.readByte() val recipe = input.readString() val makeAll = input.readBoolean() @@ -28,7 +27,7 @@ data class CraftRecipeRequestPacket( return CraftRecipeRequestPacket(windowId, recipe, makeAll) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CraftRecipeRequestPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CraftRecipeRequestPacket) { output.writeByte(value.windowId) output.writeString(value.recipe) output.writeBoolean(value.makeAll) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CustomPayloadPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CustomPayloadPacket.kt index 0a96f32..4c31f24 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CustomPayloadPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/CustomPayloadPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Plugin Message | 0x0c | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Plugin_Message_2 */ -@MinecraftPacket(id = 0x0c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class CustomPayloadPacket( val channel: String, val data: ByteArray, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): CustomPayloadPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): CustomPayloadPacket { val channel = input.readString() val data = input.readRemainingByteArray() return CustomPayloadPacket(channel, data) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: CustomPayloadPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: CustomPayloadPacket) { output.writeString(value.channel) output.writeRemainingByteArray(value.data) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/DisplayedRecipePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/DisplayedRecipePacket.kt index 21633aa..87bf83a 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/DisplayedRecipePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/DisplayedRecipePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Seen Recipe | 0x22 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Seen_Recipe */ -@MinecraftPacket(id = 0x22, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class DisplayedRecipePacket( val recipeId: String, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): DisplayedRecipePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): DisplayedRecipePacket { val recipeId = input.readString() return DisplayedRecipePacket(recipeId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: DisplayedRecipePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: DisplayedRecipePacket) { output.writeString(value.recipeId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EditBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EditBookPacket.kt index d4276a3..b08462f 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EditBookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EditBookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Edit Book | 0x0d | play | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Edit_Book */ -@MinecraftPacket(id = 0x0d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class EditBookPacket( val hand: Int, // varint val pages: List, // varint array @@ -22,7 +21,7 @@ data class EditBookPacket( val title: String?, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EditBookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EditBookPacket { val hand = input.readVarInt() val pages = input.readVarIntArray { arrayInput -> arrayInput.readString() } val hasTitle = input.readBoolean() @@ -31,7 +30,7 @@ data class EditBookPacket( return EditBookPacket(hand, pages, hasTitle, title) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EditBookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EditBookPacket) { output.writeVarInt(value.hand) output.writeVarIntArray(value.pages) { arrayValue, arrayOutput -> arrayOutput.writeString(arrayValue) } output.writeBoolean(value.hasTitle) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EnchantItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EnchantItemPacket.kt index db127d9..b64b813 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EnchantItemPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EnchantItemPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Click Container Button | 0x09 | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Click_Container_Button */ -@MinecraftPacket(id = 0x09, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class EnchantItemPacket( val windowId: Byte, val enchantment: Byte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EnchantItemPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EnchantItemPacket { val windowId = input.readByte() val enchantment = input.readByte() return EnchantItemPacket(windowId, enchantment) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EnchantItemPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EnchantItemPacket) { output.writeByte(value.windowId) output.writeByte(value.enchantment) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EntityActionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EntityActionPacket.kt index 7fe9b08..6a80c26 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EntityActionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/EntityActionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Player Command | 0x1d | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Player_Command */ -@MinecraftPacket(id = 0x1d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class EntityActionPacket( val entityId: Int, // varint val actionId: Int, // varint val jumpBoost: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): EntityActionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): EntityActionPacket { val entityId = input.readVarInt() val actionId = input.readVarInt() val jumpBoost = input.readVarInt() @@ -28,7 +27,7 @@ data class EntityActionPacket( return EntityActionPacket(entityId, actionId, jumpBoost) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: EntityActionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: EntityActionPacket) { output.writeVarInt(value.entityId) output.writeVarInt(value.actionId) output.writeVarInt(value.jumpBoost) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/FlyingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/FlyingPacket.kt index cd7920d..33a5dad 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/FlyingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/FlyingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Player On Ground | 0x16 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Player_On_Ground */ -@MinecraftPacket(id = 0x16, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class FlyingPacket( val onGround: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): FlyingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): FlyingPacket { val onGround = input.readBoolean() return FlyingPacket(onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: FlyingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: FlyingPacket) { output.writeBoolean(value.onGround) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/GenerateStructurePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/GenerateStructurePacket.kt index 2191fb5..f8b8dcb 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/GenerateStructurePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/GenerateStructurePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Jigsaw Generate | 0x10 | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Jigsaw_Generate */ -@MinecraftPacket(id = 0x10, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class GenerateStructurePacket( val location: Position, val levels: Int, // varint val keepJigsaws: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): GenerateStructurePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): GenerateStructurePacket { val location = input.readPosition() val levels = input.readVarInt() val keepJigsaws = input.readBoolean() @@ -28,7 +27,7 @@ data class GenerateStructurePacket( return GenerateStructurePacket(location, levels, keepJigsaws) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: GenerateStructurePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: GenerateStructurePacket) { output.writePosition(value.location) output.writeVarInt(value.levels) output.writeBoolean(value.keepJigsaws) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/HeldItemSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/HeldItemSlotPacket.kt index a5269df..5b5a29d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/HeldItemSlotPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/HeldItemSlotPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Held Item | 0x28 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Held_Item_2 */ -@MinecraftPacket(id = 0x28, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class HeldItemSlotPacket( val slotId: Short, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): HeldItemSlotPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): HeldItemSlotPacket { val slotId = input.readShort() return HeldItemSlotPacket(slotId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: HeldItemSlotPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: HeldItemSlotPacket) { output.writeShort(value.slotId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/KeepAlivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/KeepAlivePacket.kt index 27aa2f3..794b209 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/KeepAlivePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/KeepAlivePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Keep Alive | 0x11 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Keep_Alive_2 */ -@MinecraftPacket(id = 0x11, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class KeepAlivePacket( val keepAliveId: Long, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): KeepAlivePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): KeepAlivePacket { val keepAliveId = input.readLong() return KeepAlivePacket(keepAliveId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: KeepAlivePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: KeepAlivePacket) { output.writeLong(value.keepAliveId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LockDifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LockDifficultyPacket.kt index 4fa61e3..e81aeda 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LockDifficultyPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LockDifficultyPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Lock Difficulty | 0x12 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Lock_Difficulty */ -@MinecraftPacket(id = 0x12, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class LockDifficultyPacket( val locked: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LockDifficultyPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LockDifficultyPacket { val locked = input.readBoolean() return LockDifficultyPacket(locked) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LockDifficultyPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LockDifficultyPacket) { output.writeBoolean(value.locked) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LookPacket.kt index 8efe403..c0957ea 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/LookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Player Rotation | 0x15 | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Player_Rotation */ -@MinecraftPacket(id = 0x15, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class LookPacket( val yaw: Float, val pitch: Float, val onGround: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): LookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): LookPacket { val yaw = input.readFloat() val pitch = input.readFloat() val onGround = input.readBoolean() @@ -28,7 +27,7 @@ data class LookPacket( return LookPacket(yaw, pitch, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: LookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: LookPacket) { output.writeFloat(value.yaw) output.writeFloat(value.pitch) output.writeBoolean(value.onGround) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/MessageAcknowledgementPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/MessageAcknowledgementPacket.kt index 59fad83..63601a5 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/MessageAcknowledgementPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/MessageAcknowledgementPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Message Acknowledgment | 0x03 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Message_Acknowledgment */ -@MinecraftPacket(id = 0x03, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class MessageAcknowledgementPacket( val count: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): MessageAcknowledgementPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): MessageAcknowledgementPacket { val count = input.readVarInt() return MessageAcknowledgementPacket(count) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: MessageAcknowledgementPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: MessageAcknowledgementPacket) { output.writeVarInt(value.count) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/NameItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/NameItemPacket.kt index 8e22b79..b54d00a 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/NameItemPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/NameItemPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Rename Item | 0x23 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Rename_Item */ -@MinecraftPacket(id = 0x23, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class NameItemPacket( val name: String, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): NameItemPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): NameItemPacket { val name = input.readString() return NameItemPacket(name) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: NameItemPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: NameItemPacket) { output.writeString(value.name) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PickItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PickItemPacket.kt index 834cee5..f765996 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PickItemPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PickItemPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Pick Item | 0x19 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Pick_Item */ -@MinecraftPacket(id = 0x19, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class PickItemPacket( val slot: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PickItemPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PickItemPacket { val slot = input.readVarInt() return PickItemPacket(slot) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PickItemPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PickItemPacket) { output.writeVarInt(value.slot) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PongPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PongPacket.kt index b10c506..655fc3d 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PongPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PongPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Pong (play) | 0x1f | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Pong_.28play.29 */ -@MinecraftPacket(id = 0x1f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class PongPacket( val id: Int, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PongPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PongPacket { val id = input.readInt() return PongPacket(id) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PongPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PongPacket) { output.writeInt(value.id) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionLookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionLookPacket.kt index d73312c..2d633b1 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionLookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionLookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Player Position and Rotation | 0x14 | play | serverbound @@ -16,7 +16,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Player_Position_and_Rotation */ -@MinecraftPacket(id = 0x14, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class PositionLookPacket( val x: Double, val y: Double, @@ -26,7 +25,7 @@ data class PositionLookPacket( val onGround: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionLookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PositionLookPacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -37,7 +36,7 @@ data class PositionLookPacket( return PositionLookPacket(x, y, z, yaw, pitch, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionLookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PositionLookPacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionPacket.kt index 5e733c3..9610ece 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/PositionPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Player Position | 0x13 | play | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Player_Position */ -@MinecraftPacket(id = 0x13, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class PositionPacket( val x: Double, val y: Double, @@ -22,7 +21,7 @@ data class PositionPacket( val onGround: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PositionPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PositionPacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -31,7 +30,7 @@ data class PositionPacket( return PositionPacket(x, y, z, onGround) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PositionPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PositionPacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryBlockNbtPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryBlockNbtPacket.kt index 51128fa..0b06943 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryBlockNbtPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryBlockNbtPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Query Block Entity Tag | 0x01 | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Query_Block_Entity_Tag */ -@MinecraftPacket(id = 0x01, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class QueryBlockNbtPacket( val transactionId: Int, // varint val location: Position, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): QueryBlockNbtPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): QueryBlockNbtPacket { val transactionId = input.readVarInt() val location = input.readPosition() return QueryBlockNbtPacket(transactionId, location) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: QueryBlockNbtPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: QueryBlockNbtPacket) { output.writeVarInt(value.transactionId) output.writePosition(value.location) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryEntityNbtPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryEntityNbtPacket.kt index af60f1a..7fa7f10 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryEntityNbtPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/QueryEntityNbtPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Query Entity Tag | 0x0e | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Query_Entity_Tag */ -@MinecraftPacket(id = 0x0e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class QueryEntityNbtPacket( val transactionId: Int, // varint val entityId: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): QueryEntityNbtPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): QueryEntityNbtPacket { val transactionId = input.readVarInt() val entityId = input.readVarInt() return QueryEntityNbtPacket(transactionId, entityId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: QueryEntityNbtPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: QueryEntityNbtPacket) { output.writeVarInt(value.transactionId) output.writeVarInt(value.entityId) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/RecipeBookPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/RecipeBookPacket.kt index 0d2a3de..79cd0ae 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/RecipeBookPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/RecipeBookPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Change Recipe Book Settings | 0x21 | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Change_Recipe_Book_Settings */ -@MinecraftPacket(id = 0x21, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class RecipeBookPacket( val bookId: Int, // varint val bookOpen: Boolean, val filterActive: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): RecipeBookPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): RecipeBookPacket { val bookId = input.readVarInt() val bookOpen = input.readBoolean() val filterActive = input.readBoolean() @@ -28,7 +27,7 @@ data class RecipeBookPacket( return RecipeBookPacket(bookId, bookOpen, filterActive) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: RecipeBookPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: RecipeBookPacket) { output.writeVarInt(value.bookId) output.writeBoolean(value.bookOpen) output.writeBoolean(value.filterActive) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ResourcePackReceivePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ResourcePackReceivePacket.kt index 6d05ec8..efa33c8 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ResourcePackReceivePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/ResourcePackReceivePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Resource Pack | 0x24 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Resource_Pack_2 */ -@MinecraftPacket(id = 0x24, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class ResourcePackReceivePacket( val result: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ResourcePackReceivePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ResourcePackReceivePacket { val result = input.readVarInt() return ResourcePackReceivePacket(result) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ResourcePackReceivePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ResourcePackReceivePacket) { output.writeVarInt(value.result) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SelectTradePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SelectTradePacket.kt index eb6b1e3..de620ea 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SelectTradePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SelectTradePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Select Trade | 0x26 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Select_Trade */ -@MinecraftPacket(id = 0x26, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SelectTradePacket( val slot: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SelectTradePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SelectTradePacket { val slot = input.readVarInt() return SelectTradePacket(slot) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SelectTradePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SelectTradePacket) { output.writeVarInt(value.slot) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SessionPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SessionPacket.kt deleted file mode 100644 index bc16519..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SessionPacket.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.layercraft.packetlib.packets.v1_19_3.play.serverbound - -import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.util.UUID -/** - * Player Session | 0x20 | play | serverbound - * - * @param sessionUUID sessionUUID - * @param expireTime expireTime - * @param publicKey publicKey - * @param signature signature - * @see https://wiki.vg/Protocol#Player_Session - */ - -@MinecraftPacket(id = 0x20, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) -data class SessionPacket( - val sessionUUID: UUID, - val expireTime: Long, - val publicKey: ByteArray, - val signature: ByteArray, -) : ServerBoundPacket { - companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SessionPacket { - val sessionUUID = input.readUUID() - val expireTime = input.readLong() - val publicKey = input.readVarIntByteArray() - val signature = input.readVarIntByteArray() - - return SessionPacket(sessionUUID, expireTime, publicKey, signature) - } - - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SessionPacket) { - output.writeUUID(value.sessionUUID) - output.writeLong(value.expireTime) - output.writeVarIntByteArray(value.publicKey) - output.writeVarIntByteArray(value.signature) - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetBeaconEffectPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetBeaconEffectPacket.kt index 06db8be..54c42fd 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetBeaconEffectPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetBeaconEffectPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Beacon Effect | 0x27 | play | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Beacon_Effect */ -@MinecraftPacket(id = 0x27, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SetBeaconEffectPacket( val hasPrimaryEffect: Boolean, val primaryEffect: Int?, // varint @@ -22,7 +21,7 @@ data class SetBeaconEffectPacket( val secondaryEffect: Int?, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetBeaconEffectPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetBeaconEffectPacket { val hasPrimaryEffect = input.readBoolean() val primaryEffect = if (hasPrimaryEffect) input.readVarInt() else null val hasSecondaryEffect = input.readBoolean() @@ -31,7 +30,7 @@ data class SetBeaconEffectPacket( return SetBeaconEffectPacket(hasPrimaryEffect, primaryEffect, hasSecondaryEffect, secondaryEffect) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetBeaconEffectPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetBeaconEffectPacket) { output.writeBoolean(value.hasPrimaryEffect) if (value.hasPrimaryEffect) output.writeVarInt(value.primaryEffect!!) output.writeBoolean(value.hasSecondaryEffect) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetCreativeSlotPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetCreativeSlotPacket.kt index 493d5c4..7b22783 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetCreativeSlotPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetCreativeSlotPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Set Creative Mode Slot | 0x2b | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Set_Creative_Mode_Slot */ -@MinecraftPacket(id = 0x2b, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SetCreativeSlotPacket( val slot: Short, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetCreativeSlotPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetCreativeSlotPacket { val slot = input.readShort() return SetCreativeSlotPacket(slot) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetCreativeSlotPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetCreativeSlotPacket) { output.writeShort(value.slot) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetDifficultyPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetDifficultyPacket.kt index 95fdcf6..02f2c61 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetDifficultyPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SetDifficultyPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Change Difficulty | 0x02 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Change_Difficulty_2 */ -@MinecraftPacket(id = 0x02, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SetDifficultyPacket( val newDifficulty: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SetDifficultyPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SetDifficultyPacket { val newDifficulty = input.readUByte() return SetDifficultyPacket(newDifficulty) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SetDifficultyPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SetDifficultyPacket) { output.writeUByte(value.newDifficulty) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SettingsPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SettingsPacket.kt index 2ba3319..f9fee00 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SettingsPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SettingsPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Client Information | 0x07 | play | serverbound @@ -18,7 +18,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Client_Information */ -@MinecraftPacket(id = 0x07, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SettingsPacket( val locale: String, val viewDistance: Byte, @@ -30,7 +29,7 @@ data class SettingsPacket( val enableServerListing: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SettingsPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SettingsPacket { val locale = input.readString() val viewDistance = input.readByte() val chatFlags = input.readVarInt() @@ -43,7 +42,7 @@ data class SettingsPacket( return SettingsPacket(locale, viewDistance, chatFlags, chatColors, skinParts, mainHand, enableTextFiltering, enableServerListing) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SettingsPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SettingsPacket) { output.writeString(value.locale) output.writeByte(value.viewDistance) output.writeVarInt(value.chatFlags) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SpectatePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SpectatePacket.kt index 44a95d6..651ec2b 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SpectatePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SpectatePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.util.UUID /** * Teleport To Entity | 0x30 | play | serverbound @@ -11,18 +11,17 @@ import java.util.UUID * @see https://wiki.vg/Protocol#Teleport_To_Entity */ -@MinecraftPacket(id = 0x30, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SpectatePacket( val target: UUID, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SpectatePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SpectatePacket { val target = input.readUUID() return SpectatePacket(target) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SpectatePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SpectatePacket) { output.writeUUID(value.target) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerBoatPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerBoatPacket.kt index 8285e04..d2e6d78 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerBoatPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerBoatPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Paddle Boat | 0x18 | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Paddle_Boat */ -@MinecraftPacket(id = 0x18, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SteerBoatPacket( val leftPaddle: Boolean, val rightPaddle: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SteerBoatPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SteerBoatPacket { val leftPaddle = input.readBoolean() val rightPaddle = input.readBoolean() return SteerBoatPacket(leftPaddle, rightPaddle) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SteerBoatPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SteerBoatPacket) { output.writeBoolean(value.leftPaddle) output.writeBoolean(value.rightPaddle) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerVehiclePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerVehiclePacket.kt index afdbbb9..3cc1aa7 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerVehiclePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/SteerVehiclePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Player Input | 0x1e | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Player_Input */ -@MinecraftPacket(id = 0x1e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class SteerVehiclePacket( val sideways: Float, val forward: Float, val jump: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): SteerVehiclePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): SteerVehiclePacket { val sideways = input.readFloat() val forward = input.readFloat() val jump = input.readUByte() @@ -28,7 +27,7 @@ data class SteerVehiclePacket( return SteerVehiclePacket(sideways, forward, jump) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: SteerVehiclePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: SteerVehiclePacket) { output.writeFloat(value.sideways) output.writeFloat(value.forward) output.writeUByte(value.jump) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TabCompletePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TabCompletePacket.kt index 8c4da50..601f391 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TabCompletePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TabCompletePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Command Suggestions Request | 0x08 | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Command_Suggestions_Request */ -@MinecraftPacket(id = 0x08, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class TabCompletePacket( val transactionId: Int, // varint val text: String, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TabCompletePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TabCompletePacket { val transactionId = input.readVarInt() val text = input.readString() return TabCompletePacket(transactionId, text) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TabCompletePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TabCompletePacket) { output.writeVarInt(value.transactionId) output.writeString(value.text) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TeleportConfirmPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TeleportConfirmPacket.kt index 83e5a1e..1d86611 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TeleportConfirmPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/TeleportConfirmPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Confirm Teleportation | 0x00 | play | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Confirm_Teleportation */ -@MinecraftPacket(id = 0x00, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class TeleportConfirmPacket( val teleportId: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): TeleportConfirmPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): TeleportConfirmPacket { val teleportId = input.readVarInt() return TeleportConfirmPacket(teleportId) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: TeleportConfirmPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: TeleportConfirmPacket) { output.writeVarInt(value.teleportId) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockMinecartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockMinecartPacket.kt index f3810aa..5605669 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockMinecartPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockMinecartPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Program Command Block Minecart | 0x2a | play | serverbound @@ -13,14 +13,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Program_Command_Block_Minecart */ -@MinecraftPacket(id = 0x2a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UpdateCommandBlockMinecartPacket( val entityId: Int, // varint val command: String, val trackOutput: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateCommandBlockMinecartPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateCommandBlockMinecartPacket { val entityId = input.readVarInt() val command = input.readString() val trackOutput = input.readBoolean() @@ -28,7 +27,7 @@ data class UpdateCommandBlockMinecartPacket( return UpdateCommandBlockMinecartPacket(entityId, command, trackOutput) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateCommandBlockMinecartPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateCommandBlockMinecartPacket) { output.writeVarInt(value.entityId) output.writeString(value.command) output.writeBoolean(value.trackOutput) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockPacket.kt index 4b14d0f..d60c802 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateCommandBlockPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Program Command Block | 0x29 | play | serverbound @@ -14,7 +14,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Program_Command_Block */ -@MinecraftPacket(id = 0x29, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UpdateCommandBlockPacket( val location: Position, val command: String, @@ -22,7 +21,7 @@ data class UpdateCommandBlockPacket( val flags: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateCommandBlockPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateCommandBlockPacket { val location = input.readPosition() val command = input.readString() val mode = input.readVarInt() @@ -31,7 +30,7 @@ data class UpdateCommandBlockPacket( return UpdateCommandBlockPacket(location, command, mode, flags) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateCommandBlockPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateCommandBlockPacket) { output.writePosition(value.location) output.writeString(value.command) output.writeVarInt(value.mode) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateJigsawBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateJigsawBlockPacket.kt index 2227851..9cf3f24 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateJigsawBlockPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateJigsawBlockPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Program Jigsaw Block | 0x2c | play | serverbound @@ -16,7 +16,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Program_Jigsaw_Block */ -@MinecraftPacket(id = 0x2c, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UpdateJigsawBlockPacket( val location: Position, val name: String, @@ -26,7 +25,7 @@ data class UpdateJigsawBlockPacket( val jointType: String, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateJigsawBlockPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateJigsawBlockPacket { val location = input.readPosition() val name = input.readString() val target = input.readString() @@ -37,7 +36,7 @@ data class UpdateJigsawBlockPacket( return UpdateJigsawBlockPacket(location, name, target, pool, finalState, jointType) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateJigsawBlockPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateJigsawBlockPacket) { output.writePosition(value.location) output.writeString(value.name) output.writeString(value.target) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateSignPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateSignPacket.kt index f5e550a..3b9ad79 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateSignPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateSignPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Update Sign | 0x2e | play | serverbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Update_Sign */ -@MinecraftPacket(id = 0x2e, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UpdateSignPacket( val location: Position, val text1: String, @@ -24,7 +23,7 @@ data class UpdateSignPacket( val text4: String, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateSignPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateSignPacket { val location = input.readPosition() val text1 = input.readString() val text2 = input.readString() @@ -34,7 +33,7 @@ data class UpdateSignPacket( return UpdateSignPacket(location, text1, text2, text3, text4) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateSignPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateSignPacket) { output.writePosition(value.location) output.writeString(value.text1) output.writeString(value.text2) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateStructureBlockPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateStructureBlockPacket.kt index 906d6cc..c6a71ac 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateStructureBlockPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UpdateStructureBlockPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import io.layercraft.packetlib.types.Position /** * Program Structure Block | 0x2d | play | serverbound @@ -26,7 +26,6 @@ import io.layercraft.packetlib.types.Position * @see https://wiki.vg/Protocol#Program_Structure_Block */ -@MinecraftPacket(id = 0x2d, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UpdateStructureBlockPacket( val location: Position, val action: Int, // varint @@ -46,7 +45,7 @@ data class UpdateStructureBlockPacket( val flags: UByte, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UpdateStructureBlockPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UpdateStructureBlockPacket { val location = input.readPosition() val action = input.readVarInt() val mode = input.readVarInt() @@ -67,7 +66,7 @@ data class UpdateStructureBlockPacket( return UpdateStructureBlockPacket(location, action, mode, name, offsetX, offsetY, offsetZ, sizeX, sizeY, sizeZ, mirror, rotation, metadata, integrity, seed, flags) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UpdateStructureBlockPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UpdateStructureBlockPacket) { output.writePosition(value.location) output.writeVarInt(value.action) output.writeVarInt(value.mode) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseEntityPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseEntityPacket.kt index fdd4140..8609f3e 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseEntityPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseEntityPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Interact | 0x0f | play | serverbound @@ -17,7 +17,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Interact */ -@MinecraftPacket(id = 0x0f, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UseEntityPacket( val target: Int, // varint val mouse: Int, // varint @@ -28,7 +27,7 @@ data class UseEntityPacket( val sneaking: Boolean, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UseEntityPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UseEntityPacket { val target = input.readVarInt() val mouse = input.readVarInt() val x = when (mouse) { @@ -53,7 +52,7 @@ data class UseEntityPacket( return UseEntityPacket(target, mouse, x, y, z, hand, sneaking) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UseEntityPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UseEntityPacket) { output.writeVarInt(value.target) output.writeVarInt(value.mouse) when (value.mouse) { diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseItemPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseItemPacket.kt index 1bd3412..63ba261 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseItemPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/UseItemPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Use Item | 0x32 | play | serverbound @@ -12,20 +12,19 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Use_Item */ -@MinecraftPacket(id = 0x32, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class UseItemPacket( val hand: Int, // varint val sequence: Int, // varint ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): UseItemPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): UseItemPacket { val hand = input.readVarInt() val sequence = input.readVarInt() return UseItemPacket(hand, sequence) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: UseItemPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: UseItemPacket) { output.writeVarInt(value.hand) output.writeVarInt(value.sequence) } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/VehicleMovePacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/VehicleMovePacket.kt index 6e7e57b..a5cd2d4 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/VehicleMovePacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/VehicleMovePacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Move Vehicle | 0x17 | play | serverbound @@ -15,7 +15,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Move_Vehicle_2 */ -@MinecraftPacket(id = 0x17, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class VehicleMovePacket( val x: Double, val y: Double, @@ -24,7 +23,7 @@ data class VehicleMovePacket( val pitch: Float, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): VehicleMovePacket { + override fun deserialize(input: MCProtocolDeserializer<*>): VehicleMovePacket { val x = input.readDouble() val y = input.readDouble() val z = input.readDouble() @@ -34,7 +33,7 @@ data class VehicleMovePacket( return VehicleMovePacket(x, y, z, yaw, pitch) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: VehicleMovePacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: VehicleMovePacket) { output.writeDouble(value.x) output.writeDouble(value.y) output.writeDouble(value.z) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/WindowClickPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/WindowClickPacket.kt index 0c8f73e..413b2d9 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/WindowClickPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/play/serverbound/WindowClickPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.play.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Click Container | 0x0a | play | serverbound @@ -16,7 +16,6 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Click_Container */ -@MinecraftPacket(id = 0x0a, state = PacketState.PLAY, direction = PacketDirection.SERVERBOUND) data class WindowClickPacket( val windowId: UByte, val stateId: Int, // varint @@ -26,7 +25,7 @@ data class WindowClickPacket( val changedSlots: List, // varint array ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): WindowClickPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): WindowClickPacket { val windowId = input.readUByte() val stateId = input.readVarInt() val slot = input.readShort() @@ -35,13 +34,13 @@ data class WindowClickPacket( val changedSlots = input.readVarIntArray { arrayInput -> val location = arrayInput.readShort() - return@readVarIntArray WindowClickPacketChangedSlots(location) + WindowClickPacketChangedSlots(location) } return WindowClickPacket(windowId, stateId, slot, mouseButton, mode, changedSlots) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: WindowClickPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: WindowClickPacket) { output.writeUByte(value.windowId) output.writeVarInt(value.stateId) output.writeShort(value.slot) diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/PingPacket.kt index f32dd3b..faf14a4 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/PingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/PingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.status.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Ping Response | 0x01 | status | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Ping_Response */ -@MinecraftPacket(id = 0x01, state = PacketState.STATUS, direction = PacketDirection.CLIENTBOUND) data class PingPacket( val time: Long, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PingPacket { val time = input.readLong() return PingPacket(time) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PingPacket) { output.writeLong(value.time) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/ServerInfoPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/ServerInfoPacket.kt index 6d9560d..6d46ad5 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/ServerInfoPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/clientbound/ServerInfoPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.status.clientbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Status Response | 0x00 | status | clientbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Status_Response */ -@MinecraftPacket(id = 0x00, state = PacketState.STATUS, direction = PacketDirection.CLIENTBOUND) data class ServerInfoPacket( val response: String, ) : ClientBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): ServerInfoPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): ServerInfoPacket { val response = input.readString() return ServerInfoPacket(response) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: ServerInfoPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: ServerInfoPacket) { output.writeString(value.response) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingPacket.kt index 7774dd4..9edec83 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.status.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Ping Request | 0x01 | status | serverbound @@ -11,18 +11,17 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Ping_Request */ -@MinecraftPacket(id = 0x01, state = PacketState.STATUS, direction = PacketDirection.SERVERBOUND) data class PingPacket( val time: Long, ) : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PingPacket { val time = input.readLong() return PingPacket(time) } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PingPacket) { output.writeLong(value.time) } } diff --git a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingStartPacket.kt b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingStartPacket.kt index cc553d2..e3ad425 100644 --- a/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingStartPacket.kt +++ b/src/main/kotlin/io/layercraft/packetlib/packets/v1_19_3/status/serverbound/PingStartPacket.kt @@ -1,8 +1,8 @@ package io.layercraft.packetlib.packets.v1_19_3.status.serverbound import io.layercraft.packetlib.packets.* -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer /** * Status Request | 0x00 | status | serverbound @@ -11,14 +11,13 @@ import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface * @see https://wiki.vg/Protocol#Status_Request */ -@MinecraftPacket(id = 0x00, state = PacketState.STATUS, direction = PacketDirection.SERVERBOUND) class PingStartPacket() : ServerBoundPacket { companion object : PacketSerializer { - override fun deserialize(input: MinecraftProtocolDeserializeInterface<*>): PingStartPacket { + override fun deserialize(input: MCProtocolDeserializer<*>): PingStartPacket { return PingStartPacket() } - override fun serialize(output: MinecraftProtocolSerializeInterface<*>, value: PingStartPacket) { + override fun serialize(output: MCProtocolSerializer<*>, value: PingStartPacket) { } } } \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolDeserializeInterface.kt b/src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolDeserializer.kt similarity index 81% rename from src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolDeserializeInterface.kt rename to src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolDeserializer.kt index 2a71566..125a7ca 100644 --- a/src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolDeserializeInterface.kt +++ b/src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolDeserializer.kt @@ -1,9 +1,6 @@ package io.layercraft.packetlib.serialization -import io.layercraft.packetlib.types.ChunkBlockEntity -import io.layercraft.packetlib.types.NBT -import io.layercraft.packetlib.types.Position -import io.layercraft.packetlib.utils.* +import io.layercraft.packetlib.types.* import java.util.* /** @@ -12,7 +9,7 @@ import java.util.* * @constructor Create empty Minecraft protocol serialize interface * @see https://wiki.vg/Protocol#Data_types */ -interface MinecraftProtocolDeserializeInterface { +interface MCProtocolDeserializer { val input: I @@ -42,11 +39,11 @@ interface MinecraftProtocolDeserializeInterface { fun readUTF8String(): String = readBytes(readShort().toInt()).toString() fun readVarIntByteArray(): ByteArray = readBytes(readVarInt()) - fun readVarIntArray(decoder: (input: MinecraftProtocolDeserializeInterface) -> T): List = + fun readVarIntArray(decoder: (input: MCProtocolDeserializer) -> T): List = (1..readVarInt()).map { decoder(this) }.toList() fun readRemainingByteArray(): ByteArray = readBytes() - fun readRemainingArray(decoder: (input: MinecraftProtocolDeserializeInterface) -> T): List { + fun readRemainingArray(decoder: (input: MCProtocolDeserializer) -> T): List { val list: MutableList = mutableListOf() while (remaining > 0) { diff --git a/src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolSerializeInterface.kt b/src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolSerializer.kt similarity index 82% rename from src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolSerializeInterface.kt rename to src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolSerializer.kt index f15eb6d..777a5b3 100644 --- a/src/main/kotlin/io/layercraft/packetlib/serialization/MinecraftProtocolSerializeInterface.kt +++ b/src/main/kotlin/io/layercraft/packetlib/serialization/MCProtocolSerializer.kt @@ -1,10 +1,7 @@ package io.layercraft.packetlib.serialization -import io.layercraft.packetlib.types.ChunkBlockEntity -import io.layercraft.packetlib.types.NBT -import io.layercraft.packetlib.types.Position -import io.layercraft.packetlib.utils.* -import java.util.UUID +import io.layercraft.packetlib.types.* +import java.util.* /** * Minecraft protocol serialize interface @@ -12,7 +9,7 @@ import java.util.UUID * @constructor Create empty Minecraft protocol serialize interface * @see https://wiki.vg/Protocol#Data_types */ -interface MinecraftProtocolSerializeInterface { +interface MCProtocolSerializer { val output: O @@ -40,13 +37,13 @@ interface MinecraftProtocolSerializeInterface { writeVarInt(input.size) writeBytes(input) } - fun writeVarIntArray(input: List, encoder: (value: T, output: MinecraftProtocolSerializeInterface) -> Unit) { + fun writeVarIntArray(input: List, encoder: (value: T, output: MCProtocolSerializer) -> Unit) { writeVarInt(input.size) input.forEach { encoder(it, this) } } fun writeRemainingByteArray(input: ByteArray) = writeBytes(input) - fun writeRemainingArray(input: List, encoder: (value: T, output: MinecraftProtocolSerializeInterface) -> Unit) = input.forEach { encoder(it, this) } + fun writeRemainingArray(input: List, encoder: (value: T, output: MCProtocolSerializer) -> Unit) = input.forEach { encoder(it, this) } fun writePosition(input: Position) = writeLong(Position.positionToLong(input)) fun writeUUID(input: UUID) { diff --git a/src/main/kotlin/io/layercraft/packetlib/types/ChunkBlockEntity.kt b/src/main/kotlin/io/layercraft/packetlib/types/ChunkBlockEntity.kt index f47307d..2fb0948 100644 --- a/src/main/kotlin/io/layercraft/packetlib/types/ChunkBlockEntity.kt +++ b/src/main/kotlin/io/layercraft/packetlib/types/ChunkBlockEntity.kt @@ -1,7 +1,7 @@ package io.layercraft.packetlib.types -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer data class ChunkBlockEntity( val chunkXz: Byte, @@ -10,7 +10,7 @@ data class ChunkBlockEntity( val data: NBT, ) { companion object { - fun read(deserializer: MinecraftProtocolDeserializeInterface<*>): ChunkBlockEntity { + fun read(deserializer: MCProtocolDeserializer<*>): ChunkBlockEntity { val packedXZ = deserializer.readByte() val y = deserializer.readShort() val type = deserializer.readVarInt() @@ -19,7 +19,7 @@ data class ChunkBlockEntity( return ChunkBlockEntity(packedXZ, y, type, data) } - fun write(entity: ChunkBlockEntity, serializeInterface: MinecraftProtocolSerializeInterface<*>) { + fun write(entity: ChunkBlockEntity, serializeInterface: MCProtocolSerializer<*>) { serializeInterface.writeByte(entity.chunkXz) serializeInterface.writeShort(entity.y) serializeInterface.writeVarInt(entity.type) diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/VarNumbersUtils.kt b/src/main/kotlin/io/layercraft/packetlib/types/VarNumbersUtils.kt similarity index 83% rename from src/main/kotlin/io/layercraft/packetlib/utils/VarNumbersUtils.kt rename to src/main/kotlin/io/layercraft/packetlib/types/VarNumbersUtils.kt index 1f7660d..19a5558 100644 --- a/src/main/kotlin/io/layercraft/packetlib/utils/VarNumbersUtils.kt +++ b/src/main/kotlin/io/layercraft/packetlib/types/VarNumbersUtils.kt @@ -1,14 +1,14 @@ -package io.layercraft.packetlib.utils +package io.layercraft.packetlib.types -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.io.EOFException const val SEGMENT_BITS = 0x7F const val CONTINUE_BIT = 0x80 object MinecraftVarIntUtils { - fun readVarInt(input: MinecraftProtocolDeserializeInterface<*>): Int { + fun readVarInt(input: MCProtocolDeserializer<*>): Int { if (input.remaining <= 0) throw EOFException("Premature end of stream") var numRead = 0 var result = 0 @@ -25,7 +25,7 @@ object MinecraftVarIntUtils { return result } - fun writeVarInt(value: Int, output: MinecraftProtocolSerializeInterface<*>) { + fun writeVarInt(value: Int, output: MCProtocolSerializer<*>) { var write = value while (true) { if (write and -CONTINUE_BIT == 0) { @@ -49,7 +49,7 @@ object MinecraftVarIntUtils { } object MinecraftVarLongUtils { - fun readVarLong(input: MinecraftProtocolDeserializeInterface<*>): Long { + fun readVarLong(input: MCProtocolDeserializer<*>): Long { if (input.remaining <= 0) throw EOFException("Premature end of stream") var numRead = 0 var result: Long = 0 @@ -66,7 +66,7 @@ object MinecraftVarLongUtils { return result } - fun writeVarLong(value: Long, output: MinecraftProtocolSerializeInterface<*>) { + fun writeVarLong(value: Long, output: MCProtocolSerializer<*>) { var write = value while (true) { if (write and -CONTINUE_BIT.toLong() == 0L) { diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/VarStringUtils.kt b/src/main/kotlin/io/layercraft/packetlib/types/VarStringUtils.kt similarity index 81% rename from src/main/kotlin/io/layercraft/packetlib/utils/VarStringUtils.kt rename to src/main/kotlin/io/layercraft/packetlib/types/VarStringUtils.kt index 966a7ed..3d25ef0 100644 --- a/src/main/kotlin/io/layercraft/packetlib/utils/VarStringUtils.kt +++ b/src/main/kotlin/io/layercraft/packetlib/types/VarStringUtils.kt @@ -1,7 +1,7 @@ -package io.layercraft.packetlib.utils +package io.layercraft.packetlib.types -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer import java.io.EOFException const val MINECRAFT_MAX_STRING_LENGTH = 32767 @@ -10,7 +10,7 @@ const val MINECRAFT_MAX_IDENTIFIER_LENGTH = 32767 object MinecraftStringUtils { - fun readString(maxLength: Int = MINECRAFT_MAX_STRING_LENGTH, input: MinecraftProtocolDeserializeInterface<*>): String { + fun readString(maxLength: Int = MINECRAFT_MAX_STRING_LENGTH, input: MCProtocolDeserializer<*>): String { if (input.remaining <= 0) throw EOFException("Premature end of stream") val length: Int = input.readVarInt() @@ -25,7 +25,7 @@ object MinecraftStringUtils { return string } - fun writeString(maxLength: Int = MINECRAFT_MAX_STRING_LENGTH, string: String, output: MinecraftProtocolSerializeInterface<*>) { + fun writeString(maxLength: Int = MINECRAFT_MAX_STRING_LENGTH, string: String, output: MCProtocolSerializer<*>) { val bytes = string.toByteArray(Charsets.UTF_8) if (bytes.size > MINECRAFT_MAX_STRING_LENGTH) throw IllegalArgumentException("String too big (was ${bytes.size} bytes encoded, max $MINECRAFT_MAX_STRING_LENGTH)") if (string.length > maxLength) throw IllegalArgumentException("String too big (was ${string.length} characters, max $maxLength)") diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferDeserialize.kt b/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferDeserialize.kt deleted file mode 100644 index df4e5d4..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferDeserialize.kt +++ /dev/null @@ -1,39 +0,0 @@ -package io.layercraft.packetlib.utils.bytebuffer - -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import java.nio.ByteBuffer - -class MinecraftByteBufferDeserialize(override val input: ByteBuffer) : MinecraftProtocolDeserializeInterface { - override val remaining: Int - get() = input.remaining() - - override fun readByte(): Byte = input.get() - - override fun readBytes(): ByteArray { - val bytes = ByteArray(input.remaining()) - input.get(bytes) - return bytes - } - - override fun readBytes(n: Int): ByteArray { - val bytes = ByteArray(n) - input.get(bytes) - return bytes - } - - override fun readBoolean(): Boolean = input.get() == 1.toByte() - - override fun readInt(): Int = input.int - - override fun readLong(): Long = input.long - - override fun readShort(): Short = input.short - - override fun readFloat(): Float = input.float - - override fun readDouble(): Double = input.double - - override fun readUByte(): UByte = input.get().toUByte() - - override fun readUShort(): UShort = input.short.toUShort() -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferSerialize.kt b/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferSerialize.kt deleted file mode 100644 index 3cde40a..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/utils/bytebuffer/MinecraftByteBufferSerialize.kt +++ /dev/null @@ -1,46 +0,0 @@ -package io.layercraft.packetlib.utils.bytebuffer - -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.nio.ByteBuffer - -class MinecraftByteBufferSerialize(override val output: ByteBuffer) : MinecraftProtocolSerializeInterface { - override fun writeByte(input: Byte) { - output.put(input) - } - - override fun writeBytes(input: ByteArray) { - output.put(input) - } - - override fun writeBoolean(input: Boolean) { - output.put(if (input) 1.toByte() else 0.toByte()) - } - - override fun writeInt(input: Int) { - output.putInt(input) - } - - override fun writeLong(input: Long) { - output.putLong(input) - } - - override fun writeShort(input: Short) { - output.putShort(input) - } - - override fun writeFloat(input: Float) { - output.putFloat(input) - } - - override fun writeDouble(input: Double) { - output.putDouble(input) - } - - override fun writeUByte(input: UByte) { - output.put(input.toByte()) - } - - override fun writeUShort(input: UShort) { - output.putShort(input.toShort()) - } -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftInputStreamDeserialize.kt b/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftInputStreamDeserialize.kt deleted file mode 100644 index 69dd1fa..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftInputStreamDeserialize.kt +++ /dev/null @@ -1,32 +0,0 @@ -package io.layercraft.packetlib.utils.stream - -import io.layercraft.packetlib.serialization.MinecraftProtocolDeserializeInterface -import java.io.DataInputStream - -class MinecraftInputStreamDeserialize(override val input: DataInputStream) : MinecraftProtocolDeserializeInterface { - - override val remaining: Int - get() = input.available() - - override fun readByte(): Byte = input.read().toByte() - - override fun readBytes(): ByteArray = input.readBytes() - - override fun readBytes(n: Int): ByteArray = input.readNBytes(n) - - override fun readBoolean(): Boolean = input.readBoolean() - - override fun readInt(): Int = input.readInt() - - override fun readLong(): Long = input.readLong() - - override fun readShort(): Short = input.readShort() - - override fun readFloat(): Float = input.readFloat() - - override fun readDouble(): Double = input.readDouble() - - override fun readUByte(): UByte = input.read().toUByte() - - override fun readUShort(): UShort = input.readShort().toUShort() -} \ No newline at end of file diff --git a/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftOutputStreamSerialize.kt b/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftOutputStreamSerialize.kt deleted file mode 100644 index 44f213e..0000000 --- a/src/main/kotlin/io/layercraft/packetlib/utils/stream/MinecraftOutputStreamSerialize.kt +++ /dev/null @@ -1,26 +0,0 @@ -package io.layercraft.packetlib.utils.stream - -import io.layercraft.packetlib.serialization.MinecraftProtocolSerializeInterface -import java.io.DataOutputStream - -class MinecraftOutputStreamSerialize(override val output: DataOutputStream) : MinecraftProtocolSerializeInterface { - override fun writeByte(input: Byte) = output.writeByte(input.toInt()) - - override fun writeBytes(input: ByteArray) = output.write(input) - - override fun writeBoolean(input: Boolean) = output.writeBoolean(input) - - override fun writeInt(input: Int) = output.writeInt(input) - - override fun writeLong(input: Long) = output.writeLong(input) - - override fun writeShort(input: Short) = output.writeShort(input.toInt()) - - override fun writeFloat(input: Float) = output.writeFloat(input) - - override fun writeDouble(input: Double) = output.writeDouble(input) - - override fun writeUByte(input: UByte) = output.writeByte(input.toInt()) - - override fun writeUShort(input: UShort) = output.writeShort(input.toInt()) -} \ No newline at end of file diff --git a/src/test/kotlin/io/layercraft/packetlib/MinecraftByteTest.kt b/src/test/kotlin/io/layercraft/packetlib/MinecraftByteTest.kt index dd90edf..3f37e7c 100644 --- a/src/test/kotlin/io/layercraft/packetlib/MinecraftByteTest.kt +++ b/src/test/kotlin/io/layercraft/packetlib/MinecraftByteTest.kt @@ -1,8 +1,6 @@ package io.layercraft.packetlib import io.layercraft.packetlib.types.Position -import io.layercraft.packetlib.utils.bytebuffer.MinecraftByteBufferDeserialize -import io.layercraft.packetlib.utils.bytebuffer.MinecraftByteBufferSerialize import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Test import java.nio.ByteBuffer diff --git a/src/test/kotlin/io/layercraft/packetlib/PacketIdCheck.kt b/src/test/kotlin/io/layercraft/packetlib/PacketIdCheck.kt index 9761d85..2ea7ebd 100644 --- a/src/test/kotlin/io/layercraft/packetlib/PacketIdCheck.kt +++ b/src/test/kotlin/io/layercraft/packetlib/PacketIdCheck.kt @@ -1,56 +1,31 @@ package io.layercraft.packetlib -import io.layercraft.packetlib.codec.MinecraftCodec -import io.layercraft.packetlib.packets.MinecraftPacket -import io.layercraft.packetlib.packets.PacketDirection -import org.junit.jupiter.api.Test +import io.layercraft.packetlib.codec.Codec +import io.layercraft.packetlib.codec.MinecraftCodecs +import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource import kotlin.test.assertTrue -import io.layercraft.packetlib.codec.MinecraftCodecs as MC +@TestInstance(TestInstance.Lifecycle.PER_CLASS) class PacketIdCheck { - @Test - fun `check if all ids are same in registry and in packet class`() { - val codecs = listOf(MC.V1_19_2, MC.V1_19_3) - codecs.forEach { checkCodec(it) } + @ParameterizedTest + @MethodSource("generator") + fun `check if all packets have the right name`(codec: Codec) { + checkCodec(codec) } - private fun checkCodec(codec: MinecraftCodec) { - codec.packets.forEach { (state, registry) -> - registry.clientPacketMap.forEach { (id, packet) -> - val annotation = packet.packet.annotations.filterIsInstance().first() - - assert(annotation.id == id) { - "Packet ${packet.packet.simpleName} has id ${annotation.id} in annotation, but $id in registry" - } - - assert(annotation.state == state) { - "Packet ${packet.packet.simpleName} has state ${annotation.state} in annotation, but $state in registry" - } - - assert(annotation.direction == PacketDirection.SERVERBOUND) { - "Packet ${packet.packet.simpleName} has direction ${annotation.direction} in annotation, but ${PacketDirection.CLIENTBOUND} in registry" - } + private fun generator() = arrayOf(MinecraftCodecs.V1_19_3, MinecraftCodecs.V1_19_4) + private fun checkCodec(codec: Codec) { + codec.packets.forEach { (state, registry) -> + registry.clientPacketMap.forEach { (_, packet) -> val qualifiedName = packet.packet.qualifiedName!! assertTrue { qualifiedName.contains(state.name, ignoreCase = true) } } - registry.serverPacketMap.forEach { (id, packet) -> - val annotation = packet.packet.annotations.filterIsInstance().first() - - assert(annotation.id == id) { - "Packet ${packet.packet.simpleName} has id ${annotation.id} in annotation, but $id in registry" - } - - assert(annotation.state == state) { - "Packet ${packet.packet.simpleName} has state ${annotation.state} in annotation, but $state in registry" - } - - assert(annotation.direction == PacketDirection.CLIENTBOUND) { - "Packet ${packet.packet.simpleName} has direction ${annotation.direction} in annotation, but ${PacketDirection.SERVERBOUND} in registry" - } - + registry.serverPacketMap.forEach { (_, packet) -> val qualifiedName = packet.packet.qualifiedName!! assertTrue { qualifiedName.contains(state.name, ignoreCase = true) } } diff --git a/src/test/kotlin/io/layercraft/packetlib/PacketLibTestHelper.kt b/src/test/kotlin/io/layercraft/packetlib/PacketLibTestHelper.kt new file mode 100644 index 0000000..f16f032 --- /dev/null +++ b/src/test/kotlin/io/layercraft/packetlib/PacketLibTestHelper.kt @@ -0,0 +1,107 @@ +package io.layercraft.packetlib + +import io.layercraft.packetlib.packets.Packet +import io.layercraft.packetlib.packets.PacketSerializer +import io.layercraft.packetlib.serialization.MCProtocolDeserializer +import io.layercraft.packetlib.serialization.MCProtocolSerializer +import java.nio.ByteBuffer + +object TranslatorAPI { + + fun decodeFromByteArray(bytes: ByteArray, serializer: PacketSerializer): T { + val byteBuffer = ByteBuffer.wrap(bytes) + val deserialize = MinecraftByteBufferDeserialize(byteBuffer) + + return serializer.deserialize(deserialize) + } + + fun encodeToByteArray(value: T, serializer: PacketSerializer): ByteArray { + val byteBuffer = ByteBuffer.allocate(MAX_PACKET_SIZE) + val serialize = MinecraftByteBufferSerialize(byteBuffer) + + serializer.serialize(serialize, value) + + val size = byteBuffer.position() + val byteArray = ByteArray(size) + byteBuffer.get(0, byteArray, 0, size) + + return byteArray + } +} + +class MinecraftByteBufferDeserialize(override val input: ByteBuffer) : MCProtocolDeserializer { + override val remaining: Int + get() = input.remaining() + + override fun readByte(): Byte = input.get() + + override fun readBytes(): ByteArray { + val bytes = ByteArray(input.remaining()) + input.get(bytes) + return bytes + } + + override fun readBytes(n: Int): ByteArray { + val bytes = ByteArray(n) + input.get(bytes) + return bytes + } + + override fun readBoolean(): Boolean = input.get() == 1.toByte() + + override fun readInt(): Int = input.int + + override fun readLong(): Long = input.long + + override fun readShort(): Short = input.short + + override fun readFloat(): Float = input.float + + override fun readDouble(): Double = input.double + + override fun readUByte(): UByte = input.get().toUByte() + + override fun readUShort(): UShort = input.short.toUShort() +} + +class MinecraftByteBufferSerialize(override val output: ByteBuffer) : MCProtocolSerializer { + override fun writeByte(input: Byte) { + output.put(input) + } + + override fun writeBytes(input: ByteArray) { + output.put(input) + } + + override fun writeBoolean(input: Boolean) { + output.put(if (input) 1.toByte() else 0.toByte()) + } + + override fun writeInt(input: Int) { + output.putInt(input) + } + + override fun writeLong(input: Long) { + output.putLong(input) + } + + override fun writeShort(input: Short) { + output.putShort(input) + } + + override fun writeFloat(input: Float) { + output.putFloat(input) + } + + override fun writeDouble(input: Double) { + output.putDouble(input) + } + + override fun writeUByte(input: UByte) { + output.put(input.toByte()) + } + + override fun writeUShort(input: UShort) { + output.putShort(input.toShort()) + } +} \ No newline at end of file diff --git a/src/test/kotlin/io/layercraft/packetlib/SerializationTest.kt b/src/test/kotlin/io/layercraft/packetlib/SerializationTest.kt index 1ee2b44..19870b4 100644 --- a/src/test/kotlin/io/layercraft/packetlib/SerializationTest.kt +++ b/src/test/kotlin/io/layercraft/packetlib/SerializationTest.kt @@ -1,18 +1,17 @@ package io.layercraft.packetlib -import io.layercraft.packetlib.data.ProtocolVersion -import io.layercraft.packetlib.packets.v1_19_2.handshaking.serverbound.SetProtocolPacket -import io.layercraft.packetlib.packets.v1_19_2.login.serverbound.EncryptionBeginPacket -import io.layercraft.packetlib.packets.v1_19_2.login.serverbound.LoginStartPacket +import io.layercraft.packetlib.codec.ProtocolVersion +import io.layercraft.packetlib.packets.v1_19_3.handshaking.serverbound.SetProtocolPacket +import io.layercraft.packetlib.packets.v1_19_3.login.clientbound.EncryptionBeginPacket +import io.layercraft.packetlib.packets.v1_19_3.login.serverbound.LoginStartPacket import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import java.util.* -import kotlin.test.assertContentEquals internal class SerializationTest { @Test fun `test normal serialization`() { - val packet = SetProtocolPacket(ProtocolVersion.V1_19_2.protocolNumber, "localhost", (25565).toUShort(), 1) + val packet = SetProtocolPacket(ProtocolVersion.V1_19_3.protocolNumber, "localhost", (25565).toUShort(), 1) val bytes = TranslatorAPI.encodeToByteArray(packet, SetProtocolPacket) @@ -23,7 +22,7 @@ internal class SerializationTest { @Test fun `test many serialization`() { - val packet = SetProtocolPacket(ProtocolVersion.V1_19_2.protocolNumber, "localhost", (25565).toUShort(), 1) + val packet = SetProtocolPacket(ProtocolVersion.V1_19_3.protocolNumber, "localhost", (25565).toUShort(), 1) val bytes = TranslatorAPI.encodeToByteArray(packet, SetProtocolPacket) val decoded = TranslatorAPI.decodeFromByteArray(bytes, SetProtocolPacket) @@ -69,33 +68,24 @@ internal class SerializationTest { val packet = EncryptionBeginPacket( + "TestId", exampleByteArray, - true, exampleByteArray, - null, - null, ) val bytes = TranslatorAPI.encodeToByteArray(packet, EncryptionBeginPacket) val decoded = TranslatorAPI.decodeFromByteArray(bytes, EncryptionBeginPacket) - Assertions.assertArrayEquals(packet.sharedSecret, decoded.sharedSecret) - Assertions.assertArrayEquals(packet.messageSignature, decoded.messageSignature) + Assertions.assertArrayEquals(packet.publicKey, decoded.publicKey) Assertions.assertArrayEquals(packet.verifyToken, decoded.verifyToken) } @Test fun `test serialization with custom serializer`() { - val exampleByteArray = byteArrayOf(0x04, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74, 0x00, 0x7F, 0x00, 0x00) - val packet = LoginStartPacket( "Newspicel", true, - 0x7F000001, - exampleByteArray, - exampleByteArray, - true, UUID.randomUUID(), ) @@ -104,10 +94,6 @@ internal class SerializationTest { val decoded = TranslatorAPI.decodeFromByteArray(bytes, LoginStartPacket) Assertions.assertEquals(packet.username, decoded.username) - Assertions.assertEquals(packet.hasSignature, decoded.hasSignature) - Assertions.assertEquals(packet.timestamp, decoded.timestamp) - assertContentEquals(packet.signature, decoded.signature) - assertContentEquals(packet.publicKey, decoded.publicKey) Assertions.assertEquals(packet.hasPlayerUUID, decoded.hasPlayerUUID) Assertions.assertEquals(packet.playerUUID, decoded.playerUUID) } diff --git a/src/test/kotlin/io/layercraft/packetlib/TranslatorAPI.kt b/src/test/kotlin/io/layercraft/packetlib/TranslatorAPI.kt deleted file mode 100644 index f151b30..0000000 --- a/src/test/kotlin/io/layercraft/packetlib/TranslatorAPI.kt +++ /dev/null @@ -1,30 +0,0 @@ -package io.layercraft.packetlib - -import io.layercraft.packetlib.packets.Packet -import io.layercraft.packetlib.packets.PacketSerializer -import io.layercraft.packetlib.utils.bytebuffer.MinecraftByteBufferDeserialize -import io.layercraft.packetlib.utils.bytebuffer.MinecraftByteBufferSerialize -import java.nio.ByteBuffer - -object TranslatorAPI { - - fun decodeFromByteArray(bytes: ByteArray, serializer: PacketSerializer): T { - val byteBuffer = ByteBuffer.wrap(bytes) - val deserialize = MinecraftByteBufferDeserialize(byteBuffer) - - return serializer.deserialize(deserialize) - } - - fun encodeToByteArray(value: T, serializer: PacketSerializer): ByteArray { - val byteBuffer = ByteBuffer.allocate(MAX_PACKET_SIZE) - val serialize = MinecraftByteBufferSerialize(byteBuffer) - - serializer.serialize(serialize, value) - - val size = byteBuffer.position() - val byteArray = ByteArray(size) - byteBuffer.get(0, byteArray, 0, size) - - return byteArray - } -} \ No newline at end of file diff --git a/src/test/kotlin/io/layercraft/packetlib/utils/MinecraftNumberUtilsTest.kt b/src/test/kotlin/io/layercraft/packetlib/utils/MinecraftNumberUtilsTest.kt index dc79ddd..1de65b7 100644 --- a/src/test/kotlin/io/layercraft/packetlib/utils/MinecraftNumberUtilsTest.kt +++ b/src/test/kotlin/io/layercraft/packetlib/utils/MinecraftNumberUtilsTest.kt @@ -1,6 +1,8 @@ package io.layercraft.packetlib.utils -import io.layercraft.packetlib.utils.bytebuffer.MinecraftByteBufferSerialize +import io.layercraft.packetlib.MinecraftByteBufferSerialize +import io.layercraft.packetlib.types.MinecraftVarIntUtils +import io.layercraft.packetlib.types.MinecraftVarLongUtils import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import java.nio.ByteBuffer