mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 22:31:52 +00:00
fix BinaryColumn
This commit is contained in:
+1
-1
@@ -29,6 +29,6 @@ public class SurfaceLocatorTemplate implements ObjectTemplate<Locator> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Locator get() {
|
public Locator get() {
|
||||||
return new SurfaceLocator(range, platform);
|
return new SurfaceLocator(range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -18,20 +18,16 @@ import com.dfsek.terra.api.world.Column;
|
|||||||
public class SurfaceLocator implements Locator {
|
public class SurfaceLocator implements Locator {
|
||||||
private final Range search;
|
private final Range search;
|
||||||
|
|
||||||
private final BlockState air;
|
public SurfaceLocator(Range search) {
|
||||||
|
|
||||||
public SurfaceLocator(Range search, Platform platform) {
|
|
||||||
this.search = search;
|
this.search = search;
|
||||||
this.air = platform.getWorldHandle().air();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BinaryColumn getSuitableCoordinates(Column column) {
|
public BinaryColumn getSuitableCoordinates(Column column) {
|
||||||
BinaryColumn location = new BinaryColumn(column.getMinY(), column.getMaxY());
|
BinaryColumn location = new BinaryColumn(column.getMinY(), column.getMaxY());
|
||||||
for(int y : search) {
|
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);
|
location.set(y);
|
||||||
return location;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
|
|||||||
Reference in New Issue
Block a user