Skip to content

Commit

Permalink
Properly merge/split tracker entities
Browse files Browse the repository at this point in the history
Fixes #256 #255
  • Loading branch information
Spottedleaf committed Aug 1, 2024
1 parent 61dcc07 commit dafae4f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions patches/server/0003-Threaded-Regions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2832,10 +2832,10 @@ index 0000000000000000000000000000000000000000..a1e1782d87403ca8934d37361be7ba66
+}
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
new file mode 100644
index 0000000000000000000000000000000000000000..6277d69efb9945fcfe7a5e1ad6597e92527f9112
index 0000000000000000000000000000000000000000..5dc4c8a5b896f519be5414d4a53a71144c225324
--- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
@@ -0,0 +1,760 @@
@@ -0,0 +1,772 @@
+package io.papermc.paper.threadedregions;
+
+import ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet;
Expand Down Expand Up @@ -2934,6 +2934,12 @@ index 0000000000000000000000000000000000000000..6277d69efb9945fcfe7a5e1ad6597e92
+ for (final Iterator<Mob> iterator = from.navigatingMobs.unsafeIterator(); iterator.hasNext();) {
+ into.navigatingMobs.add(iterator.next());
+ }
+ for (final Iterator<Entity> iterator = from.trackerEntities.iterator(); iterator.hasNext();) {
+ into.trackerEntities.add(iterator.next());
+ }
+ for (final Iterator<Entity> iterator = from.trackerUnloadedEntities.iterator(); iterator.hasNext();) {
+ into.trackerUnloadedEntities.add(iterator.next());
+ }
+ // block ticking
+ into.blockEvents.addAll(from.blockEvents);
+ // ticklists use game time
Expand Down Expand Up @@ -3032,6 +3038,12 @@ index 0000000000000000000000000000000000000000..6277d69efb9945fcfe7a5e1ad6597e92
+ if (entity instanceof Mob mob && from.navigatingMobs.contains(mob)) {
+ into.navigatingMobs.add(mob);
+ }
+ if (from.trackerEntities.contains(entity)) {
+ into.trackerEntities.add(entity);
+ }
+ if (from.trackerUnloadedEntities.contains(entity)) {
+ into.trackerUnloadedEntities.add(entity);
+ }
+ }
+ // block ticking
+ for (final BlockEventData blockEventData : from.blockEvents) {
Expand Down

0 comments on commit dafae4f

Please sign in to comment.