Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Added /removenear.
Dieser Commit ist enthalten in:
Ursprung
94876194c4
Commit
ccab458d9c
@ -481,6 +481,36 @@ public class EditSession {
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove nearby blocks of a type.
|
||||
*
|
||||
* @param pos
|
||||
* @param blockType
|
||||
* @param size
|
||||
* @return number of blocks affected
|
||||
*/
|
||||
public int removeNear(Vector pos, int blockType, int size) throws
|
||||
MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
BaseBlock air = new BaseBlock(0);
|
||||
|
||||
for (int x = -size; x <= size; x++) {
|
||||
for (int y = -size; y <= size; y++) {
|
||||
for (int z = -size; z <= size; z++) {
|
||||
Vector p = pos.add(x, y, z);
|
||||
|
||||
if (getBlock(p).getID() == blockType) {
|
||||
if (setBlock(p, air)) {
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all the blocks inside a region to a certain block type.
|
||||
*
|
||||
|
@ -130,6 +130,7 @@ public class WorldEdit {
|
||||
commands.put("//overlay", "[ID] - Overlay the area one layer");
|
||||
commands.put("/removeabove", "<Size> <Height> - Remove blocks above head");
|
||||
commands.put("/removebelow", "<Size> <Height> - Remove blocks below position");
|
||||
commands.put("/removenear", "<ID> <Size> - Remove blocks near you");
|
||||
commands.put("//copy", "Copies the currently selected region");
|
||||
commands.put("//cut", "Cuts the currently selected region");
|
||||
commands.put("//paste", "Pastes the clipboard");
|
||||
@ -492,6 +493,18 @@ public class WorldEdit {
|
||||
|
||||
return true;
|
||||
|
||||
// Remove blocks near
|
||||
} else if (split[0].equalsIgnoreCase("/removenear")) {
|
||||
checkArgs(split, 2, 2, split[0]);
|
||||
BaseBlock block = getBlock(split[1]);
|
||||
int size = Math.max(1, Integer.parseInt(split[2]));
|
||||
|
||||
int affected = editSession.removeNear(
|
||||
session.getPlacementPosition(player), block.getID(), size);
|
||||
player.print(affected + " block(s) have been removed.");
|
||||
|
||||
return true;
|
||||
|
||||
// Load .schematic to clipboard
|
||||
} else if (split[0].equalsIgnoreCase("//load")) {
|
||||
checkArgs(split, 1, 1, split[0]);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren