Enhance inventory serialization and improve player movement#150
Enhance inventory serialization and improve player movement#150Gardo32 wants to merge 2 commits into
Conversation
…er movement handling
|
What is the actual point of these changes? Is the way things are done currently causing any issues? |
The main point of these changes is to solve a critical deadlock issue occurring when players from different factions interact with claimed chunks while the VMP mod is active. Forgot to create an issue, mb 😅. |
This pull request improves the reliability and safety of inventory serialization and player movement event handling in the codebase. The main focus is on ensuring that registry access is always available before performing serialization/deserialization, and that player movement events are triggered on the correct server thread to avoid concurrency issues.
Inventory Serialization Improvements:
resolveRegistryAccess()helper to safely obtainRegistryAccessfrom the current world or server, with error logging if unavailable. This prevents null pointer exceptions during inventory serialization/deserialization.SerializerRegistry.javato check for valid registry access before proceeding, logging errors and skipping the operation if access is unavailable. [1] [2]Player Movement Event Handling:
ServerGamePacketListenerImplMixin.javato the end of the method (@At("TAIL")) and ensured that theonMoveevent is invoked on the main server thread, scheduling it if necessary. This prevents potential threading issues.onMoveinWorldManager.javato useplayer.chunkPosition()instead of retrieving the chunk from the world, simplifying and possibly optimizing chunk position retrieval.Dependency Management:
RegistryAccessinSerializerRegistry.javato support the new registry resolution logic.