3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-19 22:30:05 +02:00

Added a thickness parameter to //hollow.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-19 11:58:38 +01:00
Ursprung 936aff06b2
Commit 633f6643a5
2 geänderte Dateien mit 23 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -2731,7 +2731,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int hollowOutRegion(Region region) throws MaxChangedBlocksException {
public int hollowOutRegion(Region region, int thickness) throws MaxChangedBlocksException {
int affected = 0;
Set<BlockVector> outside = new HashSet<BlockVector>();
@ -2769,6 +2769,23 @@ public class EditSession {
BaseBlock air = new BaseBlock(BlockID.AIR);
for (int i = 1; i < thickness; ++i) {
final Set<BlockVector> newOutside = new HashSet<BlockVector>(outside);
outer: for (BlockVector position : region) {
for (Vector recurseDirection: recurseDirections) {
BlockVector neighbor = position.add(recurseDirection).toBlockVector();
if (outside.contains(neighbor)) {
newOutside.add(position);
continue outer;
}
}
}
outside = newOutside;
}
outer: for (BlockVector position : region) {
for (Vector recurseDirection: recurseDirections) {
BlockVector neighbor = position.add(recurseDirection).toBlockVector();

Datei anzeigen

@ -394,17 +394,19 @@ public class RegionCommands {
@Command(
aliases = { "/hollow" },
usage = "",
usage = "[<thickness>]",
desc = "Hollows out the object contained in this selection",
min = 0,
max = 0
max = 1
)
@CommandPermissions("worldedit.region.hollow")
@Logging(REGION)
public void hollow(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
int affected = editSession.hollowOutRegion(session.getSelection(player.getWorld()));
int thickness = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
int affected = editSession.hollowOutRegion(session.getSelection(player.getWorld()), thickness);
player.print(affected + " block(s) have been changed.");
}