From 08e5cc6dce5a74ff813067c6aa034ca1d8bc6df4 Mon Sep 17 00:00:00 2001 From: Tides Date: Wed, 15 Nov 2023 00:54:40 -0500 Subject: [PATCH] Update clientbound packet ids --- Obsidian/Net/MinecraftStream.Writing.cs | 10 +++++++ Obsidian/Net/Packets/DisconnectPacket.cs | 2 +- .../AcknowledgeBlockChangePacket.cs | 2 +- .../Play/Clientbound/AwardStatisticsPacket.cs | 2 +- .../Play/Clientbound/BlockActionPacket.cs | 2 +- .../Play/Clientbound/BlockEntityDataPacket.cs | 2 +- .../Play/Clientbound/BlockUpdatePacket.cs | 2 +- .../Packets/Play/Clientbound/BossBarPacket.cs | 2 +- .../Play/Clientbound/BundleDelimiterPacket.cs | 7 +++++ .../Clientbound/ChangeDifficultyPacket.cs | 2 +- .../Clientbound/ChunkBatchFinishedPacket.cs | 10 +++++++ .../Play/Clientbound/ChunkBatchStartPacket.cs | 8 ++++++ .../Play/Clientbound/ChunkBiomesPacket.cs | 19 +++++++++++++ .../ChunkDataAndUpdateLightPacket.cs | 2 +- .../Play/Clientbound/ClearTitlesPacket.cs | 2 +- .../Play/Clientbound/CommandsPacket.cs | 2 +- .../Play/Clientbound/DeleteMessagePacket.cs | 2 +- .../Play/Clientbound/DisguisedChatMessage.cs | 2 +- .../Clientbound/DisplayObjectivePacket.cs | 2 +- .../Play/Clientbound/EntityAnimationPacket.cs | 2 +- .../Play/Clientbound/EntityEffectPacket.cs | 2 +- .../Clientbound/EntitySoundEffectPacket.cs | 2 +- .../Play/Clientbound/ExplosionPacket.cs | 6 ++-- .../Play/Clientbound/GameEventPacket.cs | 2 +- .../Packets/Play/Clientbound/LoginPacket.cs | 2 +- .../Packets/Play/Clientbound/LookAtPacket.cs | 2 +- .../Play/Clientbound/OpenBookPacket.cs | 2 +- .../Play/Clientbound/OpenScreenPacket.cs | 2 +- .../Play/Clientbound/ParticlePacket.cs | 2 +- .../Play/Clientbound/PickupItemPacket.cs | 2 +- .../Clientbound/PlaceGhostRecipePacket.cs | 2 +- .../Clientbound/PlayerChatMessagePacket.cs | 11 ++++---- .../Clientbound/PlayerInfoRemovePacket.cs | 2 +- .../Clientbound/PlayerInfoUpdatePacket.cs | 2 +- .../Play/Clientbound/RemoveEntitiesPacket.cs | 2 +- .../Clientbound/RemoveEntityEffectPacket.cs | 2 +- .../Packets/Play/Clientbound/RespawnPacket.cs | 28 +++++++++---------- .../Clientbound/SetActionBarTextPacket.cs | 2 +- .../Clientbound/SetBlockDestroyStagePacket.cs | 2 +- .../Play/Clientbound/SetCenterChunkPacket.cs | 2 +- .../Clientbound/SetContainerContentPacket.cs | 2 +- .../Clientbound/SetContainerPropertyPacket.cs | 2 +- .../Clientbound/SetContainerSlotPacket.cs | 2 +- .../Play/Clientbound/SetCooldownPacket.cs | 2 +- .../SetDefaultSpawnPositionPacket.cs | 2 +- .../Clientbound/SetEntityMetadataPacket.cs | 2 +- .../Clientbound/SetEntityVelocityPacket.cs | 2 +- .../Play/Clientbound/SetEquipmentPacket.cs | 2 +- .../Play/Clientbound/SetExperiencePacket.cs | 2 +- .../Play/Clientbound/SetHeadRotationPacket.cs | 2 +- .../Play/Clientbound/SetHealthPacket.cs | 2 +- .../SetTabListHeaderAndFooterPacket.cs | 2 +- .../Play/Clientbound/SetTitleTextPacket.cs | 6 ++-- .../Play/Clientbound/SoundEffectPacket.cs | 2 +- .../Clientbound/SpawnExperienceOrbPacket.cs | 2 +- .../Clientbound/StartConfigurationPacket.cs | 9 ++++++ .../SynchronizePlayerPositionPacket.cs | 2 +- .../Clientbound/SystemChatMessagePacket.cs | 2 +- .../Play/Clientbound/TeleportEntityPacket.cs | 2 +- .../Play/Clientbound/UnloadChunkPacket.cs | 2 +- .../Clientbound/UpdateAdvancementsPacket.cs | 4 +-- .../UpdateEntityPositionAndRotationPacket.cs | 2 +- .../Clientbound/UpdateEntityPositionPacket.cs | 2 +- .../Clientbound/UpdateEntityRotationPacket.cs | 2 +- .../Clientbound/UpdateObjectivesPacket.cs | 8 +++--- .../Clientbound/UpdateRecipeBookPacket.cs | 2 +- .../Play/Clientbound/UpdateRecipesPacket.cs | 2 +- .../Play/Clientbound/UpdateScorePacket.cs | 2 +- .../Play/Clientbound/UpdateTeamsPacket.cs | 2 +- .../Play/Clientbound/UpdateTimePacket.cs | 2 +- .../Net/Packets/Play/CloseContainerPacket.cs | 2 +- .../Net/Packets/Play/SetHeldItemPacket.cs | 2 +- Obsidian/Net/Packets/PluginMessagePacket.cs | 2 +- .../Clientbound => }/UpdateTagsPacket.cs | 5 ++-- 74 files changed, 159 insertions(+), 94 deletions(-) create mode 100644 Obsidian/Net/Packets/Play/Clientbound/BundleDelimiterPacket.cs create mode 100644 Obsidian/Net/Packets/Play/Clientbound/ChunkBatchFinishedPacket.cs create mode 100644 Obsidian/Net/Packets/Play/Clientbound/ChunkBatchStartPacket.cs create mode 100644 Obsidian/Net/Packets/Play/Clientbound/ChunkBiomesPacket.cs create mode 100644 Obsidian/Net/Packets/Play/Clientbound/StartConfigurationPacket.cs rename Obsidian/Net/Packets/{Configuration/Clientbound => }/UpdateTagsPacket.cs (79%) diff --git a/Obsidian/Net/MinecraftStream.Writing.cs b/Obsidian/Net/MinecraftStream.Writing.cs index ebb3142af..ca36b1a71 100644 --- a/Obsidian/Net/MinecraftStream.Writing.cs +++ b/Obsidian/Net/MinecraftStream.Writing.cs @@ -1185,6 +1185,16 @@ internal async Task WriteRecipeAsync(string name, IRecipe recipe) } } + [WriteMethod] + public void WriteChunkBiomes(ChunkBiome chunkBiome) + { + this.WriteInt(chunkBiome.X); + this.WriteInt(chunkBiome.Z); + + this.WriteVarInt(chunkBiome.Data.Length); + this.WriteByteArray(chunkBiome.Data); + } + [WriteMethod] public void WriteRecipes(IDictionary recipes) { diff --git a/Obsidian/Net/Packets/DisconnectPacket.cs b/Obsidian/Net/Packets/DisconnectPacket.cs index 664449e97..9b5f48e2e 100644 --- a/Obsidian/Net/Packets/DisconnectPacket.cs +++ b/Obsidian/Net/Packets/DisconnectPacket.cs @@ -11,7 +11,7 @@ public partial class DisconnectPacket : IClientboundPacket public DisconnectPacket(ChatMessage reason, ClientState state) { - Id = state == ClientState.Configuration ? 0x01 : state == ClientState.Play ? 0x1A : 0x00; + Id = state == ClientState.Configuration ? 0x01 : state == ClientState.Play ? 0x1B : 0x00; Reason = reason; } } diff --git a/Obsidian/Net/Packets/Play/Clientbound/AcknowledgeBlockChangePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/AcknowledgeBlockChangePacket.cs index 73ccc21ad..4ad488771 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/AcknowledgeBlockChangePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/AcknowledgeBlockChangePacket.cs @@ -6,5 +6,5 @@ public partial class AcknowledgeBlockChangePacket : IClientboundPacket [Field(0), VarLength] public int SequenceID { get; init; } - public int Id => 0x06; + public int Id => 0x05; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/AwardStatisticsPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/AwardStatisticsPacket.cs index 957f8011b..112eaf6a0 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/AwardStatisticsPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/AwardStatisticsPacket.cs @@ -18,7 +18,7 @@ public void Clear() Stats.Clear(); } - public int Id => 0x06; + public int Id => 0x04; } public readonly struct Statistic diff --git a/Obsidian/Net/Packets/Play/Clientbound/BlockActionPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/BlockActionPacket.cs index a2a642714..b1752a0e1 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/BlockActionPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/BlockActionPacket.cs @@ -16,5 +16,5 @@ public partial class BlockActionPacket : IClientboundPacket [Field(3), VarLength] public int BlockType { get; init; } - public int Id => 0x09; + public int Id => 0x08; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/BlockEntityDataPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/BlockEntityDataPacket.cs index 890cfc54c..49ede77e5 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/BlockEntityDataPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/BlockEntityDataPacket.cs @@ -14,7 +14,7 @@ public partial class BlockEntityDataPacket : IClientboundPacket [Field(2)] public INbtTag NBTData { get; init; } - public int Id => 0x08; + public int Id => 0x07; } // https://wiki.vg/Protocol#Block_Entity_Data diff --git a/Obsidian/Net/Packets/Play/Clientbound/BlockUpdatePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/BlockUpdatePacket.cs index 2f1a7a7f6..cbe8867bf 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/BlockUpdatePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/BlockUpdatePacket.cs @@ -10,7 +10,7 @@ public partial class BlockUpdatePacket : IClientboundPacket [Field(1), VarLength] public int BlockId { get; } - public int Id => 0x0A; + public int Id => 0x09; public BlockUpdatePacket(Vector position, int block) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/BossBarPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/BossBarPacket.cs index cf1ddc306..6ca91b60d 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/BossBarPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/BossBarPacket.cs @@ -8,7 +8,7 @@ public partial class BossBarPacket : IClientboundPacket [Field(0)] public BossBarAction Action { get; } - public int Id => 0x0B; + public int Id => 0x0A; public BossBarPacket(BossBarAction action) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/BundleDelimiterPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/BundleDelimiterPacket.cs new file mode 100644 index 000000000..6da553fa5 --- /dev/null +++ b/Obsidian/Net/Packets/Play/Clientbound/BundleDelimiterPacket.cs @@ -0,0 +1,7 @@ +namespace Obsidian.Net.Packets.Play.Clientbound; +public sealed partial class BundleDelimiterPacket : IClientboundPacket +{ + public int Id => 0x00; + + public void Serialize(MinecraftStream stream) { } +} diff --git a/Obsidian/Net/Packets/Play/Clientbound/ChangeDifficultyPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ChangeDifficultyPacket.cs index 593703ce2..0e397551d 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/ChangeDifficultyPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/ChangeDifficultyPacket.cs @@ -11,7 +11,7 @@ public partial class ChangeDifficultyPacket : IClientboundPacket [Field(1)] public bool DifficultyLocked { get; init; } - public int Id => 0x0C; + public int Id => 0x0B; public ChangeDifficultyPacket(Difficulty difficulty) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchFinishedPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchFinishedPacket.cs new file mode 100644 index 000000000..82c39e9d4 --- /dev/null +++ b/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchFinishedPacket.cs @@ -0,0 +1,10 @@ +using Obsidian.Serialization.Attributes; + +namespace Obsidian.Net.Packets.Play.Clientbound; +public sealed partial class ChunkBatchFinishedPacket : IClientboundPacket +{ + [Field(0), VarLength] + public int BatchSize { get; init; } + + public int Id => 0x0C; +} diff --git a/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchStartPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchStartPacket.cs new file mode 100644 index 000000000..62316ba31 --- /dev/null +++ b/Obsidian/Net/Packets/Play/Clientbound/ChunkBatchStartPacket.cs @@ -0,0 +1,8 @@ +namespace Obsidian.Net.Packets.Play.Clientbound; +public sealed partial class ChunkBatchStartPacket : IClientboundPacket +{ + public int Id => 0x0D; + + //TODO FIX SOURCE GENS WITH PACKETS THAT HAVE NO FIELDS + public void Serialize(MinecraftStream stream) { } +} diff --git a/Obsidian/Net/Packets/Play/Clientbound/ChunkBiomesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ChunkBiomesPacket.cs new file mode 100644 index 000000000..88d605383 --- /dev/null +++ b/Obsidian/Net/Packets/Play/Clientbound/ChunkBiomesPacket.cs @@ -0,0 +1,19 @@ +using Obsidian.Serialization.Attributes; + +namespace Obsidian.Net.Packets.Play.Clientbound; +public sealed partial class ChunkBiomesPacket : IClientboundPacket +{ + [Field(0)] + public required List ChunkBiomes { get; init; } + + public int Id => 0x0E; +} + +public readonly struct ChunkBiome +{ + public required int X { get; init; } + + public required int Z { get; init; } + + public required byte[] Data { get; init; } +} diff --git a/Obsidian/Net/Packets/Play/Clientbound/ChunkDataAndUpdateLightPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ChunkDataAndUpdateLightPacket.cs index 2186e80b6..4c44718fa 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/ChunkDataAndUpdateLightPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/ChunkDataAndUpdateLightPacket.cs @@ -8,7 +8,7 @@ public partial class ChunkDataAndUpdateLightPacket : IClientboundPacket { public Chunk Chunk { get; } - public int Id => 0x24; + public int Id => 0x25; public ChunkDataAndUpdateLightPacket(Chunk chunk) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/ClearTitlesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ClearTitlesPacket.cs index 2dc2efafa..d7804f58d 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/ClearTitlesPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/ClearTitlesPacket.cs @@ -6,5 +6,5 @@ public sealed partial class ClearTitlesPacket : IClientboundPacket [Field(0)] public bool Reset { get; init; } - public int Id => 0x0E; + public int Id => 0x0F; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/CommandsPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/CommandsPacket.cs index 29eb430c7..35a504a30 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/CommandsPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/CommandsPacket.cs @@ -12,7 +12,7 @@ public partial class CommandsPacket : IClientboundPacket [Field(1), VarLength] public int RootIndex { get; } - public int Id => 0x10; + public int Id => 0x11S; public void AddNode(CommandNode node) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/DeleteMessagePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/DeleteMessagePacket.cs index d3462345d..911c2e335 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/DeleteMessagePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/DeleteMessagePacket.cs @@ -9,5 +9,5 @@ public sealed partial class DeleteMessagePacket : IClientboundPacket [Field(1)] public byte[] Signature { get; init; } - public int Id => 0x19; + public int Id => 0x1A; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/DisguisedChatMessage.cs b/Obsidian/Net/Packets/Play/Clientbound/DisguisedChatMessage.cs index e662003a1..30444f98b 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/DisguisedChatMessage.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/DisguisedChatMessage.cs @@ -18,5 +18,5 @@ public sealed partial class DisguisedChatMessage : IClientboundPacket [Field(4)] public ChatMessage TargetName { get; init; } - public int Id => 0x1B; + public int Id => 0x1C; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/DisplayObjectivePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/DisplayObjectivePacket.cs index bdeb99168..506ad7804 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/DisplayObjectivePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/DisplayObjectivePacket.cs @@ -10,5 +10,5 @@ public partial class DisplayObjectivePacket : IClientboundPacket [Field(1), FixedLength(16)] public string ScoreName { get; init; } - public int Id => 0x51; + public int Id => 0x53; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/EntityAnimationPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/EntityAnimationPacket.cs index 9ffcab8d0..184b98961 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/EntityAnimationPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/EntityAnimationPacket.cs @@ -10,7 +10,7 @@ public partial class EntityAnimationPacket : IClientboundPacket [Field(1), ActualType(typeof(byte))] public EntityAnimationType Animation { get; init; } - public int Id => 0x04; + public int Id => 0x03; } public enum EntityAnimationType : byte diff --git a/Obsidian/Net/Packets/Play/Clientbound/EntityEffectPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/EntityEffectPacket.cs index 0878098b9..623668631 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/EntityEffectPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/EntityEffectPacket.cs @@ -26,7 +26,7 @@ public partial class EntityEffectPacket : IClientboundPacket [Field(6), Condition("HasFactorData")] public NbtCompound FactorCodec { get; init; } - public int Id => 0x6C; + public int Id => 0x6E; public EntityEffectPacket(int entityId, int effectId, int duration) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/EntitySoundEffectPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/EntitySoundEffectPacket.cs index 6896a1f37..38a3c8fe2 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/EntitySoundEffectPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/EntitySoundEffectPacket.cs @@ -31,5 +31,5 @@ public partial class EntitySoundEffectPacket : IClientboundPacket [Field(8)] public long Seed { get; init; } = Globals.Random.Next(); - public int Id => 0x61; + public int Id => 0x63; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/ExplosionPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ExplosionPacket.cs index b78396742..c619b2d84 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/ExplosionPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/ExplosionPacket.cs @@ -13,10 +13,10 @@ public partial class ExplosionPacket : IClientboundPacket [Field(2)] public ExplosionRecord[] Records { get; init; } - [Field(3), DataFormat(typeof(float))] - public VectorF PlayerMotion { get; init; } + [Field(3)] + public Velocity PlayerMotion { get; init; } - public int Id => 0x1D; + public int Id => 0x1E; } public readonly struct ExplosionRecord diff --git a/Obsidian/Net/Packets/Play/Clientbound/GameEventPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/GameEventPacket.cs index b6b941c74..ad0f36fd3 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/GameEventPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/GameEventPacket.cs @@ -10,7 +10,7 @@ public partial class GameEventPacket : IClientboundPacket [Field(1)] public float Value { get; } - public int Id => 0x1F; + public int Id => 0x20; public GameEventPacket(ChangeGameStateReason reason) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/LoginPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/LoginPacket.cs index afa2a8e55..25787be84 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/LoginPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/LoginPacket.cs @@ -64,5 +64,5 @@ public partial class LoginPacket : IClientboundPacket [Field(19), VarLength] public int PortalCooldown { get; init; } - public int Id => 0x28; + public int Id => 0x29; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/LookAtPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/LookAtPacket.cs index cc04126bf..3e45c5a82 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/LookAtPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/LookAtPacket.cs @@ -19,7 +19,7 @@ public partial class LookAtPacket : IClientboundPacket [Field(4), VarLength, ActualType(typeof(int)), Condition(nameof(IsEntity))] public AimType AimEntity { get; set; } - public int Id => 0x3B; + public int Id => 0x3D; } public enum AimType : int diff --git a/Obsidian/Net/Packets/Play/Clientbound/OpenBookPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/OpenBookPacket.cs index 7c39e9d06..231ea63aa 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/OpenBookPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/OpenBookPacket.cs @@ -7,5 +7,5 @@ public partial class OpenBookPacket : IClientboundPacket [Field(0), ActualType(typeof(int)), VarLength] public Hand Hand { get; set; } - public int Id => 0x2F; + public int Id => 0x30; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/OpenScreenPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/OpenScreenPacket.cs index 63d540022..29217f66b 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/OpenScreenPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/OpenScreenPacket.cs @@ -13,7 +13,7 @@ public partial class OpenScreenPacket : IClientboundPacket [Field(2)] public ChatMessage Title { get; } - public int Id => 0x30; + public int Id => 0x31; public OpenScreenPacket(BaseContainer inventory, int windowId) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/ParticlePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/ParticlePacket.cs index a8de1e4d3..9ae13ace4 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/ParticlePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/ParticlePacket.cs @@ -28,5 +28,5 @@ public partial class ParticlePacket : IClientboundPacket [Field(8)] public ParticleData Data { get; init; } - public int Id => 0x26; + public int Id => 0x27; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/PickupItemPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PickupItemPacket.cs index cf1c346db..33e5ab541 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PickupItemPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PickupItemPacket.cs @@ -13,5 +13,5 @@ public partial class PickupItemPacket : IClientboundPacket [Field(2), VarLength] public int PickupItemCount { get; init; } - public int Id => 0x67; + public int Id => 0x6A; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/PlaceGhostRecipePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PlaceGhostRecipePacket.cs index 9e75a69c7..a2201bfce 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PlaceGhostRecipePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PlaceGhostRecipePacket.cs @@ -10,7 +10,7 @@ public partial class PlaceGhostRecipePacket : IClientboundPacket [Field(1)] public string RecipeId { get; } - public int Id => 0x33; + public int Id => 0x35; public PlaceGhostRecipePacket(sbyte windowId, string recipeId) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/PlayerChatMessagePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PlayerChatMessagePacket.cs index 00c5bed77..259249a03 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PlayerChatMessagePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PlayerChatMessagePacket.cs @@ -3,21 +3,22 @@ namespace Obsidian.Net.Packets.Play.Clientbound; +//TODO this changed implement later public partial class PlayerChatMessagePacket : IClientboundPacket { [Field(0)] public required PlayerChatMessageHeader Header { get; init; } - [Field(1), VarLength] - public required List PreviousMessages { get; init; } - - [Field(2)] + [Field(1)] public required PlayerChatMessageBody Body { get; init; } + [Field(2), VarLength] + public required List PreviousMessages { get; init; } + [Field(3)] public required PlayerChatMessageNetworkTarget NetworkTarget { get; init; } - public int Id => 0x35; + public int Id => 0x37; public void Serialize(MinecraftStream stream) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoRemovePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoRemovePacket.cs index e25dc5387..fbbc4d516 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoRemovePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoRemovePacket.cs @@ -6,5 +6,5 @@ public sealed partial class PlayerInfoRemovePacket : IClientboundPacket [Field(0)] public List UUIDs { get; init; } - public int Id => 0x39; + public int Id => 0x3B; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoUpdatePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoUpdatePacket.cs index a94d69cc8..23972fd7a 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoUpdatePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/PlayerInfoUpdatePacket.cs @@ -14,7 +14,7 @@ public partial class PlayerInfoUpdatePacket : IClientboundPacket [Field(1)] public Dictionary> Actions { get; set; } = new(); - public int Id => 0x3A; + public int Id => 0x3C; public PlayerInfoUpdatePacket(Dictionary> infoActions) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/RemoveEntitiesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/RemoveEntitiesPacket.cs index 13d2a33c9..b4d9f5aed 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/RemoveEntitiesPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/RemoveEntitiesPacket.cs @@ -7,7 +7,7 @@ public partial class RemoveEntitiesPacket : IClientboundPacket [Field(0), VarLength] public List Entities { get; private set; } = new(); - public int Id => 0x3E; + public int Id => 0x40; public RemoveEntitiesPacket(params int[] entities) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/RemoveEntityEffectPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/RemoveEntityEffectPacket.cs index 23907a7a7..19dca1887 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/RemoveEntityEffectPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/RemoveEntityEffectPacket.cs @@ -10,7 +10,7 @@ public partial class RemoveEntityEffectPacket : IClientboundPacket [Field(1), VarLength] public int EffectId { get; init; } - public int Id => 0x3F; + public int Id => 0x41; public RemoveEntityEffectPacket(int entityId, int effectId) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/RespawnPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/RespawnPacket.cs index b93f2259b..807fbc719 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/RespawnPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/RespawnPacket.cs @@ -25,6 +25,18 @@ public partial class RespawnPacket : IClientboundPacket [Field(6)] public bool IsFlat { get; init; } + [Field(7)] + public bool HasDeathLocation { get; init; } + + [Field(8), Condition(nameof(HasDeathLocation))] + public string DeathDimensionName { get; init; } + + [Field(9), Condition(nameof(HasDeathLocation))] + public VectorF DeathLocation { get; init; } + + [Field(10), VarLength] + public int PortalCooldown { get; init; } + /// /// In the Notchian implementation, this is context dependent:
///
@@ -32,20 +44,8 @@ public partial class RespawnPacket : IClientboundPacket /// exiting the end poem/credits keeps the attributes;
/// other dimension changes(portals or teleports) keep all data. ///
- [Field(7), ActualType(typeof(sbyte))] + [Field(11), ActualType(typeof(sbyte))] public DataKept DataKept { get; init; } - [Field(8)] - public bool HasDeathLocation { get; init; } - - [Field(9), Condition(nameof(HasDeathLocation))] - public string DeathDimensionName { get; init; } - - [Field(10), Condition(nameof(HasDeathLocation))] - public VectorF DeathLocation { get; init; } - - [Field(11), VarLength] - public int PortalCooldown { get; init; } - - public int Id => 0x41; + public int Id => 0x43; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetActionBarTextPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetActionBarTextPacket.cs index eff88d404..c9d9982d5 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetActionBarTextPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetActionBarTextPacket.cs @@ -7,5 +7,5 @@ public partial class SetActionBarTextPacket : IClientboundPacket [Field(0)] public required string Text { get; init; } - public int Id => 0x46; + public int Id => 0x48; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetBlockDestroyStagePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetBlockDestroyStagePacket.cs index 5f7c8cf8c..975a1c6ec 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetBlockDestroyStagePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetBlockDestroyStagePacket.cs @@ -16,5 +16,5 @@ public partial class SetBlockDestroyStagePacket : IClientboundPacket [Field(2)] public sbyte DestroyStage { get; init; } - public int Id => 0x07; + public int Id => 0x06; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetCenterChunkPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetCenterChunkPacket.cs index ef57a19f7..31a93d0bb 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetCenterChunkPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetCenterChunkPacket.cs @@ -17,5 +17,5 @@ public SetCenterChunkPacket(int chunkX, int chunkZ) ChunkZ = chunkZ; } - public int Id => 0x4E; + public int Id => 0x50; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetContainerContentPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetContainerContentPacket.cs index a2eef0d78..1d4ad118a 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetContainerContentPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetContainerContentPacket.cs @@ -16,7 +16,7 @@ public partial class SetContainerContentPacket : IClientboundPacket [Field(3)] public ItemStack CarriedItem { get; set; } - public int Id => 0x12; + public int Id => 0x13; public SetContainerContentPacket(byte windowId, List items) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetContainerPropertyPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetContainerPropertyPacket.cs index 5827d9fb6..dcf256815 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetContainerPropertyPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetContainerPropertyPacket.cs @@ -11,5 +11,5 @@ public partial class SetContainerPropertyPacket : IClientboundPacket [Field(1)] public IWindowProperty WindowProperty { get; init; } - public int Id => 0x13; + public int Id => 0x14; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetContainerSlotPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetContainerSlotPacket.cs index 2d9cc08be..367e6059c 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetContainerSlotPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetContainerSlotPacket.cs @@ -25,5 +25,5 @@ public partial class SetContainerSlotPacket : IClientboundPacket [Field(2)] public ItemStack SlotData { get; init; } - public int Id => 0x14; + public int Id => 0x15; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetCooldownPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetCooldownPacket.cs index 62e5206e4..9cdaac9f3 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetCooldownPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetCooldownPacket.cs @@ -10,5 +10,5 @@ public partial class SetCooldownPacket : IClientboundPacket [Field(1), VarLength] public int CooldownTicks { get; init; } - public int Id => 0x15; + public int Id => 0x16; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetDefaultSpawnPositionPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetDefaultSpawnPositionPacket.cs index 28fb99a29..30aba860a 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetDefaultSpawnPositionPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetDefaultSpawnPositionPacket.cs @@ -10,7 +10,7 @@ public partial class SetDefaultSpawnPositionPacket : IClientboundPacket [Field(1), DataFormat(typeof(float))] public Angle Angle { get; set; } - public int Id => 0x50; + public int Id => 0x52; public SetDefaultSpawnPositionPacket(VectorF position) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetEntityMetadataPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetEntityMetadataPacket.cs index bb71152b1..e90bed3b9 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetEntityMetadataPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetEntityMetadataPacket.cs @@ -11,5 +11,5 @@ public partial class SetEntityMetadataPacket : IClientboundPacket [Field(1)] public Entity Entity { get; init; } - public int Id => 0x52; + public int Id => 0x54; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetEntityVelocityPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetEntityVelocityPacket.cs index 3480c9061..c7bbc70dc 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetEntityVelocityPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetEntityVelocityPacket.cs @@ -10,5 +10,5 @@ public partial class SetEntityVelocityPacket : IClientboundPacket [Field(1)] public Velocity Velocity { get; init; } - public int Id => 0x54; + public int Id => 0x56; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetEquipmentPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetEquipmentPacket.cs index 25f647717..adf3a8a83 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetEquipmentPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetEquipmentPacket.cs @@ -11,7 +11,7 @@ public partial class SetEquipmentPacket : IClientboundPacket [Field(1)] public List Equipment { get; init; } - public int Id => 0x55; + public int Id => 0x57; public void Serialize(MinecraftStream stream) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetExperiencePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetExperiencePacket.cs index 56747509c..391af1784 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetExperiencePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetExperiencePacket.cs @@ -13,7 +13,7 @@ public partial class SetExperiencePacket : IClientboundPacket [Field(2), VarLength] public int TotalExperience { get; } - public int Id => 0x56; + public int Id => 0x58; public SetExperiencePacket(float experienceBar, int level, int totalExperience) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetHeadRotationPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetHeadRotationPacket.cs index 29df42e2a..6798a5761 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetHeadRotationPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetHeadRotationPacket.cs @@ -10,5 +10,5 @@ public partial class SetHeadRotationPacket : IClientboundPacket [Field(1)] public Angle HeadYaw { get; init; } - public int Id => 0x42; + public int Id => 0x44; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetHealthPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetHealthPacket.cs index 2052064b5..991b50815 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetHealthPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetHealthPacket.cs @@ -13,7 +13,7 @@ public partial class SetHealthPacket : IClientboundPacket [Field(2)] public float FoodSaturation { get; } - public int Id => 0x57; + public int Id => 0x59; public SetHealthPacket(float health, int food, float foodSaturation) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetTabListHeaderAndFooterPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetTabListHeaderAndFooterPacket.cs index b258a883e..4b8bd6e46 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetTabListHeaderAndFooterPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetTabListHeaderAndFooterPacket.cs @@ -10,7 +10,7 @@ public partial class SetTabListHeaderAndFooterPacket : IClientboundPacket [Field(1)] public ChatMessage Footer { get; } - public int Id => 0x65; + public int Id => 0x68; //TODO send empty text component when writing chat message for this e.x {"text":""} public SetTabListHeaderAndFooterPacket(ChatMessage? header, ChatMessage? footer) diff --git a/Obsidian/Net/Packets/Play/Clientbound/SetTitleTextPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SetTitleTextPacket.cs index ffecb80dd..af4ee5ce0 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SetTitleTextPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SetTitleTextPacket.cs @@ -5,13 +5,13 @@ namespace Obsidian.Net.Packets.Play.Clientbound; public partial class SetTitleTextPacket : IClientboundPacket { [Field(0)] - public ChatMessage Text { get; init; } + public required ChatMessage Text { get; init; } public int Id { get; } public SetTitleTextPacket(TitleMode mode) { - this.Id = mode == TitleMode.SetTitle ? 0x5F : 0x5D; + this.Id = mode == TitleMode.SetTitle ? 0x61 : 0x5F; } } @@ -26,7 +26,7 @@ public partial class SetTitleAnimationTimesPacket : IClientboundPacket [Field(2)] public int FadeOut { get; set; } - public int Id => 0X60; + public int Id => 0X62; } public enum TitleMode diff --git a/Obsidian/Net/Packets/Play/Clientbound/SoundEffectPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SoundEffectPacket.cs index aa4f91aa7..15fdfa3fe 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SoundEffectPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SoundEffectPacket.cs @@ -30,5 +30,5 @@ public partial class SoundEffectPacket : IClientboundPacket [Field(8)] public long Seed { get; init; } - public int Id => 0x62; + public int Id => 0x64; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SpawnExperienceOrbPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SpawnExperienceOrbPacket.cs index bb3792c31..b83f01ae0 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SpawnExperienceOrbPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SpawnExperienceOrbPacket.cs @@ -5,7 +5,7 @@ namespace Obsidian.Net.Packets.Play.Clientbound; public partial class SpawnExperienceOrbPacket : IClientboundPacket { [Field(0), VarLength] - private const int EntityId = 2; // Source: https://minecraft.wiki/w/Java_Edition_data_values/Pre-flattening/Entity_IDs + public int EntityId { get; init; } [Field(1), DataFormat(typeof(double))] public VectorF Position { get; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/StartConfigurationPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/StartConfigurationPacket.cs new file mode 100644 index 000000000..ebf93f31e --- /dev/null +++ b/Obsidian/Net/Packets/Play/Clientbound/StartConfigurationPacket.cs @@ -0,0 +1,9 @@ +namespace Obsidian.Net.Packets.Play.Clientbound; + +//TODO WRITE +public sealed partial class StartConfigurationPacket : IClientboundPacket +{ + public int Id => 0x65; + + public void Serialize(MinecraftStream stream) { } +} diff --git a/Obsidian/Net/Packets/Play/Clientbound/SynchronizePlayerPositionPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SynchronizePlayerPositionPacket.cs index 22e6a03cc..9d360fc0d 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SynchronizePlayerPositionPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SynchronizePlayerPositionPacket.cs @@ -30,5 +30,5 @@ public partial class SynchronizePlayerPositionPacket : IClientboundPacket [Field(4), VarLength] public int TeleportId { get; init; } - public int Id => 0x3C; + public int Id => 0x3E; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/SystemChatMessagePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/SystemChatMessagePacket.cs index e601e0768..17b7f4b63 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/SystemChatMessagePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/SystemChatMessagePacket.cs @@ -9,7 +9,7 @@ public partial class SystemChatMessagePacket : IClientboundPacket [Field(1)] public bool Overlay { get; } - public int Id => 0x64; + public int Id => 0x67; public SystemChatMessagePacket(ChatMessage message, bool overlay) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/TeleportEntityPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/TeleportEntityPacket.cs index d5fe74252..93a846cf7 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/TeleportEntityPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/TeleportEntityPacket.cs @@ -19,5 +19,5 @@ public partial class TeleportEntityPacket : IClientboundPacket [Field(4)] public bool OnGround { get; init; } - public int Id => 0x68; + public int Id => 0x6B; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UnloadChunkPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UnloadChunkPacket.cs index 3afa54e62..415b6dc9b 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UnloadChunkPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UnloadChunkPacket.cs @@ -10,7 +10,7 @@ public partial class UnloadChunkPacket : IClientboundPacket [Field(1)] public int Z { get; } - public int Id => 0x1E; + public int Id => 0x1F; public UnloadChunkPacket(int x, int z) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateAdvancementsPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateAdvancementsPacket.cs index 6d3473fc6..56cadf77e 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateAdvancementsPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateAdvancementsPacket.cs @@ -3,7 +3,7 @@ namespace Obsidian.Net.Packets.Play.Clientbound; -//TODO finish this packet +//TODO finish this packet PLEASE public partial class UpdateAdvancementsPacket : IClientboundPacket { [Field(0)] @@ -15,7 +15,7 @@ public partial class UpdateAdvancementsPacket : IClientboundPacket [Field(2)] public List RemovedAdvancements { get; set; } - public int Id => 0x69; + public int Id => 0x6C; public void Serialize(MinecraftStream stream) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionAndRotationPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionAndRotationPacket.cs index 2754e1dec..d2db2fa4a 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionAndRotationPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionAndRotationPacket.cs @@ -19,5 +19,5 @@ public partial class UpdateEntityPositionAndRotationPacket : IClientboundPacket [Field(4)] public bool OnGround { get; init; } - public int Id => 0x2C; + public int Id => 0x2D; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionPacket.cs index f044cede8..0926bca0b 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityPositionPacket.cs @@ -13,5 +13,5 @@ public partial class UpdateEntityPositionPacket : IClientboundPacket [Field(4)] public bool OnGround { get; init; } - public int Id => 0x2B; + public int Id => 0x2C; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityRotationPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityRotationPacket.cs index 50a858a6a..8f2090877 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityRotationPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateEntityRotationPacket.cs @@ -16,5 +16,5 @@ public partial class UpdateEntityRotationPacket : IClientboundPacket [Field(3)] public bool OnGround { get; init; } - public int Id => 0x2D; + public int Id => 0x2E; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateObjectivesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateObjectivesPacket.cs index d3e4b6494..e1188870a 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateObjectivesPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateObjectivesPacket.cs @@ -5,18 +5,18 @@ namespace Obsidian.Net.Packets.Play.Clientbound; public partial class UpdateObjectivesPacket : IClientboundPacket { [Field(0)] - public string ObjectiveName { get; init; } + public required string ObjectiveName { get; init; } [Field(1), ActualType(typeof(sbyte))] - public ScoreboardMode Mode { get; init; } + public required ScoreboardMode Mode { get; init; } [Field(2), ActualType(typeof(ChatMessage)), Condition(nameof(ShouldWriteValue))] - public ChatMessage Value { get; init; } + public ChatMessage? Value { get; init; } [Field(3), VarLength, ActualType(typeof(int)), Condition(nameof(ShouldWriteValue))] public DisplayType Type { get; init; } - public int Id => 0x58; + public int Id => 0x5A; private bool ShouldWriteValue => Mode is ScoreboardMode.Create or ScoreboardMode.Update; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipeBookPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipeBookPacket.cs index 0190554fc..52fad5fdb 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipeBookPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipeBookPacket.cs @@ -37,7 +37,7 @@ public partial class UpdateRecipeBookPacket : IClientboundPacket [Field(10), Condition("Action == UnlockRecipeAction.Init")] public List SecondRecipeIds { get; init; } - public int Id => 0x3D; + public int Id => 0x3F; } public enum UnlockRecipeAction : int diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipesPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipesPacket.cs index 75c5eaad4..ce8f3f0a3 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipesPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateRecipesPacket.cs @@ -9,7 +9,7 @@ public partial class UpdateRecipesPacket : IClientboundPacket [Field(0)] public IDictionary Recipes { get; } - public int Id => 0x6D; + public int Id => 0x6F; public static readonly UpdateRecipesPacket FromRegistry = new(RecipesRegistry.Recipes); diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateScorePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateScorePacket.cs index 1a046bb42..ce76f18f0 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateScorePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateScorePacket.cs @@ -28,5 +28,5 @@ public partial class UpdateScorePacket : IClientboundPacket [Field(4), VarLength, Condition(nameof(Action) + " != 1")] public int Value { get; init; } - public int Id => 0x5B; + public int Id => 0x5D; } diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateTeamsPacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateTeamsPacket.cs index 6f4560fe8..65a12e711 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateTeamsPacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateTeamsPacket.cs @@ -35,7 +35,7 @@ public partial class UpdateTeamsPacket : IClientboundPacket [Field(9), Condition("Mode != TeamModeOption.RemoveTeam || Mode != TeamModeOption.UpdateTeam")] public HashSet Entities { get; set; } = new(); - public int Id => 0x5A; + public int Id => 0x5C; public void Serialize(MinecraftStream stream) { diff --git a/Obsidian/Net/Packets/Play/Clientbound/UpdateTimePacket.cs b/Obsidian/Net/Packets/Play/Clientbound/UpdateTimePacket.cs index f5c5b885c..ae323fe3d 100644 --- a/Obsidian/Net/Packets/Play/Clientbound/UpdateTimePacket.cs +++ b/Obsidian/Net/Packets/Play/Clientbound/UpdateTimePacket.cs @@ -10,7 +10,7 @@ public partial class UpdateTimePacket : IClientboundPacket [Field(1)] public long TimeOfDay { get; } - public int Id => 0x5E; + public int Id => 0x60; public UpdateTimePacket(long worldAge, long timeOfDay) { diff --git a/Obsidian/Net/Packets/Play/CloseContainerPacket.cs b/Obsidian/Net/Packets/Play/CloseContainerPacket.cs index 239717daf..88282f79f 100644 --- a/Obsidian/Net/Packets/Play/CloseContainerPacket.cs +++ b/Obsidian/Net/Packets/Play/CloseContainerPacket.cs @@ -9,7 +9,7 @@ public partial class CloseContainerPacket : IClientboundPacket, IServerboundPack [Field(0)] public byte WindowId { get; private set; } - public int Id => 0x11; + public int Id => 0x12; public async ValueTask HandleAsync(Server server, Player player) { diff --git a/Obsidian/Net/Packets/Play/SetHeldItemPacket.cs b/Obsidian/Net/Packets/Play/SetHeldItemPacket.cs index a8ed158db..c80f457f5 100644 --- a/Obsidian/Net/Packets/Play/SetHeldItemPacket.cs +++ b/Obsidian/Net/Packets/Play/SetHeldItemPacket.cs @@ -14,7 +14,7 @@ public partial class SetHeldItemPacket : IServerboundPacket, IClientboundPacket public SetHeldItemPacket(bool toClient) { - this.Id = toClient ? 0x4D : 0x28; + this.Id = toClient ? 0x4F : 0x28; } public void Serialize(MinecraftStream stream) diff --git a/Obsidian/Net/Packets/PluginMessagePacket.cs b/Obsidian/Net/Packets/PluginMessagePacket.cs index 9ec50957e..7fd148917 100644 --- a/Obsidian/Net/Packets/PluginMessagePacket.cs +++ b/Obsidian/Net/Packets/PluginMessagePacket.cs @@ -12,7 +12,7 @@ public partial class PluginMessagePacket : IClientboundPacket, IServerboundPacke [Field(1)] public byte[] PluginData { get; private set; } - public int Id => 0x17; + public int Id => 0x18; public PluginMessagePacket() { diff --git a/Obsidian/Net/Packets/Configuration/Clientbound/UpdateTagsPacket.cs b/Obsidian/Net/Packets/UpdateTagsPacket.cs similarity index 79% rename from Obsidian/Net/Packets/Configuration/Clientbound/UpdateTagsPacket.cs rename to Obsidian/Net/Packets/UpdateTagsPacket.cs index d230b86d8..59d383108 100644 --- a/Obsidian/Net/Packets/Configuration/Clientbound/UpdateTagsPacket.cs +++ b/Obsidian/Net/Packets/UpdateTagsPacket.cs @@ -1,12 +1,13 @@ using Obsidian.Serialization.Attributes; -namespace Obsidian.Net.Packets.Configuration.Clientbound; +namespace Obsidian.Net.Packets; public sealed partial class UpdateTagsPacket : IClientboundPacket { [Field(0)] public IDictionary Tags { get; } - public int Id => 0x08; + //0x70 for play state + public int Id { get; init; } = 0x08; public static UpdateTagsPacket FromRegistry { get; } = new(Registries.TagsRegistry.Categories);