mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-05 23:11:33 +01:00
Change PriorityRTreeIndex to use the R-tree for intersection queries.
This commit is contained in:
parent
f57afb2944
commit
2d147bb7e1
@ -86,7 +86,21 @@ public void applyContaining(Vector position, Predicate<ProtectedRegion> consumer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyIntersecting(ProtectedRegion region, Predicate<ProtectedRegion> consumer) {
|
public void applyIntersecting(ProtectedRegion region, Predicate<ProtectedRegion> consumer) {
|
||||||
super.applyIntersecting(region, consumer);
|
Vector min = region.getMinimumPoint().floor();
|
||||||
|
Vector max = region.getMaximumPoint().ceil();
|
||||||
|
|
||||||
|
Set<ProtectedRegion> candidates = new HashSet<ProtectedRegion>();
|
||||||
|
MBR pointMBR = new SimpleMBR(min.getX(), max.getX(), min.getY(), max.getY(), min.getZ(), max.getZ());
|
||||||
|
|
||||||
|
for (ProtectedRegion found : tree.find(pointMBR)) {
|
||||||
|
candidates.add(found);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ProtectedRegion found : region.getIntersectingRegions(candidates)) {
|
||||||
|
if (!consumer.apply(found)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user