Revert "More code quality fixes"

This reverts commit 2d6957ce
This commit is contained in:
MattBDev
2020-01-23 14:41:57 -05:00
parent 37003ec089
commit e0f6869573
115 changed files with 1688 additions and 686 deletions

View File

@ -172,10 +172,10 @@ public abstract class AbstractRegion extends AbstractSet<BlockVector3> implement
final BlockVector3 min = getMinimumPoint().divide(16);
final BlockVector3 max = getMaximumPoint().divide(16);
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
if (containsChunk(x, z)) {
chunks.add(BlockVector2.at(x, z));
for (int X = min.getBlockX(); X <= max.getBlockX(); ++X) {
for (int Z = min.getBlockZ(); Z <= max.getBlockZ(); ++Z) {
if (containsChunk(X, Z)) {
chunks.add(BlockVector2.at(X, Z));
}
}
}

View File

@ -124,8 +124,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
if (pos1 == null || pos2 == null) {
return;
}
pos1 = pos1.clampY(world == null ? 0 : 0, world == null ? FaweCache.worldMaxY : world.getMaxY());
pos2 = pos2.clampY(world == null ? 0 : 0, world == null ? FaweCache.worldMaxY : world.getMaxY());
pos1 = pos1.clampY(world == null ? 0 : 0, world == null ? FaweCache.WORLD_MAX_Y : world.getMaxY());
pos2 = pos2.clampY(world == null ? 0 : 0, world == null ? FaweCache.WORLD_MAX_Y : world.getMaxY());
minX = Math.min(pos1.getX(), pos2.getX());
minY = Math.min(pos1.getY(), pos2.getY());
minZ = Math.min(pos1.getZ(), pos2.getZ());
@ -730,7 +730,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
boolean trimZ = lowerZ != 0 || upperZ != 15;
int indexY, index;
for (int layer = 0; layer < FaweCache.chunkLayers; layer++) {
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) {
if (set.hasSection(layer)) {
char[] arr = set.load(layer);
if (trimX || trimZ) {

View File

@ -67,7 +67,9 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
*
* @return center point
*/
Vector3 getCenter();
default Vector3 getCenter() {
return getMinimumPoint().add(getMaximumPoint()).toVector3().divide(2);
}
/**
* Get the number of blocks in the region.
@ -193,9 +195,17 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
*/
List<BlockVector2> polygonize(int maxPoints);
default int getMinimumY() {
return getMinimumPoint().getY();
}
default int getMaximumY() {
return getMaximumPoint().getY();
}
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, boolean full) {
int minSection = Math.max(0, getMinimumPoint().getBlockY() >> 4);
int maxSection = Math.min(15, getMaximumPoint().getBlockY() >> 4);
int minSection = Math.max(0, getMinimumY() >> 4);
int maxSection = Math.min(15, getMaximumY() >> 4);
for (int layer = minSection; layer <= maxSection; layer++) {
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) return;
block = block.initLayer(get, set, layer);