ObsidianMC / Obsidian

A C# implementation of the Minecraft server protocol.
GNU General Public License v3.0
413 stars 42 forks source link

De/Serialize ItemStack properly #447

Open Tides opened 2 months ago

Tides commented 2 months ago

With the update to 1.21, there have been changes made to items, causing its old format to change and being a major breaking change. Some items might not even spawn in or, in the worst case, just cause clients to disconnect/server to throw an exception and shut down.

More info about the change here

We do need to talk about how to structure this as an ItemStack is practically a list of components now instead of the old structure.

These are the methods/classes that should be updated. MinecraftStream.Writing.cs:L650-L720 MinecraftStream.Reading.cs:L579-L689 ItemStack.cs