mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Update to PlotSquared-we branch
This commit is contained in:
parent
0bfb1dbdd1
commit
240b2de90c
@ -8,6 +8,7 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -292,7 +293,7 @@ public interface IDelegateQueueExtent extends IQueueExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
default BlockArrayClipboard lazyCopy(Region region) {
|
||||
default Clipboard lazyCopy(Region region) {
|
||||
return getParent().lazyCopy(region);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -699,7 +700,7 @@ public class DelegateFilterBlock extends FilterBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
public Clipboard lazyCopy(Region region) {
|
||||
return parent.lazyCopy(region);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public class BatchProcessorHolder implements IBatchProcessorHolder {
|
||||
private IBatchProcessor processor = EmptyBatchProcessor.INSTANCE;
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.boydti.fawe.beta.implementation.processors;
|
||||
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder implements Extent {
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
join(processor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
return this.addProcessor(changeSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
this.remove(FaweChangeSet.class);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -187,11 +188,10 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard faweClipboard = new WorldCopyClipboard(this, region);
|
||||
BlockArrayClipboard weClipboard = new BlockArrayClipboard(region, faweClipboard);
|
||||
weClipboard.setOrigin(region.getMinimumPoint());
|
||||
return weClipboard;
|
||||
public Clipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard clipboard = new WorldCopyClipboard(() -> this, region);
|
||||
clipboard.setOrigin(region.getMinimumPoint());
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,6 +262,10 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
return new SingleThreadQueueExtent();
|
||||
}
|
||||
|
||||
public void uncache() {
|
||||
queuePool.set(null);
|
||||
}
|
||||
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
public abstract void endSet(boolean parallel);
|
||||
|
@ -15,6 +15,7 @@ import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ReferenceChunk;
|
||||
import com.boydti.fawe.beta.implementation.processors.BatchProcessorHolder;
|
||||
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
|
||||
import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -33,7 +34,7 @@ import java.util.concurrent.Future;
|
||||
* <p>
|
||||
* This queue is reusable {@link #init(IChunkCache)}
|
||||
*/
|
||||
public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQueueExtent {
|
||||
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent {
|
||||
|
||||
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
@ -88,7 +89,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
*/
|
||||
protected synchronized void reset() {
|
||||
if (!this.initialized) return;
|
||||
checkThread();
|
||||
if (!this.chunks.isEmpty()) {
|
||||
for (IChunk chunk : this.chunks.values()) {
|
||||
chunk.recycle();
|
||||
@ -124,23 +124,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
join(processor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
return this.addProcessor(changeSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
this.remove(FaweChangeSet.class);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return chunks.size() + submissions.size();
|
||||
@ -241,8 +224,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
if (chunk != null) {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
checkThread();
|
||||
final int size = chunks.size();
|
||||
final boolean lowMem = MemUtil.isMemoryLimited();
|
||||
if (enabledQueue && (lowMem || size > Settings.IMP.QUEUE.TARGET_SIZE)) {
|
||||
@ -316,7 +297,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
|
||||
@Override
|
||||
public synchronized void flush() {
|
||||
checkThread();
|
||||
if (!chunks.isEmpty()) {
|
||||
if (MemUtil.isMemoryLimited()) {
|
||||
for (IChunk chunk : chunks.values()) {
|
||||
|
@ -15,7 +15,7 @@ public class Settings extends Config {
|
||||
@Ignore
|
||||
public boolean PROTOCOL_SUPPORT_FIX = false;
|
||||
@Ignore
|
||||
public boolean PLOTSQUARED_HOOK = false;
|
||||
public boolean PLOTSQUARED_HOOK = true;
|
||||
|
||||
@Comment("These first 6 aren't configurable") // This is a comment
|
||||
@Final // Indicates that this value isn't configurable
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.boydti.fawe.jnbt.anvil;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.Trimable;
|
||||
import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder;
|
||||
import com.boydti.fawe.jnbt.streamer.StreamDelegate;
|
||||
import com.boydti.fawe.object.RunnableVal4;
|
||||
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
||||
@ -9,7 +12,11 @@ import com.boydti.fawe.object.io.BufferedRandomAccessFile;
|
||||
import com.boydti.fawe.object.io.FastByteArrayInputStream;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@ -34,7 +41,7 @@ import java.util.zip.InflaterInputStream;
|
||||
* e.g.: `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
||||
* Note: This class isn't thread safe. You can use it in an async thread, but not multiple at the same time
|
||||
*/
|
||||
public class MCAFile implements Trimable {
|
||||
public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, Extent {
|
||||
|
||||
private static Field fieldBuf2;
|
||||
private static Field fieldBuf3;
|
||||
@ -145,6 +152,23 @@ public class MCAFile implements Trimable {
|
||||
return init(new File(world.getStoragePath().toFile(), File.separator + "regions" + File.separator + "r." + mcrX + "." + mcrZ + ".mca"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.at(this.X << 9, 0, this.Z << 9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.at((this.X << 9) + 511, FaweCache.IMP.WORLD_MAX_Y, (this.Z << 9) + 511);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||
// final IChunk chunk = getChunk(x >> 4, z >> 4);
|
||||
// return chunk.setTile(x & 15, y, z & 15, tile);
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getIndex(int chunkX, int chunkZ) {
|
||||
return ((chunkX & 31) << 2) + ((chunkZ & 31) << 7);
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.boydti.fawe.jnbt.anvil;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class MCAWorld implements Extent {
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,15 +1,20 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
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.BlockStateHolder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class ReadOnlyClipboard extends SimpleClipboard {
|
||||
public final Region region;
|
||||
@ -19,12 +24,48 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(final Extent editSession, final Region region) {
|
||||
return of(editSession, region, true, false);
|
||||
public static ReadOnlyClipboard of(final Region region) {
|
||||
return of(Request.request().getEditSession(), region);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(final Extent editSession, final Region region, boolean copyEntities, boolean copyBiomes) {
|
||||
return new WorldCopyClipboard(editSession, region, copyEntities, copyBiomes);
|
||||
public static ReadOnlyClipboard of(final Region region, boolean copyEntities, boolean copyBiomes) {
|
||||
EditSession es = Request.request().getEditSession();
|
||||
if (es == null) {
|
||||
throw new IllegalArgumentException("Please provide an EditSession");
|
||||
}
|
||||
return of(es, region, copyEntities, copyBiomes);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Extent extent, final Region region) {
|
||||
Fawe.get().getQueueHandler().uncache();
|
||||
return of(() -> extent, region);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Extent extent, final Region region, boolean copyEntities, boolean copyBiomes) {
|
||||
Fawe.get().getQueueHandler().uncache();
|
||||
return of(() -> extent, region, copyEntities, copyBiomes);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Supplier<Extent> supplier, final Region region) {
|
||||
return of(supplier, region, true, false);
|
||||
}
|
||||
|
||||
public static ReadOnlyClipboard of(Supplier<Extent> supplier, final Region region, boolean copyEntities, boolean copyBiomes) {
|
||||
return new WorldCopyClipboard(supplier, region, copyEntities, copyBiomes);
|
||||
}
|
||||
|
||||
private static Supplier<Extent> supply() {
|
||||
World world = Request.request().getWorld();
|
||||
return () -> {
|
||||
EditSession current = Request.request().getEditSession();
|
||||
if (current != null) {
|
||||
if (current.getWorld().equals(world)) {
|
||||
return current;
|
||||
}
|
||||
throw new UnsupportedOperationException("TODO: Cannot lazy copy accross worlds (bug jesse)");
|
||||
}
|
||||
throw new IllegalStateException("No world");
|
||||
};
|
||||
}
|
||||
|
||||
public Region getRegion() {
|
||||
|
@ -1,41 +1,30 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
public final int mx, my, mz;
|
||||
private final boolean hasBiomes;
|
||||
private final boolean hasEntities;
|
||||
private MutableBlockVector2 MutableBlockVector2 = new MutableBlockVector2();
|
||||
public final Extent extent;
|
||||
private Extent extent;
|
||||
private Supplier<Extent> supplier;
|
||||
|
||||
public WorldCopyClipboard(Extent editSession, Region region) {
|
||||
this(editSession, region, true, false);
|
||||
public WorldCopyClipboard(Supplier<Extent> supplier, Region region) {
|
||||
this(supplier, region, true, false);
|
||||
}
|
||||
|
||||
public WorldCopyClipboard(Extent editSession, Region region, boolean hasEntities, boolean hasBiomes) {
|
||||
public WorldCopyClipboard(Supplier<Extent> supplier, Region region, boolean hasEntities, boolean hasBiomes) {
|
||||
super(region);
|
||||
this.hasBiomes = hasBiomes;
|
||||
this.hasEntities = hasEntities;
|
||||
@ -43,27 +32,37 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.extent = editSession;
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
public Extent getExtent() {
|
||||
if (extent != null) {
|
||||
return extent;
|
||||
}
|
||||
extent = supplier.get();
|
||||
supplier = null;
|
||||
return extent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
return extent.getFullBlock(BlockVector3.at(mx + x, my + y, mz + z));
|
||||
return getExtent().getFullBlock(mx + x, my + y, mz + z);
|
||||
}
|
||||
|
||||
public BaseBlock getBlockAbs(int x, int y, int z) {
|
||||
return extent.getFullBlock(BlockVector3.at(x, y, z));
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return getExtent().getBlock(mx + x, my + y, mz + z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int z) {
|
||||
return extent.getBiome(MutableBlockVector2.setComponents(mx + x, mz + z));
|
||||
return getExtent().getBiomeType(mx + x, mz + z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
if (!hasEntities) return new ArrayList<>();
|
||||
return extent.getEntities(getRegion());
|
||||
return getExtent().getEntities(getRegion());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,20 +1,24 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class WorldCutClipboard extends WorldCopyClipboard {
|
||||
public WorldCutClipboard(EditSession editSession, Region region, boolean copyEntities, boolean copyBiome) {
|
||||
super(editSession, region, copyEntities, copyBiome);
|
||||
public WorldCutClipboard(Supplier<Extent> supplier, Region region) {
|
||||
super(supplier, region);
|
||||
}
|
||||
|
||||
public WorldCutClipboard(EditSession editSession, Region region) {
|
||||
super(editSession, region);
|
||||
public WorldCutClipboard(Supplier<Extent> supplier, Region region, boolean hasEntities, boolean hasBiomes) {
|
||||
super(supplier, region, hasEntities, hasBiomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -22,22 +26,34 @@ public class WorldCutClipboard extends WorldCopyClipboard {
|
||||
int xx = mx + x;
|
||||
int yy = my + y;
|
||||
int zz = mz + z;
|
||||
BaseBlock block = extent.getFullBlock(BlockVector3.at(xx, yy, zz));
|
||||
Extent extent = getExtent();
|
||||
BaseBlock block = extent.getFullBlock(xx, yy, zz);
|
||||
extent.setBlock(xx, yy, zz, BlockTypes.AIR.getDefaultState());
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getBlockAbs(int x, int y, int z) {
|
||||
BaseBlock block = extent.getFullBlock(BlockVector3.at(x, y, z));
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
int xx = mx + x;
|
||||
int yy = my + y;
|
||||
int zz = mz + z;
|
||||
Extent extent = getExtent();
|
||||
BlockState block = extent.getBlock(xx, yy, zz);
|
||||
extent.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
Extent extent = getExtent();
|
||||
if (extent instanceof EditSession) {
|
||||
((EditSession) extent).flushQueue();
|
||||
} else if (extent instanceof Closeable) {
|
||||
try {
|
||||
((Closeable) extent).close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
extent.commit();
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ public final class MemBlockSet extends BlockSet {
|
||||
}
|
||||
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.at(getMinX(), getMinY(), getMinZ());
|
||||
return BlockVector3.at(getMinX(), getMinimumY(), getMinZ());
|
||||
}
|
||||
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.at(getMaxX(), getMaxY(), getMaxZ());
|
||||
return BlockVector3.at(getMaxX(), getMaximumY(), getMaxZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -280,7 +280,7 @@ public final class MemBlockSet extends BlockSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
public int getMinimumY() {
|
||||
int maxY = 15;
|
||||
int maxy = 16;
|
||||
int by = Integer.MAX_VALUE;
|
||||
@ -325,7 +325,7 @@ public final class MemBlockSet extends BlockSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
public int getMaximumY() {
|
||||
int maxY = 0;
|
||||
int maxy = 0;
|
||||
int by = Integer.MIN_VALUE;
|
||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.regions.general.integrations.plotquared;
|
||||
|
||||
import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
@ -10,6 +9,7 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -29,12 +29,12 @@ public class FaweChunkManager extends ChunkManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture loadChunk(String world, ChunkLoc loc, boolean force) {
|
||||
public CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force) {
|
||||
return parent.loadChunk(world, loc, force);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadChunk(String world, ChunkLoc loc, boolean save) {
|
||||
public void unloadChunk(String world, BlockVector2 loc, boolean save) {
|
||||
parent.unloadChunk(world, loc, save);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -71,8 +70,8 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(final int x, final int y, final int z, final PlotBlock id) {
|
||||
return setBlock(x, y, z, legacyMapper.getBaseBlockFromPlotBlock(id));
|
||||
public boolean setBlock(final int x, final int y, final int z, final BlockState id) {
|
||||
return setBlock(x, y, z, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,9 +80,8 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotBlock getBlock(int x, int y, int z) {
|
||||
BlockState block = IMP.getBlock(x, y, z);
|
||||
return PlotBlock.get(block.toBaseBlock());
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return IMP.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
private BiomeType biome;
|
||||
|
@ -8,7 +8,6 @@ import com.boydti.fawe.util.IOUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
@ -47,7 +46,7 @@ public class FaweSchematicHandler extends SchematicHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCompoundTag(final String world, final Set<RegionWrapper> regions, final RunnableVal<CompoundTag> whenDone) {
|
||||
public void getCompoundTag(final String world, final Set<CuboidRegion> regions, final RunnableVal<CompoundTag> whenDone) {
|
||||
TaskManager.IMP.async(() -> {
|
||||
Location[] corners = MainUtil.getCorners(world, regions);
|
||||
Location pos1 = corners[0];
|
||||
|
@ -12,7 +12,6 @@ import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -22,14 +21,13 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
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.registry.BiomeRegistry;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@ -56,7 +54,7 @@ public class PlotSetBiome extends Command {
|
||||
return null;
|
||||
}
|
||||
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
||||
final HashSet<RegionWrapper> regions = plot.getRegions();
|
||||
final Set<CuboidRegion> regions = plot.getRegions();
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
||||
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
||||
@ -81,9 +79,8 @@ public class PlotSetBiome extends Command {
|
||||
.limitUnlimited()
|
||||
.build();
|
||||
long seed = ThreadLocalRandom.current().nextLong();
|
||||
for (RegionWrapper region : regions) {
|
||||
CuboidRegion cuboid = new CuboidRegion(BlockVector3.at(region.minX, 0, region.minZ), BlockVector3.at(region.maxX, 256, region.maxZ));
|
||||
session.regenerate(cuboid, biome, seed);
|
||||
for (CuboidRegion region : regions) {
|
||||
session.regenerate(region, biome, seed);
|
||||
}
|
||||
session.flushQueue();
|
||||
plot.removeRunning();
|
||||
|
@ -15,7 +15,6 @@ import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
@ -29,6 +28,7 @@ import com.sk89q.worldedit.regions.RegionIntersection;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -47,7 +47,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
}
|
||||
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
||||
new PlotSetBiome();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: revisit this later on
|
||||
/*
|
||||
@ -107,7 +107,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
@Override
|
||||
public FaweMask getMask(Player player, MaskType type) {
|
||||
final PlotPlayer pp = PlotPlayer.wrap(player);
|
||||
final HashSet<RegionWrapper> regions;
|
||||
final Set<CuboidRegion> regions;
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
if (isAllowed(player, plot, type)) {
|
||||
regions = plot.getRegions();
|
||||
@ -115,8 +115,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
plot = null;
|
||||
regions = WEManager.getMask(pp);
|
||||
if (regions.size() == 1) {
|
||||
RegionWrapper region = regions.iterator().next();
|
||||
if (region.minX == Integer.MIN_VALUE && region.maxX == Integer.MAX_VALUE) {
|
||||
CuboidRegion region = regions.iterator().next();
|
||||
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE && region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
||||
regions.clear();
|
||||
}
|
||||
}
|
||||
@ -128,12 +128,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
int min = area != null ? area.MIN_BUILD_HEIGHT : 0;
|
||||
int max = area != null ? Math.min(255, area.MAX_BUILD_HEIGHT) : 255;
|
||||
final HashSet<com.boydti.fawe.object.RegionWrapper> faweRegions = new HashSet<>();
|
||||
for (RegionWrapper current : regions) {
|
||||
faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.minX, current.maxX, min, max, current.minZ, current.maxZ));
|
||||
for (CuboidRegion current : regions) {
|
||||
faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.getMinimumX(), current.getMaximumX(), min, max, current.getMinimumZ(), current.getMaximumZ()));
|
||||
}
|
||||
final RegionWrapper region = regions.iterator().next();
|
||||
final BlockVector3 pos1 = BlockVector3.at(region.minX, min, region.minZ);
|
||||
final BlockVector3 pos2 = BlockVector3.at(region.maxX, max, region.maxZ);
|
||||
final CuboidRegion region = regions.iterator().next();
|
||||
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
||||
final BlockVector3 pos2 = BlockVector3.at(region.getMaximumX(), max, region.getMaximumZ());
|
||||
final Plot finalPlot = plot;
|
||||
if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot) || regions.isEmpty()) {
|
||||
return null;
|
||||
@ -145,7 +145,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
} else {
|
||||
World world = FaweAPI.getWorld(area.worldname);
|
||||
List<Region> weRegions = regions.stream()
|
||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.minX, r.minY, r.minZ), BlockVector3.at(r.maxX, r.maxY, r.maxZ)))
|
||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
||||
.collect(Collectors.toList());
|
||||
maskedRegion = new RegionIntersection(world, weRegions);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.PasteEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||
@ -69,6 +70,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -86,6 +88,7 @@ import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@ -186,7 +189,7 @@ public class ClipboardCommands {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
session.setClipboard(null);
|
||||
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes);
|
||||
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(region, !skipEntities, copyBiomes);
|
||||
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
||||
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
@ -197,37 +200,37 @@ public class ClipboardCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/lazycut",
|
||||
desc = "Lazily cut the selection to the clipboard"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.lazycut")
|
||||
public void lazyCut(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Selection final Region region,
|
||||
@Switch(name = 'e', desc = "Skip copy entities")
|
||||
boolean skipEntities,
|
||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||
Mask maskOpt,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw FaweCache.MAX_CHANGES;
|
||||
}
|
||||
session.setClipboard(null);
|
||||
|
||||
ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
||||
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
BBC.COMMAND_CUT_LAZY.send(actor, region.getArea());
|
||||
}
|
||||
// @Command(
|
||||
// name = "/lazycut",
|
||||
// desc = "Lazily cut the selection to the clipboard"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.clipboard.lazycut")
|
||||
// public void lazyCut(Actor actor, LocalSession session, EditSession editSession,
|
||||
// @Selection final Region region,
|
||||
// @Switch(name = 'e', desc = "Skip copy entities")
|
||||
// boolean skipEntities,
|
||||
// @ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||
// Mask maskOpt,
|
||||
// @Switch(name = 'b', desc = "Also copy biomes")
|
||||
// boolean copyBiomes) throws WorldEditException {
|
||||
// BlockVector3 min = region.getMinimumPoint();
|
||||
// BlockVector3 max = region.getMaximumPoint();
|
||||
// long volume = ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
// FaweLimit limit = actor.getLimit();
|
||||
// if (volume >= limit.MAX_CHECKS) {
|
||||
// throw FaweCache.MAX_CHECKS;
|
||||
// }
|
||||
// if (volume >= limit.MAX_CHANGES) {
|
||||
// throw FaweCache.MAX_CHANGES;
|
||||
// }
|
||||
// session.setClipboard(null);
|
||||
//
|
||||
// ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||
// BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
||||
// clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
// session.setClipboard(new ClipboardHolder(clipboard));
|
||||
// BBC.COMMAND_CUT_LAZY.send(actor, region.getArea());
|
||||
// }
|
||||
|
||||
@Command(
|
||||
name = "/cut",
|
||||
|
@ -72,6 +72,10 @@ 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.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -146,13 +150,13 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.test")
|
||||
@Logging(REGION)
|
||||
public void test(World world, Player player, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||
editSession.addProcessor(new ChunkSendProcessor(world, () -> Stream.of(player)));
|
||||
editSession.addProcessor(NullProcessor.INSTANCE);
|
||||
editSession.setBlocks(region, pattern);
|
||||
public void test(Player player, @Arg(desc = "hello there") String message) throws WorldEditException {
|
||||
|
||||
TextComponent test = LegacyComponentSerializer.legacy().deserialize(message, '&');
|
||||
player.print(message);
|
||||
player.print(test);
|
||||
test = test.hoverEvent(HoverEvent.showText(TextComponent.of("Blah")));
|
||||
player.print(test);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -32,6 +32,7 @@ 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.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.RegionMaskingFilter;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.generator.CavesGen;
|
||||
@ -465,11 +466,10 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
* @param region
|
||||
* @return
|
||||
*/
|
||||
default BlockArrayClipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard faweClipboard = new WorldCopyClipboard(this, region);
|
||||
BlockArrayClipboard weClipboard = new BlockArrayClipboard(region, faweClipboard);
|
||||
weClipboard.setOrigin(region.getMinimumPoint());
|
||||
return weClipboard;
|
||||
default Clipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard faweClipboard = new WorldCopyClipboard(() -> this, region);
|
||||
faweClipboard.setOrigin(region.getMinimumPoint());
|
||||
return faweClipboard;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -133,7 +134,7 @@ public class PassthroughExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
public Clipboard lazyCopy(Region region) {
|
||||
return getExtent().lazyCopy(region);
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
if (pos1 == null || pos2 == null) {
|
||||
return;
|
||||
}
|
||||
pos1 = pos1.clampY(world == null ? Integer.MIN_VALUE : 0, world == null ? Integer.MAX_VALUE : world.getMaxY());
|
||||
pos2 = pos2.clampY(world == null ? Integer.MIN_VALUE : 0, world == null ? Integer.MAX_VALUE : world.getMaxY());
|
||||
pos1 = pos1.clampY(world == null ? 0 : 0, world == null ? FaweCache.IMP.WORLD_MAX_Y : world.getMaxY());
|
||||
pos2 = pos2.clampY(world == null ? 0 : 0, world == null ? FaweCache.IMP.WORLD_MAX_Y : world.getMaxY());
|
||||
minX = Math.min(pos1.getX(), pos2.getX());
|
||||
minY = Math.min(pos1.getY(), pos2.getY());
|
||||
minZ = Math.min(pos1.getZ(), pos2.getZ());
|
||||
@ -196,16 +196,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
return max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumY() {
|
||||
return minY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumY() {
|
||||
return maxY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(BlockVector3... changes) {
|
||||
checkNotNull(changes);
|
||||
@ -655,15 +645,31 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
public int getMinimumY() {
|
||||
return minY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
public int getMaximumY() {
|
||||
return maxY;
|
||||
}
|
||||
|
||||
public int getMinimumX() {
|
||||
return minX;
|
||||
}
|
||||
|
||||
public int getMinimumZ() {
|
||||
return minZ;
|
||||
}
|
||||
|
||||
public int getMaximumX() {
|
||||
return maxX;
|
||||
}
|
||||
|
||||
public int getMaximumZ() {
|
||||
return maxZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set) {
|
||||
int chunkX = chunk.getX();
|
||||
|
@ -385,16 +385,6 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
return Polygons.polygonizeCylinder(center, radius, maxPoints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
return minY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return maxY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new instance with the given center and radius in the X and Z
|
||||
* axes with a Y that extends from the bottom of the extent to the top
|
||||
|
@ -195,17 +195,17 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
||||
*/
|
||||
List<BlockVector2> polygonize(int maxPoints);
|
||||
|
||||
default int getMinY() {
|
||||
default int getMinimumY() {
|
||||
return getMinimumPoint().getY();
|
||||
}
|
||||
|
||||
default int getMaxY() {
|
||||
default int getMaximumY() {
|
||||
return getMaximumPoint().getY();
|
||||
}
|
||||
|
||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set) {
|
||||
int minSection = Math.max(0, getMinY() >> 4);
|
||||
int maxSection = Math.min(15, getMaxY() >> 4);
|
||||
int minSection = Math.max(0, getMinimumY() >> 4);
|
||||
int maxSection = Math.min(15, getMaximumY() >> 4);
|
||||
for (int layer = minSection; layer <= maxSection; layer++) {
|
||||
if (!get.hasSection(layer) || !filter.appliesLayer(chunk, layer)) return;
|
||||
block = block.init(get, set, layer);
|
||||
|
@ -19,9 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.LegacyPlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.io.Resources;
|
||||
@ -244,29 +241,6 @@ public final class LegacyMapper {
|
||||
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
|
||||
}
|
||||
|
||||
public BaseBlock getBaseBlockFromPlotBlock(PlotBlock plotBlock) {
|
||||
if(plotBlock instanceof StringPlotBlock) {
|
||||
try {
|
||||
return BlockTypes.get(plotBlock.toString()).getDefaultState().toBaseBlock();
|
||||
} catch (Throwable failed) {
|
||||
log.error("Unable to convert StringPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
failed.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}else if(plotBlock instanceof LegacyPlotBlock) {
|
||||
try {
|
||||
return BaseBlock.getState(((LegacyPlotBlock)plotBlock).getId(), ((LegacyPlotBlock)plotBlock).getData()).toBaseBlock();
|
||||
} catch (Throwable failed) {
|
||||
log.error("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
failed.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
log.error("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final static LegacyMapper getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user