geforkt von Mirrors/FastAsyncWorldEdit
Added /thaw.
Dieser Commit ist enthalten in:
Ursprung
1767597672
Commit
d55fa96e3e
@ -1570,6 +1570,54 @@ public class EditSession {
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Thaw.
|
||||
*
|
||||
* @param pos
|
||||
* @param radius
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int thaw(Vector pos, int radius)
|
||||
throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
int radiusSq = (int)Math.pow(radius, 2);
|
||||
|
||||
int ox = pos.getBlockX();
|
||||
int oy = pos.getBlockY();
|
||||
int oz = pos.getBlockZ();
|
||||
|
||||
BaseBlock air = new BaseBlock(0);
|
||||
BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
|
||||
|
||||
for (int x = ox - radius; x <= ox + radius; x++) {
|
||||
for (int z = oz - radius; z <= oz + radius; z++) {
|
||||
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int y = 127; y >= 1; y--) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
int id = getBlock(pt).getID();
|
||||
|
||||
if (id == BlockID.ICE) { // Ice
|
||||
if (setBlock(pt, water)) {
|
||||
affected++;
|
||||
}
|
||||
} else if (id == BlockID.SNOW) {
|
||||
if (setBlock(pt, air)) {
|
||||
affected++;
|
||||
}
|
||||
} else if (id != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make snow.
|
||||
*
|
||||
|
@ -155,6 +155,7 @@ public class WorldEditController {
|
||||
commands.put("/forestgen", "<Size> <Density> - Make Notch tree forest");
|
||||
commands.put("/pinegen", "<Size> <Density> - Make an ugly pine tree forest");
|
||||
commands.put("/snow", "<Radius> - Simulate snow cover");
|
||||
commands.put("/thaw", "<Radius> - Unthaw/remove snow");
|
||||
commands.put("/pumpkins", "<Size> - Make a pumpkin forest");
|
||||
commands.put("/unstuck", "Go up to the first free spot");
|
||||
commands.put("/ascend", "Go up one level");
|
||||
@ -1219,6 +1220,16 @@ public class WorldEditController {
|
||||
|
||||
return true;
|
||||
|
||||
// Thaw
|
||||
} else if (split[0].equalsIgnoreCase("/thaw")) {
|
||||
checkArgs(split, 0, 1, split[0]);
|
||||
int size = split.length > 1 ? Math.max(1, Integer.parseInt(split[1])) : 10;
|
||||
|
||||
int affected = editSession.thaw(player.getBlockIn(), size);
|
||||
player.print(affected + " surfaces thawed.");
|
||||
|
||||
return true;
|
||||
|
||||
// Make pumpkin patches
|
||||
} else if (split[0].equalsIgnoreCase("/pumpkins")) {
|
||||
checkArgs(split, 0, 1, split[0]);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren