mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
fix some more compilation issues
This commit is contained in:
parent
55196cec6d
commit
4d8cf04be1
@ -1,5 +1,6 @@
|
||||
package com.boydti.fawe.beta;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -25,6 +26,22 @@ public interface IDelegateChunk<U extends IChunk> extends IChunk {
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
default IQueueExtent getQueue() {
|
||||
return getParent().getQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
default CompoundTag getTag(int x, int y, int z) {
|
||||
return getParent().getTag(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean hasSection(int layer) {
|
||||
return getParent().hasSection(layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void flood(Flood flood, FilterBlockMask mask, ChunkFilterBlock block) {
|
||||
getParent().flood(flood, mask, block);
|
||||
|
@ -121,4 +121,10 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
|
||||
void flush();
|
||||
|
||||
ChunkFilterBlock initFilterBlock();
|
||||
|
||||
int size();
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
void sendChunk(int chunkX, int chunkZ);
|
||||
}
|
@ -216,9 +216,9 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
|
||||
public abstract IQueueExtent create();
|
||||
|
||||
public abstract void startSet(boolean value);
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
public abstract void endSet(boolean value);
|
||||
public abstract void endSet(boolean parallel);
|
||||
|
||||
public IQueueExtent getQueue(final World world) {
|
||||
final IQueueExtent queue = queuePool.get();
|
||||
|
@ -85,6 +85,16 @@ public abstract class SingleThreadQueueExtent implements IQueueExtent {
|
||||
CHUNK_POOL.add(chunk);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return chunks.size() + submissions.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return chunks.isEmpty() && submissions.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Future<T>> T submit(final IChunk<T> chunk) {
|
||||
if (lastChunk == chunk) {
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation.holder;
|
||||
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -8,6 +8,7 @@ import com.boydti.fawe.object.*;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -17,6 +18,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class Rollback extends FaweCommand {
|
||||
|
||||
@ -106,22 +109,14 @@ public class Rollback extends FaweCommand {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||
return false;
|
||||
}
|
||||
final Runnable task = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (edits.size() == 0) {
|
||||
player.sendMessage("Rollback complete!");
|
||||
return;
|
||||
}
|
||||
DiskStorageHistory edit = edits.remove(0);
|
||||
for (DiskStorageHistory edit : edits) {
|
||||
player.sendMessage("&d" + edit.getBDFile());
|
||||
EditSession session = edit.toEditSession(null);
|
||||
session.undo(session);
|
||||
edit.deleteFiles();
|
||||
session.getQueue().addNotifyTask(this);
|
||||
session.flushQueue();
|
||||
}
|
||||
};
|
||||
task.run();
|
||||
player.sendMessage("Rollback complete!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ public class Commands {
|
||||
}
|
||||
|
||||
public static class TranslatedCommand implements Command {
|
||||
private final String name;
|
||||
private final String[] aliases;
|
||||
private final String usage;
|
||||
private final String desc;
|
||||
private final String help;
|
||||
private final String descFooter;
|
||||
private final Command command;
|
||||
|
||||
public TranslatedCommand(String clazz, Command command) {
|
||||
@ -70,10 +70,10 @@ public class Commands {
|
||||
}
|
||||
|
||||
HashMap<String, Object> options = new HashMap<>();
|
||||
options.put("name", command.name());
|
||||
options.put("aliases", new ArrayList<>(Arrays.asList(command.aliases())));
|
||||
options.put("usage", command.usage());
|
||||
options.put("desc", command.desc());
|
||||
options.put("help", command.help());
|
||||
options.put("help", command.desc());
|
||||
options.put("desc", command.descFooter());
|
||||
for (Map.Entry<String, Object> entry : options.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!commands.contains(key)) {
|
||||
@ -88,10 +88,10 @@ public class Commands {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.name = commands.getString("name");
|
||||
this.aliases = commands.getStringList("aliases").toArray(new String[0]);
|
||||
this.usage = commands.getString("usage");
|
||||
this.desc = commands.getString("desc");
|
||||
this.help = commands.getString("help");
|
||||
this.desc = commands.getString("help");
|
||||
this.descFooter = commands.getString("desc");
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@ -101,13 +101,13 @@ public class Commands {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] aliases() {
|
||||
return aliases;
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return usage;
|
||||
public String[] aliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,33 +116,8 @@ public class Commands {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int min() {
|
||||
return this.command.min();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int max() {
|
||||
return this.command.max();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String flags() {
|
||||
return this.command.flags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help() {
|
||||
return help;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean anyFlags() {
|
||||
return this.command.anyFlags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queued() {
|
||||
return this.command.queued();
|
||||
public String descFooter() {
|
||||
return descFooter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
Runnable newTask = () -> PlatformCommandManager.getInstance().handleCommandTask(() -> {
|
||||
task.run();
|
||||
return null;
|
||||
}, context, getPlayer(), getSession(), event);
|
||||
}, context, getSession(), event);
|
||||
setMeta("cmdConfirm", newTask);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class CommandBrush implements Brush {
|
||||
String replaced = command.replace("{x}", position.getBlockX() + "")
|
||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
||||
.replace("{world}", editSession.getQueue().getWorldName())
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
FawePlayer fp = editSession.getPlayer();
|
||||
|
@ -79,7 +79,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
};
|
||||
// Add origin
|
||||
mask.test(position);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, new NullRegionFunction(), (int) size, editSession);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, new NullRegionFunction(), (int) size);
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
// Build the clipboard
|
||||
|
@ -127,7 +127,7 @@ public class ImageBrush implements Brush {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, vector -> true, Integer.MAX_VALUE, editSession);
|
||||
}, vector -> true, Integer.MAX_VALUE);
|
||||
visitor.setDirections(Arrays.asList(visitor.DIAGONAL_DIRECTIONS));
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
|
@ -36,7 +36,6 @@ public class LayerBrush implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern ignore, double size) throws MaxChangedBlocksException {
|
||||
final IQueueExtent queue = editSession.getQueue();
|
||||
final AdjacentAnyMask adjacent = new AdjacentAnyMask(new BlockMask(editSession).add(BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR));
|
||||
final SolidBlockMask solid = new SolidBlockMask(editSession);
|
||||
final RadiusMask radius = new RadiusMask(0, (int) size);
|
||||
@ -51,13 +50,13 @@ public class LayerBrush implements Brush {
|
||||
int depth = visitor.getDepth() + 1;
|
||||
if (depth > 1) {
|
||||
boolean found = false;
|
||||
int previous = layers[depth - 1].getInternalId();
|
||||
int previous2 = layers[depth - 2].getInternalId();
|
||||
BlockState previous = layers[depth - 1];
|
||||
BlockState previous2 = layers[depth - 2];
|
||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
|
||||
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
|
||||
if (visitor.isVisited(mutable) && editSession.getBlock(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
|
||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, pos.getBlockZ() + dir.getBlockZ() * 2);
|
||||
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
||||
if (visitor.isVisited(mutable) && editSession.getBlock(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
||||
found = true;
|
||||
break;
|
||||
} else {
|
||||
@ -74,8 +73,8 @@ public class LayerBrush implements Brush {
|
||||
}, pos -> {
|
||||
int depth = visitor.getDepth();
|
||||
BlockStateHolder currentPattern = layers[depth];
|
||||
return editSession.setBlock(pos, currentPattern);
|
||||
}, layers.length - 1, editSession);
|
||||
return currentPattern.apply(editSession, pos, pos);
|
||||
}, layers.length - 1);
|
||||
for (BlockVector3 pos : visited) {
|
||||
visitor.visit(pos);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class RecurseBrush implements Brush {
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
} else {
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession) {
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius) {
|
||||
@Override
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
|
@ -51,7 +51,7 @@ public class SplatterBrush extends ScatterBrush {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, vector -> editSession.setBlock(vector, finalPattern), recursion, editSession);
|
||||
}, vector -> editSession.setBlock(vector, finalPattern), recursion);
|
||||
visitor.setMaxBranch(2);
|
||||
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
|
||||
visitor.visit(position);
|
||||
|
@ -93,7 +93,7 @@ public class StencilBrush extends HeightBrush {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, vector -> true, Integer.MAX_VALUE, editSession);
|
||||
}, vector -> true, Integer.MAX_VALUE);
|
||||
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
|
@ -23,7 +23,6 @@ public abstract class ScrollAction implements ScrollTool {
|
||||
parserContext.setActor(player);
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
final LocalConfiguration config = WorldEdit.getInstance().getConfiguration();
|
||||
String[] split = arguments.split(" ");
|
||||
switch (split[0].toLowerCase()) {
|
||||
case "none":
|
||||
|
@ -6,7 +6,6 @@ import com.boydti.fawe.object.FaweInputStream;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.Metadatable;
|
||||
import com.boydti.fawe.object.RunnableVal2;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.change.StreamChange;
|
||||
import com.boydti.fawe.object.changeset.CFIChangeSet;
|
||||
@ -20,17 +19,14 @@ import com.boydti.fawe.object.schematic.Schematic;
|
||||
import com.boydti.fawe.util.CachedTextureUtil;
|
||||
import com.boydti.fawe.util.RandomTextureUtil;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.image.Drawable;
|
||||
import com.boydti.fawe.util.image.ImageViewer;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -47,7 +43,6 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
@ -62,9 +57,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@ -816,9 +810,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
// }
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public File getSaveFolder() {
|
||||
return getFolder();
|
||||
public Path getStoragePath() {
|
||||
return getFolder().toPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -845,20 +840,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
clear();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.editSession = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(boolean update) {
|
||||
clear();
|
||||
if (chunkOffset != null && player != null && update) {
|
||||
IQueueExtent packetQueue = SetQueue.IMP.getNewQueue(player.getWorld(), true, false);
|
||||
IQueueExtent packetQueue = Fawe.get().getQueueHandler().getQueue(player.getWorld());
|
||||
|
||||
int lenCX = (getWidth() + 15) >> 4;
|
||||
int lenCZ = (getLength() + 15) >> 4;
|
||||
@ -897,7 +885,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
return BiomeTypes.get(biomes.getByte(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
public int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||
int index = z * getWidth() + x;
|
||||
if (y < 0) return 0;
|
||||
@ -1023,7 +1011,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
public BufferedImage draw() {
|
||||
return new HeightMapMCADrawer(this).draw();
|
||||
// TODO NOT IMPLEMENTED
|
||||
// return new HeightMapMCADrawer(this).draw();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setBiomePriority(int value) {
|
||||
|
@ -1,13 +1,9 @@
|
||||
package com.boydti.fawe.object.change;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.HasIQueueExtent;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.history.UndoContext;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
public class MutableBlockChange implements Change {
|
||||
|
||||
@ -34,22 +30,7 @@ public class MutableBlockChange implements Change {
|
||||
create(context);
|
||||
}
|
||||
|
||||
private IQueueExtent queue;
|
||||
private boolean checkedQueue;
|
||||
|
||||
public void create(UndoContext context) {
|
||||
if (queue != null) {
|
||||
queue.setBlock(x, y, z, combinedId);
|
||||
}
|
||||
if (!checkedQueue) {
|
||||
checkedQueue = true;
|
||||
Extent extent = context.getExtent();
|
||||
ExtentTraverser found = new ExtentTraverser(extent).find(HasIQueueExtent.class);
|
||||
if (found != null) {
|
||||
(queue = ((HasIQueueExtent) found.get()).getQueue()).setBlock(x, y, z, combinedId);
|
||||
} else {
|
||||
Fawe.debug("FAWE does not support: " + extent + " for " + getClass() + " (bug Empire92)");
|
||||
}
|
||||
}
|
||||
context.getExtent().setBlock(x, y, z, BlockState.getFromOrdinal(combinedId));
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
}
|
||||
task.run(x, y, z, block);
|
||||
return true;
|
||||
}, extent instanceof EditSession ? (EditSession) extent : null);
|
||||
});
|
||||
Operations.completeBlindly(visitor);
|
||||
} else {
|
||||
CuboidRegion cuboidEquivalent = new CuboidRegion(region.getMinimumPoint(), region.getMaximumPoint());
|
||||
@ -118,7 +118,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
return true;
|
||||
}
|
||||
}, extent instanceof EditSession ? (EditSession) extent : null);
|
||||
});
|
||||
Operations.completeBlindly(visitor);
|
||||
}
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.boydti.fawe.regions.general.plot;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
@ -9,10 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
@ -24,45 +27,47 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
public final IQueueExtent IMP;
|
||||
private final LegacyMapper legacyMapper;
|
||||
|
||||
public FaweLocalBlockQueue(String world) {
|
||||
super(world);
|
||||
IMP = SetQueue.IMP.getNewQueue(FaweAPI.getWorld(world), true, false);
|
||||
public FaweLocalBlockQueue(String worldName) {
|
||||
super(worldName);
|
||||
World world = FaweAPI.getWorld(worldName);
|
||||
IMP = Fawe.get().getQueueHandler().getQueue(world);
|
||||
legacyMapper = LegacyMapper.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean next() {
|
||||
return IMP.size() > 0;
|
||||
if (!IMP.isEmpty()) {
|
||||
IMP.flush();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSet(boolean parallel) {
|
||||
IMP.startSet(parallel);
|
||||
Fawe.get().getQueueHandler().startSet(parallel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endSet(boolean parallel) {
|
||||
IMP.endSet(parallel);
|
||||
Fawe.get().getQueueHandler().endSet(parallel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return IMP.size();
|
||||
return IMP.isEmpty() ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optimize() {
|
||||
IMP.optimize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModified(long l) {
|
||||
IMP.setModified(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getModified() {
|
||||
return IMP.getModified();
|
||||
return IMP.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,9 +82,8 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
@Override
|
||||
public PlotBlock getBlock(int x, int y, int z) {
|
||||
int combined = IMP.getCombinedId4Data(x, y, z);
|
||||
com.sk89q.worldedit.world.block.BlockState state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combined);
|
||||
return PlotBlock.get(state.getInternalBlockTypeId(), state.getInternalPropertiesId());
|
||||
BlockState block = IMP.getBlock(x, y, z);
|
||||
return PlotBlock.get(block.toBaseBlock());
|
||||
}
|
||||
|
||||
private BiomeType biome;
|
||||
@ -96,12 +100,12 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
lastBiome = biome;
|
||||
this.biome = Biomes.findBiomeByName(biomes, biome, reg);
|
||||
}
|
||||
return IMP.setBiome(x, z, this.biome);
|
||||
return IMP.setBiome(x, 0, z, this.biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWorld() {
|
||||
return IMP.getWorldName();
|
||||
return IMP.getWorld().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,12 +116,12 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
@Override
|
||||
public void enqueue() {
|
||||
super.enqueue();
|
||||
IMP.enqueue();
|
||||
IMP.enableQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshChunk(int x, int z) {
|
||||
IMP.sendChunk(IMP.getFaweChunk(x, z));
|
||||
IMP.sendChunk(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -126,7 +130,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
@Override
|
||||
public void regenChunk(int x, int z) {
|
||||
IMP.regenerateChunk(x, z);
|
||||
IMP.regenerateChunk(x, z, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,12 +1,10 @@
|
||||
package com.boydti.fawe.regions.general.plot;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
||||
import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.IOUtil;
|
||||
import com.boydti.fawe.util.SetQueue;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
@ -29,7 +27,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
@ -47,9 +44,6 @@ public class FaweSchematicHandler extends SchematicHandler {
|
||||
queue.setTile(x, y, z, compoundTag);
|
||||
return true;
|
||||
}
|
||||
IQueueExtent IQueueExtent = SetQueue.IMP.getNewQueue(((FaweLocalBlockQueue) queue).IMP.getWEWorld(), true, false);
|
||||
IQueueExtent.setTile(x, y, z, (CompoundTag) FaweCache.asTag(compoundTag));
|
||||
IQueueExtent.flush();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,11 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
|
||||
}
|
||||
|
||||
// Don't delete
|
||||
public NBTOutputStream(DataOutput os) throws IOException {
|
||||
public NBTOutputStream(DataOutput os) {
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public NBTOutputStream(DataOutputStream os) {
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,11 @@ import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
@ -44,6 +48,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@ -194,12 +199,12 @@ public class BrushOptionsCommands {
|
||||
descFooter = "Set the right click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.primary")
|
||||
public void primary(Player player, LocalSession session, InjectedValueAccess args)
|
||||
throws WorldEditException {
|
||||
public void primary(Player player, LocalSession session,
|
||||
@Arg(desc = "The brush command", variable = true) List<String> command) throws WorldEditException {
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
session.setTool(item, null, player);
|
||||
String cmd = "brush " + args.getJoinedStrings(0);
|
||||
String cmd = "brush " + StringMan.join(command, " ");
|
||||
CommandEvent event = new CommandEvent(player, cmd);
|
||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||
@ -214,12 +219,13 @@ public class BrushOptionsCommands {
|
||||
descFooter = "Set the left click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.secondary")
|
||||
public void secondary(Player player, LocalSession session, InjectedValueAccess args)
|
||||
public void secondary(Player player, LocalSession session,
|
||||
@Arg(desc = "The brush command", variable = true) List<String> command)
|
||||
throws WorldEditException {
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
session.setTool(item, null, player);
|
||||
String cmd = "brush " + args.getJoinedStrings(0);
|
||||
String cmd = "brush " + StringMan.join(command, " ");
|
||||
CommandEvent event = new CommandEvent(player, cmd);
|
||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||
@ -276,21 +282,14 @@ public class BrushOptionsCommands {
|
||||
desc = "Set the targeting mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.targetmask")
|
||||
public void targetMask(Player player, EditSession editSession, LocalSession session,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
public void targetMask(Player player, EditSession editSession, LocalSession session, Mask mask) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
return;
|
||||
}
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(player);
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
tool.setTraceMask(mask);
|
||||
BBC.BRUSH_TARGET_MASK_SET.send(player, context.getJoinedStrings(0));
|
||||
BBC.BRUSH_TARGET_MASK_SET.send(player, mask.toString());
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -319,14 +318,17 @@ public class BrushOptionsCommands {
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Arg(desc="Target Modes")
|
||||
String modes, InjectedValueAccess args) throws WorldEditException {
|
||||
String modes,
|
||||
@Arg(desc = "The scroll action", variable = true)
|
||||
List<String> command) throws WorldEditException {
|
||||
// TODO NOT IMPLEMENTED Convert ScrollAction to an argument converter
|
||||
BrushTool bt = session.getBrushTool(player, false);
|
||||
if (bt == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
return;
|
||||
}
|
||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
||||
ScrollAction action = ScrollAction.fromArguments(bt, player, session, args.getJoinedStrings(0), true);
|
||||
ScrollAction action = ScrollAction.fromArguments(bt, player, session, StringMan.join(command, " "), true);
|
||||
settings.setScrollAction(action);
|
||||
if (modes.equalsIgnoreCase("none")) {
|
||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||
@ -345,26 +347,25 @@ public class BrushOptionsCommands {
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void mask(Player player, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand, InjectedValueAccess context)
|
||||
boolean offHand,
|
||||
@Arg(desc = "The destination mask", def = "")
|
||||
Mask mask,
|
||||
Arguments arguments)
|
||||
throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
return;
|
||||
}
|
||||
if (context.argsLength() == 0) {
|
||||
if (mask == null) {
|
||||
BBC.BRUSH_MASK_DISABLED.send(player);
|
||||
tool.setMask(null);
|
||||
return;
|
||||
}
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(player);
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.addSetting(BrushSettings.SettingType.MASK, context.getString(context.argsLength() - 1));
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
System.out.println(lastArg + " TODO check this is not the whole command");
|
||||
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
||||
settings.setMask(mask);
|
||||
tool.update();
|
||||
BBC.BRUSH_MASK.send(player);
|
||||
@ -378,29 +379,24 @@ public class BrushOptionsCommands {
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void smask(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The destination mask", def = "")
|
||||
Mask mask,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
return;
|
||||
}
|
||||
if (context.argsLength() == 0) {
|
||||
if (mask == null) {
|
||||
BBC.BRUSH_SOURCE_MASK_DISABLED.send(player);
|
||||
tool.setSourceMask(null);
|
||||
return;
|
||||
}
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(player);
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
Mask mask = worldEdit.getMaskFactory()
|
||||
.parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK,
|
||||
context.getString(context.argsLength() - 1));
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
|
||||
settings.setSourceMask(mask);
|
||||
tool.update();
|
||||
BBC.BRUSH_SOURCE_MASK.send(player);
|
||||
@ -412,27 +408,23 @@ public class BrushOptionsCommands {
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
|
||||
public void transform(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The transform", def = "") ResettableExtent transform,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
return;
|
||||
}
|
||||
if (context.argsLength() == 0) {
|
||||
if (transform == null) {
|
||||
BBC.BRUSH_TRANSFORM_DISABLED.send(player);
|
||||
tool.setTransform(null);
|
||||
return;
|
||||
}
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(player);
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
ResettableExtent transform = Fawe.get().getTransformParser().parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.addSetting(BrushSettings.SettingType.TRANSFORM, context.getString(context.argsLength() - 1));
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.TRANSFORM, lastArg);
|
||||
settings.setTransform(transform);
|
||||
tool.update();
|
||||
BBC.BRUSH_TRANSFORM.send(player);
|
||||
@ -445,23 +437,24 @@ public class BrushOptionsCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.material")
|
||||
public void material(Player player, EditSession editSession, LocalSession session,
|
||||
Pattern pattern,
|
||||
@Arg(desc = "brush material pattern", def = "") Pattern pattern,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
return;
|
||||
}
|
||||
if (context.argsLength() == 0) {
|
||||
BBC.BRUSH_TRANSFORM_DISABLED.send(player);
|
||||
if (pattern == null) {
|
||||
BBC.BRUSH_MATERIAL.send(player);
|
||||
tool.setFill(null);
|
||||
return;
|
||||
}
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, context.getString(context.argsLength() - 1));
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
BBC.BRUSH_MATERIAL.send(player);
|
||||
}
|
||||
|
@ -27,7 +27,9 @@ import com.boydti.fawe.util.CachedTextureUtil;
|
||||
import com.boydti.fawe.util.CleanTextureUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.RandomTextureUtil;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -297,26 +299,28 @@ public class GeneralCommands {
|
||||
desc = "Set the global mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.global-texture")
|
||||
public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "InjectedValueAccess", def = "") InjectedValueAccess context) throws WorldEditException, FileNotFoundException, ParameterException {
|
||||
if (context == null || context.argsLength() == 0) {
|
||||
public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "InjectedValueAccess", def = "") List<String> arguments) throws WorldEditException, FileNotFoundException {
|
||||
// gtexture <randomize> <min=0> <max=100>
|
||||
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
|
||||
if (arguments.isEmpty()) {
|
||||
session.setTextureUtil(null);
|
||||
BBC.TEXTURE_DISABLED.send(player);
|
||||
} else {
|
||||
String arg = context.getString(0);
|
||||
String arg = arguments.get(0);
|
||||
String argLower = arg.toLowerCase();
|
||||
|
||||
TextureUtil util = Fawe.get().getTextureUtil();
|
||||
int randomIndex = 1;
|
||||
boolean checkRandomization = true;
|
||||
if (context.argsLength() >= 2 && MathMan.isInteger(context.getString(0)) && MathMan.isInteger(context.getString(1))) {
|
||||
if (arguments.size() >= 2 && MathMan.isInteger(arguments.get(0)) && MathMan.isInteger(arguments.get(1))) {
|
||||
// complexity
|
||||
int min = Integer.parseInt(context.getString(0));
|
||||
int max = Integer.parseInt(context.getString(1));
|
||||
if (min < 0 || max > 100) throw new ParameterException("Complexity must be in the range 0-100");
|
||||
int min = Integer.parseInt(arguments.get(0));
|
||||
int max = Integer.parseInt(arguments.get(1));
|
||||
if (min < 0 || max > 100) throw new InputParseException("Complexity must be in the range 0-100");
|
||||
if (min != 0 || max != 100) util = new CleanTextureUtil(util, min, max);
|
||||
|
||||
randomIndex = 2;
|
||||
} else if (context.argsLength() == 1 && argLower.equals("true") || argLower.equals("false")) {
|
||||
} else if (arguments.size() == 1 && argLower.equals("true") || argLower.equals("false")) {
|
||||
if (argLower.equals("true")) util = new RandomTextureUtil(util);
|
||||
checkRandomization = false;
|
||||
} else {
|
||||
@ -337,14 +341,14 @@ public class GeneralCommands {
|
||||
}
|
||||
}
|
||||
if (checkRandomization) {
|
||||
if (context.argsLength() > randomIndex) {
|
||||
boolean random = Boolean.parseBoolean(context.getString(randomIndex));
|
||||
if (arguments.size() > randomIndex) {
|
||||
boolean random = Boolean.parseBoolean(arguments.get(randomIndex));
|
||||
if (random) util = new RandomTextureUtil(util);
|
||||
}
|
||||
}
|
||||
if (!(util instanceof CachedTextureUtil)) util = new CachedTextureUtil(util);
|
||||
session.setTextureUtil(util);
|
||||
BBC.TEXTURE_SET.send(player, context.getJoinedStrings(0));
|
||||
BBC.TEXTURE_SET.send(player, StringMan.join(arguments, " "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,28 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.filters.DistrFilter;
|
||||
import com.boydti.fawe.beta.filters.SetFilter;
|
||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -50,7 +33,6 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.GroundFunction;
|
||||
import com.sk89q.worldedit.function.generator.FloraGenerator;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
@ -78,23 +60,27 @@ import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.Regions;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
/**
|
||||
* Commands that operate on regions.
|
||||
*/
|
||||
@ -113,39 +99,6 @@ public class RegionCommands extends MethodCommands {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "debugtest",
|
||||
desc = "debugtest"
|
||||
)
|
||||
@CommandPermissions("fawe.admin.debug")
|
||||
public void debugtest(Player player, @Selection Region region) throws WorldEditException {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
World world = player.getWorld();
|
||||
DistrFilter filter = new DistrFilter();
|
||||
long start = System.currentTimeMillis();
|
||||
queueHandler.apply(world, region, filter);
|
||||
long diff = System.currentTimeMillis() - start;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "db2",
|
||||
desc = "db2"
|
||||
)
|
||||
@CommandPermissions("fawe.admin.debug")
|
||||
public void db2(Player player, @Selection Region region, String blockStr) throws WorldEditException {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
World world = player.getWorld();
|
||||
BlockState block = BlockState.get(blockStr);
|
||||
SetFilter filter = new SetFilter(block);
|
||||
long start = System.currentTimeMillis();
|
||||
queueHandler.apply(world, region, filter);
|
||||
long diff = System.currentTimeMillis() - start;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/fixlighting",
|
||||
desc = "Get the light at a position"
|
||||
@ -366,7 +319,7 @@ public class RegionCommands extends MethodCommands {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
int maxY = max.getBlockY();
|
||||
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
|
||||
Iterator<BlockVector2> iter = new Fast2DIterator(flat, editSession).iterator();
|
||||
Iterator<BlockVector2> iter = flat.iterator();
|
||||
int y = 0;
|
||||
int affected = 0;
|
||||
while (iter.hasNext()) {
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command.composition;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.command.argument.RegionFunctionParser;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.factory.Apply;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.CommandExecutor;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
|
||||
public class ApplyCommand extends SimpleCommand<Contextual<? extends Operation>> {
|
||||
|
||||
private final CommandExecutor<Contextual<? extends RegionFunction>> functionParser;
|
||||
private final String description;
|
||||
|
||||
public ApplyCommand() {
|
||||
this(new RegionFunctionParser(), "Applies a function to every block");
|
||||
}
|
||||
|
||||
public ApplyCommand(CommandExecutor<Contextual<? extends RegionFunction>> functionParser, String description) {
|
||||
checkNotNull(functionParser, "functionParser");
|
||||
checkNotNull(description, "description");
|
||||
this.functionParser = functionParser;
|
||||
this.description = description;
|
||||
addParameter(functionParser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Apply call(CommandArgs args, CommandLocals locals) throws CommandException {
|
||||
Contextual<? extends RegionFunction> function = functionParser.call(args, locals);
|
||||
return new Apply(function);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean testPermission0(CommandLocals locals) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command.composition;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.argument.BooleanFlag;
|
||||
import com.sk89q.worldedit.command.argument.StringParser;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.factory.Deform;
|
||||
import com.sk89q.worldedit.function.factory.Deform.Mode;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.FlagParser.Flag;
|
||||
import com.sk89q.worldedit.util.command.composition.FlagParser.FlagData;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
|
||||
public class DeformCommand extends SimpleCommand<Contextual<? extends Operation>> {
|
||||
|
||||
private final Flag<Boolean> rawCoordsFlag = addFlag('r', new BooleanFlag("Raw coords mode"));
|
||||
private final Flag<Boolean> offsetFlag = addFlag('o', new BooleanFlag("Offset mode"));
|
||||
private final StringParser expressionParser = addParameter(new StringParser("expression", "Expression to apply", "y-=0.2"));
|
||||
|
||||
@Override
|
||||
public Deform call(CommandArgs args, CommandLocals locals) throws CommandException {
|
||||
FlagData flagData = getFlagParser().call(args, locals);
|
||||
String expression = expressionParser.call(args, locals);
|
||||
boolean rawCoords = rawCoordsFlag.get(flagData, false);
|
||||
boolean offset = offsetFlag.get(flagData, false);
|
||||
|
||||
Deform deform = new Deform(expression);
|
||||
|
||||
if (rawCoords) {
|
||||
deform.setMode(Mode.RAW_COORD);
|
||||
} else if (offset) {
|
||||
deform.setMode(Mode.OFFSET);
|
||||
Player player = (Player) locals.get(Actor.class);
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(locals.get(Actor.class));
|
||||
try {
|
||||
deform.setOffset(session.getPlacementPosition(player).toVector3());
|
||||
} catch (IncompleteRegionException e) {
|
||||
throw new WrappedCommandException(e);
|
||||
}
|
||||
} else {
|
||||
deform.setMode(Mode.UNIT_CUBE);
|
||||
}
|
||||
|
||||
return deform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Apply math expression to area";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean testPermission0(CommandLocals locals) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command.composition;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.command.argument.NumberParser;
|
||||
import com.sk89q.worldedit.command.argument.RegionFunctionParser;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.factory.Paint;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.CommandExecutor;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
|
||||
public class PaintCommand extends SimpleCommand<Paint> {
|
||||
|
||||
private final NumberParser densityCommand = addParameter(new NumberParser("density", "0-100", "20"));
|
||||
private final CommandExecutor<? extends Contextual<? extends RegionFunction>> functionParser;
|
||||
|
||||
public PaintCommand() {
|
||||
this(new RegionFunctionParser());
|
||||
}
|
||||
|
||||
public PaintCommand(CommandExecutor<? extends Contextual<? extends RegionFunction>> functionParser) {
|
||||
this.functionParser = functionParser;
|
||||
addParameter(functionParser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paint call(CommandArgs args, CommandLocals locals) throws CommandException {
|
||||
double density = densityCommand.call(args, locals).doubleValue() / 100.0;
|
||||
Contextual<? extends RegionFunction> function = functionParser.call(args, locals);
|
||||
return new Paint(function, density);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Applies a function to surfaces";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean testPermission0(CommandLocals locals) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command.composition;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxBrushRadiusException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.argument.NumberParser;
|
||||
import com.sk89q.worldedit.command.argument.RegionFactoryParser;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
import com.sk89q.worldedit.command.tool.brush.OperationFactoryBrush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.CommandExecutor;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
|
||||
public class ShapedBrushCommand extends SimpleCommand<Object> {
|
||||
|
||||
private final CommandExecutor<? extends Contextual<? extends Operation>> delegate;
|
||||
private final String permission;
|
||||
|
||||
private final RegionFactoryParser regionFactoryParser = addParameter(new RegionFactoryParser());
|
||||
private final NumberParser radiusCommand = addParameter(new NumberParser("size", "The size of the brush", "5"));
|
||||
|
||||
public ShapedBrushCommand(CommandExecutor<? extends Contextual<? extends Operation>> delegate, String permission) {
|
||||
checkNotNull(delegate, "delegate");
|
||||
this.permission = permission;
|
||||
this.delegate = delegate;
|
||||
addParameter(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object call(CommandArgs args, CommandLocals locals) throws CommandException {
|
||||
if (!testPermission(locals)) {
|
||||
throw new CommandPermissionsException();
|
||||
}
|
||||
|
||||
RegionFactory regionFactory = regionFactoryParser.call(args, locals);
|
||||
int radius = radiusCommand.call(args, locals).intValue();
|
||||
Contextual<? extends Operation> factory = delegate.call(args, locals);
|
||||
|
||||
Player player = (Player) locals.get(Actor.class);
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(player);
|
||||
|
||||
try {
|
||||
WorldEdit.getInstance().checkMaxBrushRadius(radius);
|
||||
BrushTool tool = session.getBrushTool(player);
|
||||
tool.setSize(radius);
|
||||
tool.setFill(null);
|
||||
tool.setBrush(new OperationFactoryBrush(factory, regionFactory, session), permission);
|
||||
} catch (MaxBrushRadiusException | InvalidToolBindException e) {
|
||||
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter().convert(e);
|
||||
}
|
||||
|
||||
player.print("Set brush to " + factory);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return delegate.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testPermission0(CommandLocals locals) {
|
||||
Actor sender = locals.get(Actor.class);
|
||||
if (sender == null) {
|
||||
throw new RuntimeException("Uh oh! No 'Actor' specified so that we can check permissions");
|
||||
} else {
|
||||
return sender.hasPermission(permission);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -76,7 +76,7 @@ public class FloodFillTool implements BlockTool {
|
||||
try {
|
||||
Mask mask = initialType.toMask(editSession);
|
||||
BlockReplace function = new BlockReplace(editSession, pattern);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getQueue());
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range);
|
||||
visitor.visit(origin);
|
||||
Operations.completeLegacy(visitor);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
|
@ -78,7 +78,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
final int radius = (int) range;
|
||||
final BlockReplace replace = new BlockReplace(editSession, (BlockTypes.AIR.getDefaultState()));
|
||||
editSession.setMask(null);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new IdMask(editSession), replace, radius, editSession);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new IdMask(editSession), replace, radius);
|
||||
visitor.visit(pos);
|
||||
Operations.completeBlindly(visitor);
|
||||
|
||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -116,6 +117,11 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return getExtent().getWorld();
|
||||
}
|
||||
|
||||
/*
|
||||
Bounds
|
||||
*/
|
||||
|
@ -52,6 +52,7 @@ import com.sk89q.worldedit.registry.state.PropertyGroup;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -496,24 +497,12 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
checkNotNull(block);
|
||||
boolean hasNbt = block instanceof BaseBlock && ((BaseBlock)block).hasNbtData();
|
||||
|
||||
if (canBypassAll(region, false, true) && !hasNbt) {
|
||||
return changes = queue.setBlocks((CuboidRegion) region, block.getInternalId());
|
||||
}
|
||||
try {
|
||||
if (hasExtraExtents()) {
|
||||
RegionVisitor visitor = new RegionVisitor(region, new BlockReplace(getExtent(), (block)), this);
|
||||
Operations.completeBlindly(visitor);
|
||||
this.changes += visitor.getAffected();
|
||||
} else {
|
||||
for (BlockVector3 blockVector3 : region) {
|
||||
if (getExtent().setBlock(blockVector3, block)) {
|
||||
int changes = 0;
|
||||
for (BlockVector3 pos : region) {
|
||||
if (setBlock(pos, block)) {
|
||||
changes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final WorldEditException e) {
|
||||
throw new RuntimeException("Unexpected exception", e);
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
@ -534,10 +523,13 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
if (pattern instanceof BlockStateHolder) {
|
||||
return setBlocks(region, (BlockStateHolder) pattern);
|
||||
}
|
||||
BlockReplace replace = new BlockReplace(this, pattern);
|
||||
RegionVisitor visitor = new RegionVisitor(region, replace, queue instanceof MappedIQueueExtent ? (MappedIQueueExtent) queue : null);
|
||||
Operations.completeBlindly(visitor);
|
||||
return this.changes = visitor.getAffected();
|
||||
int count = 0;
|
||||
for (BlockVector3 pos : region) {
|
||||
if (pattern.apply(this, pos, pos)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -616,9 +608,20 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
}
|
||||
|
||||
default int setBlocks(final Set<BlockVector3> vset, final Pattern pattern) {
|
||||
RegionVisitor visitor = new RegionVisitor(vset, new BlockReplace(getExtent(), pattern));
|
||||
Operations.completeBlindly(visitor);
|
||||
return 0;
|
||||
if (vset instanceof Region) {
|
||||
return setBlocks((Region) vset, pattern);
|
||||
}
|
||||
int count = 0;
|
||||
for (BlockVector3 pos : vset) {
|
||||
if (pattern.apply(this, pos, pos)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
default World getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,177 +0,0 @@
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import com.boydti.fawe.jnbt.anvil.generator.GenBase;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.Resource;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class PassthroughExtent extends AbstractDelegateExtent {
|
||||
private final Extent extent;
|
||||
|
||||
public PassthroughExtent(Extent parent) {
|
||||
super(parent);
|
||||
this.extent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return extent.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return extent.getEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
return extent.createEntity(location, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
||||
return extent.getHighestTerrainBlock(x, z, minY, maxY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
|
||||
return extent.getHighestTerrainBlock(x, z, minY, maxY, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
||||
return extent.getNearestSurfaceLayer(x, z, y, minY, maxY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) {
|
||||
return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
|
||||
return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
|
||||
return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) {
|
||||
return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) {
|
||||
return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCaves(Region region) throws WorldEditException {
|
||||
extent.addCaves(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Region region, GenBase gen) throws WorldEditException {
|
||||
extent.generate(region, gen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException {
|
||||
extent.addSchems(region, mask, clipboards, rarity, rotate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnResource(Region region, Resource gen, int rarity, int frequency) throws WorldEditException {
|
||||
extent.spawnResource(region, gen, rarity, frequency);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(BlockVector3 pt) {
|
||||
return extent.contains(pt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException {
|
||||
extent.addOre(region, mask, material, size, frequency, rarity, minY, maxY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOres(Region region, Mask mask) throws WorldEditException {
|
||||
extent.addOres(region, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Countable<BlockType>> getBlockDistribution(Region region) {
|
||||
return extent.getBlockDistribution(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
|
||||
return extent.getBlockDistributionWithData(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
return extent.lazyCopy(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return extent.getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getBlockType(BlockVector3 position) {
|
||||
return extent.getBlockType(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return extent.getFullBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return extent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||
return extent.setBlock(position, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
return extent.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return extent.setBiome(position, biome);
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ import java.util.UUID;
|
||||
* Stores block data as a multi-dimensional array of {@link BlockState}s and
|
||||
* other data as lists or maps.
|
||||
*/
|
||||
public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable {
|
||||
public class BlockArrayClipboard implements Clipboard, Closeable {
|
||||
|
||||
private Region region;
|
||||
private BlockVector3 origin;
|
||||
@ -260,29 +260,4 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
public Operation commit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLight(int x, int y, int z) {
|
||||
return getBlockLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
return getBrightness(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
return getBlock(x, y, z).getBlockType().getMaterial().getLightOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
return getBlock(x, y, z).getBlockType().getMaterial().getLightValue();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.operation;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.example.MappedIQueueExtent;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.extent.BlockTranslateExtent;
|
||||
import com.boydti.fawe.object.extent.PositionTransformExtent;
|
||||
@ -277,14 +276,6 @@ public class ForwardExtentCopy implements Operation {
|
||||
if (currentTransform == null) {
|
||||
currentTransform = transform;
|
||||
}
|
||||
IQueueExtent queue;
|
||||
if (source instanceof EditSession) {
|
||||
queue = ((EditSession) source).getQueue();
|
||||
} else if (destination instanceof EditSession) {
|
||||
queue = ((EditSession) destination).getQueue();
|
||||
} else {
|
||||
queue = null;
|
||||
}
|
||||
|
||||
Extent finalDest = destination;
|
||||
BlockVector3 translation = to.subtract(from);
|
||||
@ -368,7 +359,7 @@ public class ForwardExtentCopy implements Operation {
|
||||
if (copyingBiomes && (!(source instanceof BlockArrayClipboard) || ((BlockArrayClipboard) source).IMP.hasBiomes())) {
|
||||
copy = CombinedRegionFunction.combine(copy, new BiomeCopy(source, finalDest));
|
||||
}
|
||||
blockCopy = new RegionVisitor(region, copy, queue instanceof MappedIQueueExtent ? (MappedIQueueExtent) queue : null);
|
||||
blockCopy = new RegionVisitor(region, copy);
|
||||
}
|
||||
|
||||
List<? extends Entity> entities;
|
||||
|
@ -20,12 +20,6 @@
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.example.MappedIQueueExtent;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.HasIQueueExtent;
|
||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -35,13 +29,14 @@ import com.sk89q.worldedit.regions.FlatRegion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Applies region functions to columns in a {@link FlatRegion}.
|
||||
*/
|
||||
public class FlatRegionVisitor implements Operation {
|
||||
|
||||
private final FlatRegionFunction function;
|
||||
private MappedIQueueExtent queue;
|
||||
private int affected = 0;
|
||||
private final Iterable<BlockVector2> iterator;
|
||||
|
||||
@ -59,15 +54,6 @@ public class FlatRegionVisitor implements Operation {
|
||||
this.iterator = flatRegion.asFlatRegion();
|
||||
}
|
||||
|
||||
public FlatRegionVisitor(final FlatRegion flatRegion, final FlatRegionFunction function, HasIQueueExtent hasIQueueExtent) {
|
||||
checkNotNull(flatRegion);
|
||||
checkNotNull(function);
|
||||
this.function = function;
|
||||
this.iterator = flatRegion.asFlatRegion();
|
||||
IQueueExtent queue = hasIQueueExtent.getQueue();
|
||||
this.queue = (MappedIQueueExtent) (queue instanceof MappedIQueueExtent ? queue : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of affected objects.
|
||||
*
|
||||
@ -79,20 +65,11 @@ public class FlatRegionVisitor implements Operation {
|
||||
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
if (queue != null) {
|
||||
for (BlockVector2 pt : new Fast2DIterator(iterator, queue)) {
|
||||
if (function.apply(pt)) {
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (BlockVector2 pt : this.iterator) {
|
||||
if (function.apply(pt)) {
|
||||
affected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -277,4 +277,8 @@ public interface World extends Extent {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
default World getWorld() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user