commanding-pipeline diff

This commit is contained in:
Jesse Boyd
2019-10-23 05:23:52 +01:00
parent fb91456bdd
commit 2080e9786b
193 changed files with 5449 additions and 3491 deletions

View File

@ -22,6 +22,7 @@ package com.sk89q.worldedit.extent;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.object.HistoryExtent;
import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.boydti.fawe.object.exception.FaweException;
@ -262,4 +263,22 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
return null;
}
}
@Override
public Extent addProcessor(IBatchProcessor processor) {
Extent result = this.extent.addProcessor(processor);
if (result != this.extent) {
new ExtentTraverser<Extent>(this).setNext(result);
}
return this;
}
@Override
public Extent disableHistory() {
Extent result = this.extent.disableHistory();
if (result != this.extent) {
new ExtentTraverser<Extent>(this).setNext(result);
}
return this;
}
}

View File

@ -19,6 +19,9 @@
package com.sk89q.worldedit.extent;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.object.HistoryExtent;
import com.boydti.fawe.object.changeset.FaweChangeSet;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
@ -629,4 +632,21 @@ public interface Extent extends InputExtent, OutputExtent {
return count;
}
/**
* Have an extent processed
* - Either block (Extent) processing or chunk processing
* @param processor
* @return processed Extent
*/
default Extent addProcessor(IBatchProcessor processor) {
return processor.construct(this);
}
default Extent enableHistory(FaweChangeSet changeSet) {
return addProcessor(changeSet);
}
default Extent disableHistory() {
return this;
}
}

View File

@ -24,6 +24,8 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -53,9 +55,14 @@ public interface OutputExtent {
* @deprecated It is recommended that you use {@link #setBlock(int, int, int, BlockStateHolder)} in FAWE
*/
@Deprecated
<T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException;
default <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
return setBlock(position.getX(), position.getY(), position.getZ(), block);
}
<T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException;
// The defaults need to remain for compatibility (the actual implementation still needs to override one of these)
default <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
return setBlock(MutableBlockVector3.get(x, y, z), block);
}
boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException;
@ -66,9 +73,14 @@ public interface OutputExtent {
* @param biome the biome to set to
* @return true if the biome was successfully set (return value may not be accurate)
*/
boolean setBiome(BlockVector2 position, BiomeType biome);
default boolean setBiome(BlockVector2 position, BiomeType biome) {
return setBiome(position.getX(), 0, position.getBlockZ(), biome);
}
boolean setBiome(int x, int y, int z, BiomeType biome);
// The defaults need to remain for compatibility (the actual implementation still needs to override one of these)
default boolean setBiome(int x, int y, int z, BiomeType biome) {
return setBiome(MutableBlockVector2.get(x, z), biome);
}
/**
* Return an {@link Operation} that should be called to tie up loose ends

View File

@ -1,5 +1,7 @@
package com.sk89q.worldedit.extent;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
@ -68,23 +70,6 @@ public class PassthroughExtent extends AbstractDelegateExtent {
getExtent().removeEntity(x, y, z, uuid);
}
public boolean isQueueEnabled() {
return getExtent().isQueueEnabled();
}
public void enableQueue() {
getExtent().enableQueue();
}
public void disableQueue() {
getExtent().disableQueue();
}
@Override
public boolean isWorld() {
return getExtent().isWorld();
}
@Override
public boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed) {
return getExtent().regenerateChunk(x, z, type, seed);
@ -175,17 +160,6 @@ public class PassthroughExtent extends AbstractDelegateExtent {
return getExtent().getBlockDistributionWithData(region);
}
@Override
@Nullable
public Operation commit() {
return getExtent().commit();
}
@Override
public boolean cancel() {
return getExtent().cancel();
}
@Override
public int getMaxY() {
return getExtent().getMaxY();
@ -292,4 +266,46 @@ public class PassthroughExtent extends AbstractDelegateExtent {
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return getExtent().setBiome(x, y, z, biome);
}
// special
public Extent disableHistory() {
return super.disableHistory();
}
@Override
public Extent addProcessor(IBatchProcessor processor) {
return super.addProcessor(processor);
}
public Extent enableHistory(FaweChangeSet changeSet) {
return super.enableHistory(changeSet);
}
@Override
@Nullable
public Operation commit() {
return getExtent().commit();
}
@Override
public boolean cancel() {
return getExtent().cancel();
}
public boolean isQueueEnabled() {
return getExtent().isQueueEnabled();
}
public void enableQueue() {
getExtent().enableQueue();
}
public void disableQueue() {
getExtent().disableQueue();
}
@Override
public boolean isWorld() {
return getExtent().isWorld();
}
}