More slag

This commit is contained in:
Anuken
2021-11-14 10:12:47 -05:00
parent 3a6878ef60
commit 70cf55f314
4 changed files with 23 additions and 4 deletions

View File

@@ -49,10 +49,16 @@ public abstract class BasicGenerator implements WorldGenerator{
}
public void median(int radius, double percentile){
median(radius, percentile, null);
}
public void median(int radius, double percentile, @Nullable Block targetFloor){
short[] blocks = new short[tiles.width * tiles.height];
short[] floors = new short[blocks.length];
tiles.each((x, y) -> {
if(targetFloor != null && tiles.getn(x, y).floor() != targetFloor) return;
ints1.clear();
ints2.clear();
Geometry.circle(x, y, width, height, radius, (cx, cy) -> {
@@ -67,6 +73,8 @@ public abstract class BasicGenerator implements WorldGenerator{
});
pass((x, y) -> {
if(targetFloor != null && floor != targetFloor) return;
block = content.block(blocks[x + y * width]);
floor = content.block(floors[x + y * width]);
});