You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Added a resolveRegistryAccess() helper to safely obtain RegistryAccess from the current world or server, with error logging if unavailable. This prevents null pointer exceptions during inventory serialization/deserialization.
Updated the inventory serializer and deserializer in SerializerRegistry.java to check for valid registry access before proceeding, logging errors and skipping the operation if access is unavailable. [1][2]
Player Movement Event Handling:
Changed the injection point for handling player movement in ServerGamePacketListenerImplMixin.java to the end of the method (@At("TAIL")) and ensured that the onMove event is invoked on the main server thread, scheduling it if necessary. This prevents potential threading issues.
Updated onMove in WorldManager.java to use player.chunkPosition() instead of retrieving the chunk from the world, simplifying and possibly optimizing chunk position retrieval.
Dependency Management:
Added an import for RegistryAccess in SerializerRegistry.java to support the new registry resolution logic.
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.
Recent crash reports (specifically Server Watchdog errors) confirmed that the server thread was hanging indefinitely. The logs showed a conflict where the Factions mod (io.icker.factions) was attempting to process player movement and chunk ownership while VMP was managing high-performance networking packets. That causes a tick to 60 seconds that forced the server to crash.
Thank you for this fix! It really helped my server! +1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.