actually delegate in AbstractDelegateExtent

fixes #843
This commit is contained in:
dordsor21 2021-01-14 14:38:37 +00:00
parent af34bd4e57
commit 761d05ac19
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extent; package com.sk89q.worldedit.extent;
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.beta.IBatchProcessor; import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.HistoryExtent; import com.boydti.fawe.object.HistoryExtent;
@ -30,8 +31,10 @@ 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.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.Location; import com.sk89q.worldedit.util.Location;
@ -44,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -275,6 +279,46 @@ public class AbstractDelegateExtent implements Extent {
} }
} }
@Override
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) {
checkNotNull(region);
checkNotNull(block);
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
int changes = 0;
for (BlockVector3 pos : region) {
if (setBlock(pos, block)) {
changes++;
}
}
return changes;
}
@Override
public int setBlocks(Region region, Pattern pattern) {
return getExtent().setBlocks(region, pattern);
}
@Override
public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) {
return getExtent().replaceBlocks(region, filter, replacement);
}
@Override
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) {
return getExtent().replaceBlocks(region, filter, pattern);
}
@Override
public int replaceBlocks(Region region, Mask mask, Pattern pattern) {
return getExtent().replaceBlocks(region, mask, pattern);
}
@Override
public int setBlocks(final Set<BlockVector3> vset, final Pattern pattern) {
return getExtent().setBlocks(vset, pattern);
}
@Override @Override
public int getMaxY() { public int getMaxY() {
return extent.getMaxY(); return extent.getMaxY();
@ -343,4 +387,14 @@ public class AbstractDelegateExtent implements Extent {
protected Operation commitBefore() { protected Operation commitBefore() {
return null; return null;
} }
@Override
public <T extends Filter> T apply(Region region, T filter, boolean full) {
return getExtent().apply(region, filter, full);
}
@Override
public <T extends Filter> T apply(Iterable<BlockVector3> positions, T filter) {
return getExtent().apply(positions, filter);
}
} }