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