Fix stack outside region
This commit is contained in:
parent
32808dfc81
commit
a080735b83
@ -28,7 +28,7 @@ ext {
|
||||
date = git.head().date.format("yy.MM.dd")
|
||||
revision = "-${git.head().abbreviatedId}"
|
||||
parents = git.head().parentIds;
|
||||
index = -72; // Offset to mach CI
|
||||
index = -73; // Offset to mach CI
|
||||
int major, minor, patch;
|
||||
major = minor = patch = 0;
|
||||
for (;parents != null && !parents.isEmpty();index++) {
|
||||
|
@ -82,6 +82,11 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ":" + queue + "(" + getExtent() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(final Vector2D position) {
|
||||
return FaweCache.CACHE_BIOME[queue.getBiomeId(position.getBlockX(), position.getBlockZ())];
|
||||
|
@ -58,6 +58,11 @@ public class NullExtent extends FaweRegionExtent {
|
||||
throw new FaweException(reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
|
||||
throw new FaweException(reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getLazyBlock(int x, int y, int z) {
|
||||
throw new FaweException(reason);
|
||||
|
@ -25,7 +25,10 @@ public class WEManager {
|
||||
try {
|
||||
final Field field = AbstractDelegateExtent.class.getDeclaredField("extent");
|
||||
field.setAccessible(true);
|
||||
Object currentExtent = field.get(parent);
|
||||
if (!(currentExtent instanceof NullExtent)) {
|
||||
field.set(parent, new NullExtent((Extent) field.get(parent), reason));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
|
@ -420,7 +420,8 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
NullExtent nullExtent = new NullExtent(world, BBC.WORLDEDIT_CANCEL_REASON_MANUAL);
|
||||
while (traverser != null) {
|
||||
ExtentTraverser next = traverser.next();
|
||||
if (traverser.get() instanceof AbstractDelegateExtent) {
|
||||
Extent get = traverser.get();
|
||||
if (get instanceof AbstractDelegateExtent && !(get instanceof NullExtent)) {
|
||||
traverser.setNext(nullExtent);
|
||||
}
|
||||
traverser = next;
|
||||
@ -813,6 +814,11 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ":" + extent.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of blocks changed, including repeated block changes.
|
||||
*
|
||||
@ -863,6 +869,7 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
@Override
|
||||
public BaseBlock getLazyBlock(final Vector position) {
|
||||
if (position.getY() > maxY || position.getY() < 0) {
|
||||
if (!limit.MAX_FAILS()) throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
return nullBlock;
|
||||
}
|
||||
return getLazyBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
@ -879,6 +886,7 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
@Override
|
||||
public BaseBlock getBlock(final Vector position) {
|
||||
if (position.getY() > maxY || position.getY() < 0) {
|
||||
if (!limit.MAX_FAILS()) throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
return nullBlock;
|
||||
}
|
||||
return getLazyBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
@ -1167,8 +1175,8 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
*
|
||||
* @param position the position
|
||||
* @param block the block
|
||||
* @param probability a probability between 0 and 1, inclusive
|
||||
* @return whether a block was changed
|
||||
* @param probability a probability between 0 and 1, inclusive
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
public boolean setChanceBlockIfAir(final Vector position, final BaseBlock block, final double probability) throws MaxChangedBlocksException {
|
||||
|
@ -181,6 +181,11 @@ public abstract class AbstractDelegateExtent implements LightingExtent {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ":" + extent.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final @Nullable Operation commit() {
|
||||
Operation ours = commitBefore();
|
||||
|
@ -252,11 +252,12 @@ public class ForwardExtentCopy implements Operation {
|
||||
List<? extends Entity> entities = source.getEntities(region);
|
||||
|
||||
for (int i = 0; i < repetitions; i++) {
|
||||
Operations.completeBlindly(blockVisitor);
|
||||
|
||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
||||
entityCopy.setRemoving(removingEntities);
|
||||
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
||||
|
||||
Operations.completeBlindly(blockVisitor);
|
||||
Operations.completeBlindly(entityVisitor);
|
||||
|
||||
if (transExt != null) {
|
||||
|
@ -24,6 +24,7 @@ import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.example.MappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
@ -159,12 +160,16 @@ public class RegionVisitor implements Operation {
|
||||
apply(trailIter.next());
|
||||
apply(trailIter.next());
|
||||
}
|
||||
} catch (FaweException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Throwable ignore) {}
|
||||
try {
|
||||
for (;;) {
|
||||
apply(trailIter.next());
|
||||
apply(trailIter.next());
|
||||
}
|
||||
} catch (FaweException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Throwable ignore) {}
|
||||
} else {
|
||||
for (Vector pt : iterable) {
|
||||
|
Loading…
Reference in New Issue
Block a user