Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 10:30:04 +01:00
Added a thickness parameter to //hollow.
Dieser Commit ist enthalten in:
Ursprung
936aff06b2
Commit
633f6643a5
@ -2731,7 +2731,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int hollowOutRegion(Region region) throws MaxChangedBlocksException {
|
public int hollowOutRegion(Region region, int thickness) throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
Set<BlockVector> outside = new HashSet<BlockVector>();
|
Set<BlockVector> outside = new HashSet<BlockVector>();
|
||||||
@ -2769,6 +2769,23 @@ public class EditSession {
|
|||||||
|
|
||||||
BaseBlock air = new BaseBlock(BlockID.AIR);
|
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) {
|
outer: for (BlockVector position : region) {
|
||||||
for (Vector recurseDirection: recurseDirections) {
|
for (Vector recurseDirection: recurseDirections) {
|
||||||
BlockVector neighbor = position.add(recurseDirection).toBlockVector();
|
BlockVector neighbor = position.add(recurseDirection).toBlockVector();
|
||||||
|
@ -394,17 +394,19 @@ public class RegionCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "/hollow" },
|
aliases = { "/hollow" },
|
||||||
usage = "",
|
usage = "[<thickness>]",
|
||||||
desc = "Hollows out the object contained in this selection",
|
desc = "Hollows out the object contained in this selection",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 0
|
max = 1
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.hollow")
|
@CommandPermissions("worldedit.region.hollow")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void hollow(CommandContext args, LocalSession session, LocalPlayer player,
|
public void hollow(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
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.");
|
player.print(affected + " block(s) have been changed.");
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren