ryuuta0217 / UnknownNetworkCore

Other
4 stars 1 forks source link

Client <=> Server Enchant mismatch #42

Closed ryuuta0217 closed 1 year ago

ryuuta0217 commented 1 year ago

When enchanting in the enchantment table, there is a mismatch of enchantments granted between the client and server.

Reproduce this issue:

ryuuta0217 commented 1 year ago

note: there seems to be no minecraft:smite enchantment on the server side.

ryuuta0217 commented 1 year ago

The cause was due to ObjectList#remove of registryId from ObjectList byId. When ObjectList#remove was performed, the id was moved up and the 14th enchantment became the 13th. Then ObjectList#set to set the 13th enchantment as sharpness, which caused a mismatch in the enchantment calculation with the client.

ryuuta0217 commented 1 year ago

Overview:

13th removed, 14th became the 13th. Set 13th as DamageEnchant Type 0 (minecraft:sharpness, MaxLevel=10). Oops! 14th enchantment is where…?

ryuuta0217 commented 1 year ago

more rigorous checks at RegistryUtil#forceReplace now.