Use more MutableBlockVector3s

This commit is contained in:
dordsor21
2021-08-11 14:56:10 +01:00
parent 6f5430a940
commit 3ba42df321
17 changed files with 206 additions and 98 deletions

View File

@ -213,11 +213,13 @@ public interface Extent extends InputExtent, OutputExtent {
}
default int getHighestTerrainBlock(final int x, final int z, int minY, int maxY, Mask filter) {
maxY = Math.min(maxY, getMaxY());
minY = Math.max(getMinY(), minY);
BlockVector3 pos = MutableBlockVector3.at(x, minY, z);
maxY = Math.min(maxY, Math.max(0, maxY));
minY = Math.max(0, minY);
MutableBlockVector3 mutable = new MutableBlockVector3();
for (int y = maxY; y >= minY; --y) {
if (filter.test(pos.mutY(y))) {
if (filter.test(mutable.setComponents(x, y, z))) {
return y;
}
}

View File

@ -157,8 +157,9 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat
max = max.getMaximum(BlockVector3.at(x, y, z));
}
if (mask.test(BlockVector3.at(x, y, z))) {
biomeBuffer.put(BlockVector3.at(x, y, z), biome);
BlockVector3 pos = BlockVector3.at(x, y, z);
if (mask.test(pos)) {
biomeBuffer.put(pos, biome);
return true;
} else {
return getExtent().setBiome(x, y, z, biome);

View File

@ -342,7 +342,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
int yy = pos.getY() + rely;
int zz = pos.getZ() + relz;
if (pasteBiomes) {
extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(BlockVector3.at(pos.getX(), pos.getY(), pos.getZ())));
extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(pos));
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
continue;