diff --git a/patches/server/Folia-scheduler-and-owned-region-API.patch b/patches/server/Folia-scheduler-and-owned-region-API.patch index 053e217167..7ffd95500b 100644 --- a/patches/server/Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/Folia-scheduler-and-owned-region-API.patch @@ -1130,15 +1130,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper + // Paper start - Folia scheduler API + ((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick(); -+ getAllLevels().forEach(level -> level.getAllEntities().forEach(entity -> { -+ if (entity.isRemoved()) { -+ return; ++ getAllLevels().forEach(level -> { ++ for (final Entity entity : level.getEntityLookup().getAllCopy()) { ++ if (entity.isRemoved()) { ++ continue; ++ } ++ final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); ++ if (bukkit != null) { ++ bukkit.taskScheduler.executeTick(); ++ } + } -+ org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); -+ if (bukkit != null) { -+ bukkit.taskScheduler.executeTick(); -+ } -+ })); ++ }); + // Paper end - Folia scheduler API io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper this.profiler.push("commandFunctions"); diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 6fd9a1817c..0779ba6ebd 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -3776,6 +3776,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; +import java.util.ArrayList; ++import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; @@ -3939,6 +3940,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new ArrayIterable<>(this.accessibleEntities.getRawData(), 0, this.accessibleEntities.size()); + } + ++ public Entity[] getAllCopy() { ++ return Arrays.copyOf(this.accessibleEntities.getRawData(), this.accessibleEntities.size(), Entity[].class); ++ } ++ + @Override + public void get(final EntityTypeTest filter, final AbortableIterationConsumer action) { + for (final Entity entity : this.entityById.values()) {