Add DynamicRegionVisualizer

This commit is contained in:
2026-09-07 11:42:22 +02:00
parent c1de1cf779
commit f11f2d4278
9 changed files with 226 additions and 76 deletions
@@ -100,6 +100,19 @@ public class DynamicRegionSystem implements RegionSystem {
return GlobalRegion.INSTANCE;
}
public Set<Tile> getTilesOfRegion(@NonNull Region region) {
Point minPoint = region.getArea().getMinPoint(false);
Point maxPoint = region.getArea().getMaxPoint(false);
Set<Tile> tiles = new HashSet<>();
for (int x = minPoint.getX(); x < maxPoint.getX(); x += Tile.tileSize) {
for (int z = minPoint.getZ(); z < maxPoint.getZ(); z += Tile.tileSize) {
tiles.add(Tile.fromXZ(x, z).orElseThrow());
}
}
return Collections.unmodifiableSet(tiles);
}
public @NonNull Region get(@Nullable Tile tile) {
if (tile == null) return getGlobalRegion();
return get(tile.getCenterLocation().getBlockX(), tile.getCenterLocation().getBlockZ(), true, regionMap.values());