Fix gravity brush

This commit is contained in:
Jesse Boyd 2017-03-10 08:04:24 +11:00
parent e021358b5c
commit 1e90948581
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -51,24 +51,13 @@ public class GravityBrush implements Brush {
for (int z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
int freeSpot = startCheckY;
for (int y = startCheckY; y <= endY; y++) {
if (y < startPerformY) {
if (editSession.getLazyBlock(x, y, z) != EditSession.nullBlock) {
freeSpot = y + 1;
}
continue;
}
BaseBlock block = editSession.getLazyBlock(x, y, z);
mutablePos.mutX(x);
mutablePos.mutY(y);
mutablePos.mutZ(z);
if (block != EditSession.nullBlock && (mask == null || mask.test(mutablePos))) {
if (freeSpot != y) {
mutablePos.mutY(freeSpot);
editSession.setBlockFast(mutablePos, block);
mutablePos.mutY(y);
editSession.setBlockFast(mutablePos, EditSession.nullBlock);
if (block.getId() != 0) {
if (y != freeSpot) {
editSession.setBlock(x, y, z, EditSession.nullBlock);
editSession.setBlock(x, freeSpot, z, block);
}
freeSpot++;
freeSpot = y + 1;
}
}
}