diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index fa92ac0523..3ae934d428 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -146,6 +146,7 @@ import org.bukkit.plugin.messaging.StandardMessenger; import org.bukkit.potion.PotionType; import org.bukkit.util.BiomeSearchResult; import org.bukkit.util.BoundingBox; +import org.bukkit.util.NumberConversions; import org.bukkit.util.RayTraceResult; import org.bukkit.util.StructureSearchResult; import org.bukkit.util.Vector; @@ -462,6 +463,25 @@ public class CraftWorld extends CraftRegionAccessor implements World { return ret.entrySet().stream().collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, (entry) -> entry.getValue().build())); } + @NotNull + @Override + public Collection getIntersectingChunks(@NotNull BoundingBox boundingBox) { + List chunks = new ArrayList<>(); + + int minX = NumberConversions.floor(boundingBox.getMinX()) >> 4; + int maxX = NumberConversions.floor(boundingBox.getMaxX()) >> 4; + int minZ = NumberConversions.floor(boundingBox.getMinZ()) >> 4; + int maxZ = NumberConversions.floor(boundingBox.getMaxZ()) >> 4; + + for (int x = minX; x <= maxX; x++) { + for (int z = minZ; z <= maxZ; z++) { + chunks.add(getChunkAt(x, z, false)); + } + } + + return chunks; + } + @Override public boolean isChunkForceLoaded(int x, int z) { return getHandle().getForcedChunks().contains(ChunkCoordIntPair.asLong(x, z));