3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 01:40:06 +01:00

fix: correct the delegated methods in AbstractDelegateExtent (#2365)

- Not all methods should be overridden: we need to keep delegating-to-setblock methods in parent classes
Dieser Commit ist enthalten in:
Jordan 2023-12-21 13:11:44 +00:00 committet von GitHub
Ursprung 2f92626433
Commit 28ab5662fd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -25,27 +25,34 @@ import com.fastasyncworldedit.core.extent.HistoryExtent;
import com.fastasyncworldedit.core.extent.NullExtent; import com.fastasyncworldedit.core.extent.NullExtent;
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.queue.IBatchProcessor;
import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.ExtentTraverser;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer; import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.OperationQueue;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -168,6 +175,7 @@ public class AbstractDelegateExtent implements Extent {
} }
} }
//FAWE start
@Override @Override
public boolean cancel() { public boolean cancel() {
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this); ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
@ -188,7 +196,6 @@ public class AbstractDelegateExtent implements Extent {
return true; return true;
} }
//FAWE start
@Override @Override
public void removeEntity(int x, int y, int z, UUID uuid) { public void removeEntity(int x, int y, int z, UUID uuid) {
extent.removeEntity(x, y, z, uuid); extent.removeEntity(x, y, z, uuid);
@ -225,11 +232,72 @@ public class AbstractDelegateExtent implements Extent {
} }
} }
@Override
public boolean isWorld() {
return extent.isWorld();
}
@Override
public List<Countable<BlockType>> getBlockDistribution(final Region region) {
return extent.getBlockDistribution(region);
}
@Override
public List<Countable<BlockState>> getBlockDistributionWithData(final Region region) {
return extent.getBlockDistributionWithData(region);
}
@Override @Override
public int getMaxY() { public int getMaxY() {
return extent.getMaxY(); return extent.getMaxY();
} }
@Override
public int countBlocks(final Region region, final Set<BaseBlock> searchBlocks) {
return extent.countBlocks(region, searchBlocks);
}
@Override
public int countBlocks(final Region region, final Mask searchMask) {
return extent.countBlocks(region, searchMask);
}
@Override
public <B extends BlockStateHolder<B>> int setBlocks(final Region region, final B block) throws MaxChangedBlocksException {
return extent.setBlocks(region, block);
}
@Override
public int setBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
return extent.setBlocks(region, pattern);
}
@Override
public <B extends BlockStateHolder<B>> int replaceBlocks(
final Region region,
final Set<BaseBlock> filter,
final B replacement
)
throws MaxChangedBlocksException {
return extent.replaceBlocks(region, filter, replacement);
}
@Override
public int replaceBlocks(final Region region, final Set<BaseBlock> filter, final Pattern pattern) throws
MaxChangedBlocksException {
return extent.replaceBlocks(region, filter, pattern);
}
@Override
public int replaceBlocks(final Region region, final Mask mask, final Pattern pattern) throws MaxChangedBlocksException {
return extent.replaceBlocks(region, mask, pattern);
}
@Override
public int setBlocks(final Set<BlockVector3> vset, final Pattern pattern) {
return extent.setBlocks(vset, pattern);
}
@Override @Override
public int getMinY() { public int getMinY() {
return extent.getMinY(); return extent.getMinY();
@ -295,23 +363,29 @@ public class AbstractDelegateExtent implements Extent {
return this; return this;
} }
@Override
public <T extends Filter> T apply(final Region region, final T filter, final boolean full) {
return extent.apply(region, filter, full);
}
//FAWE end
protected Operation commitBefore() { protected Operation commitBefore() {
return null; return null;
} }
@Override
public BiomeType getBiome(BlockVector3 position) {
//FAWE start - switch top x,y,z
return extent.getBiomeType(position.getX(), position.getY(), position.getZ());
//FAWE end
}
//FAWE start
@Override @Override
public BiomeType getBiomeType(int x, int y, int z) { public BiomeType getBiomeType(int x, int y, int z) {
return extent.getBiomeType(x, y, z); return extent.getBiomeType(x, y, z);
} }
@Override
public BiomeType getBiome(BlockVector3 position) {
return extent.getBiome(position);
}
/*
History
*/
@Override @Override
public int getEmittedLight(int x, int y, int z) { public int getEmittedLight(int x, int y, int z) {
return extent.getEmittedLight(x, y, z); return extent.getEmittedLight(x, y, z);
@ -341,13 +415,17 @@ public class AbstractDelegateExtent implements Extent {
new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet)); new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet));
} }
} }
//FAWE end
@Override @Override
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
throws WorldEditException { throws WorldEditException {
//FAWE start - switch to x,y,z
return extent.setBlock(position.getX(), position.getY(), position.getZ(), block); return extent.setBlock(position.getX(), position.getY(), position.getZ(), block);
//FAWE end
} }
//FAWE start
@Override @Override
public <T extends BlockStateHolder<T>> boolean setBlock( public <T extends BlockStateHolder<T>> boolean setBlock(
int x, int y, int x, int y,
@ -360,6 +438,7 @@ public class AbstractDelegateExtent implements Extent {
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile)); return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile));
} }
//FAWE end
@Override @Override
public boolean fullySupports3DBiomes() { public boolean fullySupports3DBiomes() {
@ -367,13 +446,16 @@ public class AbstractDelegateExtent implements Extent {
} }
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
return extent.setBiome(x, y, z, biome); //FAWE start - switch to x,y,z
return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome);
//FAWE end
} }
//FAWE start
@Override @Override
public boolean setBiome(BlockVector3 position, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome); return extent.setBiome(x, y, z, biome);
} }
@Override @Override