Fixed #2491
This commit is contained in:
@@ -327,6 +327,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
duneRocks = new StaticWall("dunerocks"){{
|
duneRocks = new StaticWall("dunerocks"){{
|
||||||
variants = 2;
|
variants = 2;
|
||||||
|
ignarock.asFloor().wall = this;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sandRocks = new StaticWall("sandrocks"){{
|
sandRocks = new StaticWall("sandrocks"){{
|
||||||
|
|||||||
@@ -274,18 +274,20 @@ public abstract class BasicGenerator implements WorldGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void inverseFloodFill(Tile start){
|
public void inverseFloodFill(Tile start){
|
||||||
|
GridBits used = new GridBits(tiles.width, tiles.height);
|
||||||
|
|
||||||
IntSeq arr = new IntSeq();
|
IntSeq arr = new IntSeq();
|
||||||
arr.add(start.pos());
|
arr.add(start.pos());
|
||||||
while(!arr.isEmpty()){
|
while(!arr.isEmpty()){
|
||||||
int i = arr.pop();
|
int i = arr.pop();
|
||||||
int x = Point2.x(i), y = Point2.y(i);
|
int x = Point2.x(i), y = Point2.y(i);
|
||||||
tiles.getn(x, y).data = 2;
|
used.set(x, y);
|
||||||
for(Point2 point : Geometry.d4){
|
for(Point2 point : Geometry.d4){
|
||||||
int newx = x + point.x, newy = y + point.y;
|
int newx = x + point.x, newy = y + point.y;
|
||||||
if(tiles.in(newx, newy)){
|
if(tiles.in(newx, newy)){
|
||||||
Tile child = tiles.getn(newx, newy);
|
Tile child = tiles.getn(newx, newy);
|
||||||
if(child.block() == Blocks.air && child.data != 2){
|
if(child.block() == Blocks.air && !used.get(child.x, child.y)){
|
||||||
child.data = 2;
|
used.set(child.x, child.y);
|
||||||
arr.add(child.pos());
|
arr.add(child.pos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +295,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
if(tile.data != 2 && tile.block() == Blocks.air){
|
if(!used.get(tile.x, tile.y) && tile.block() == Blocks.air){
|
||||||
tile.setBlock(tile.floor().wall);
|
tile.setBlock(tile.floor().wall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user