mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
continue with merge
This commit is contained in:
@ -113,8 +113,11 @@ import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
*/
|
||||
@Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)")
|
||||
public class UtilityCommands extends MethodCommands {
|
||||
private final WorldEdit we;
|
||||
|
||||
public UtilityCommands(WorldEdit we) {
|
||||
super(we);
|
||||
this.we = we;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -536,15 +539,19 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius);
|
||||
entities = editSession.getEntities(region);
|
||||
} else {
|
||||
entities = editSession.getEntities();
|
||||
}
|
||||
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||
} else {
|
||||
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
for (World world : platform.getWorlds()) {
|
||||
List<? extends Entity> entities = world.getEntities();
|
||||
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||
|
@ -44,27 +44,23 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||
continue;
|
||||
try {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||
continue;
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
editSession.flushQueue();
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -26,7 +27,12 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -71,8 +77,11 @@ public class FloodFillTool implements BlockTool {
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
TODO fillDirection (but replace)
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
Mask mask = initialType.toMask(editSession);
|
||||
BlockReplace function = new BlockReplace(editSession, pattern);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getQueue());
|
||||
visitor.visit(origin);
|
||||
Operations.completeLegacy(visitor);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user