Skip to content

Port remaining patches and some other fixes#29

Merged
PureGero merged 24 commits intoMultiPaper:ver/1.21.11from
UnlimitedBytes:ver/1.21.11
Jan 6, 2026
Merged

Port remaining patches and some other fixes#29
PureGero merged 24 commits intoMultiPaper:ver/1.21.11from
UnlimitedBytes:ver/1.21.11

Conversation

@UnlimitedBytes
Copy link
Copy Markdown
Contributor

Summary

Completes the patches_removed cleanup for 1.21.11 by porting 12 remaining patches and removing obsolete/already-integrated ones.

Ported Patches (12 total)

As dedicated commits:

  • 0043: Ensure worlds are loaded on the global scheduler
  • 0051: Bukkit API thread checks
  • 0057: Null safety check in PaperEventManager
  • 0059: seenBy thread safety (ReentrantLock for TrackedEntity)
  • 0064: Maximum trackers per entity optimization
  • 0066: Command blocks synchronization
  • 0067: BroadcastPacketEvent integration
  • 0068: Write player saves async

As source patches:

  • 0037: Thread-safe raids
  • 0045: Thread-safe scoreboards
  • 0046: Entity activation check frequency optimization
  • 0070: Only apply item gravity if not on ground

Already Integrated (13 patches removed)

These were already in the 1.21.11 codebase or superseded by Moonrise architecture:

  • 0026, 0027, 0028, 0038, 0039, 0040, 0048, 0056, 0061, 0069, 0071, X0016, X0055

Obsolete/Not-Applicable (4 patches removed)

  • 0058, X0017, X0019, X0036

Additional Fixes

  • Fix player task scheduler execution
  • Thread-safe eye of ender signal fire search
  • Thread-safe redstone torch burnout tracking
  • Fix foojay-resolver-convention for Gradle 9
  • Remove debug logging from LevelChunkRegionMap
  • SetBlockCommand fixed
  • FillCommand fixed
  • CloneCommands fixed

Result

The patches_removed/ folder is now empty - all patches have been either ported, verified as integrated, or confirmed obsolete.

Test Plan

  • Server starts without errors
  • Player data saves correctly on disconnect
  • Command blocks work in multithreaded context
  • Entity tracking with multiple players
  • Raids work across region boundaries
  • Scoreboard operations under concurrent access
  • Gradle 9 build compatibility
  • 500 players bot stress test

Apply scoreboard thread-safety as source patches instead of feature patch
Apply raid thread-safety as source patches instead of feature patch
Apply redstone torch thread-safety as source patch instead of feature patch
Apply entity activation optimization as source patch instead of feature patch
Apply item gravity optimization as source patch instead of feature patch
Execute scheduled tasks on the player's task scheduler during tick (e.g., packet handlers)
Sync patch context and naming conventions with upstream
These 12 patches have been verified as already integrated into the 1.21.11 codebase:

- 0026-Run-unsupported-plugins-in-sync (fully integrated)
- 0027-Thread-safe-AreaMap (superseded by Moonrise architecture)
- 0028-Threaded-chunk-changes-broadcasting (fully integrated)
- 0039-Thread-safe-redstoneUpdateInfos (fully integrated)
- 0040-Thread-safe-chunksBeingWorkedOn (superseded by Moonrise)
- 0048-Synchronize-playersSentChunkTo (fully integrated)
- 0056-Don-t-allow-actions-outside-of-our-region (fully integrated)
- 0061-Optimization-Use-lazyExecute-if-we-aren-t-flushing (fully integrated)
- 0069-Optimization-Load-chunk-before-joining-player (fully integrated)
- 0071-Fix-Concurrent-modification-when-removing-player (fully integrated)
- X0016-EntityLookup-accessibleEntities (fully integrated)
- X0055-Moving-into-another-region (fully integrated)
These patches cannot be applied to 1.21.11:

- X0017-World-gen: Marked as obsolete, functionality refactored
- X0019-Multithreaded-WeakSeqLock: Target class (WeakSeqLock) doesn't exist in 1.21.11
- X0036-Entity-retirement-debug-log: Debug/experimental patch, no longer needed
- 0058-Fix-EntityRemoveEventTest: Depends on Pufferfish optimization that doesn't exist
Adds thread safety checks to CraftServer.createWorld() to ensure worlds
are only loaded from the global scheduler tick thread, not from async
or region tick threads.
Adds thread safety checks to CraftChunk, CraftWorld, and CraftBlock to
ensure chunk and block operations are only performed from the correct
region tick thread:
- CraftChunk.getHandle(): Check region ownership
- CraftWorld.getChunkAt(): Check region ownership
- CraftBlock: getNMS(), getData(), getType(), setBlockState() ensure
  tick thread for block position
Most changes from the original patch were already applied. This ports
the remaining null safety check for this.server in PaperEventManager
callEvent() to prevent NPE during early initialization.
Adds ReentrantLock-based thread safety to TrackedEntity's seenBy set
operations in ChunkMap to prevent ConcurrentModificationException when
multiple threads access entity tracking data.
Adds tracker update frequency optimization and maximum trackers per entity limit.
Adds thread synchronization for command block output updates.
Adds event calls for packet broadcasting in ChunkMap, ServerLevel, and PlayerList.
Adds asynchronous writing for player save data to improve performance.
Wraps block-modifying operations in ShreddedPaper.ensureSync() to ensure
they run on the correct region thread when a command block executes
/setblock targeting coordinates in a different region.
Wraps block-modifying operations in ShreddedPaper.ensureSync() to ensure
they run on the correct region thread when a command block executes
/fill targeting coordinates in a different region.
Wraps block-modifying operations in ShreddedPaper.ensureSync() to ensure
they run on the correct region thread when a command block executes
/clone targeting coordinates in a different region.
Fixes invisible blocks issue when SetBlockCommand, FillCommand, or
CloneCommands modify chunks that aren't being watched by any player.
The cached chunk packet is now invalidated so players receive fresh
chunk data when they teleport to the affected area.
@PureGero PureGero merged commit a339a35 into MultiPaper:ver/1.21.11 Jan 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants