version: git-dbe52e2
code:
public static void startRefill(Position startPos, Position endPos, RefillBlockTable table, Level level){
if(!table.validate()){
bs.main.logger.alert("RefillBlockTable is not valid! but I'm going to run this anyway. total: " + table.totalPercentage());
}
for(int x = (int) startPos.getX(); x <= endPos.getX(); x++){
for(int y = (int) startPos.getY(); y <= endPos.getY(); y++){
for(int z = (int) startPos.getZ(); z <= endPos.getZ(); z++){
String randomBlockId = table.getRandom().typeId;
Block block = Registries.BLOCK.get(randomBlockId);
if(block == null){
bs.main.logger.error("Block ID " + randomBlockId + " is not valid!");
continue;
}
Position placingPos = new Position();
placingPos.setLevel(level);
placingPos.setX(x);
placingPos.setY(y);
placingPos.setZ(z);
level.setBlock(placingPos, block);
}
}
}
for(int chunkX = startPos.getChunkX(); chunkX <= endPos.getChunkX(); chunkX++){
for(int chunkZ = startPos.getChunkZ(); chunkZ <= endPos.getChunkZ(); chunkZ++){
// System.world.unloadChunk(chunkX, chunkZ);
// System.world.loadChunk(chunkX, chunkZ);
// startPos.level.getChunk(chunkX, chunkZ).setChanged(true);
}
}
}
video: