fix BinaryColumn

This commit is contained in:
dfsek
2021-11-20 22:34:40 -07:00
parent 43426ea084
commit de267a8251
2 changed files with 3 additions and 7 deletions

View File

@@ -29,6 +29,6 @@ public class SurfaceLocatorTemplate implements ObjectTemplate<Locator> {
@Override
public Locator get() {
return new SurfaceLocator(range, platform);
return new SurfaceLocator(range);
}
}

View File

@@ -18,20 +18,16 @@ import com.dfsek.terra.api.world.Column;
public class SurfaceLocator implements Locator {
private final Range search;
private final BlockState air;
public SurfaceLocator(Range search, Platform platform) {
public SurfaceLocator(Range search) {
this.search = search;
this.air = platform.getWorldHandle().air();
}
@Override
public BinaryColumn getSuitableCoordinates(Column column) {
BinaryColumn location = new BinaryColumn(column.getMinY(), column.getMaxY());
for(int y : search) {
if(column.getBlock(y).matches(air) && !column.getBlock(y - 1).matches(air)) {
if(column.getBlock(y).isAir() && !column.getBlock(y - 1).isAir()) {
location.set(y);
return location;
}
}
return location;