mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Upstream/add missing y variable to generate biome (#824)
* Add the missing y variable to generate biome * Remove unused imports Co-authored-by: Octavia Togami <octavia.togami@gmail.com> Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
parent
e40e86df5f
commit
1b870c5d78
@ -125,8 +125,6 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -148,6 +146,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -3008,23 +3007,21 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||
final String expressionString, final boolean hollow)
|
||||
throws ExpressionException, MaxChangedBlocksException {
|
||||
final String expressionString, final boolean hollow) throws ExpressionException {
|
||||
return makeBiomeShape(region, zero, unit, biomeType, expressionString, hollow, WorldEdit.getInstance().getConfiguration().calculationTimeout);
|
||||
}
|
||||
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||
final String expressionString, final boolean hollow, final int timeout)
|
||||
throws ExpressionException, MaxChangedBlocksException {
|
||||
final String expressionString, final boolean hollow, final int timeout) throws ExpressionException {
|
||||
|
||||
final Expression expression = Expression.compile(expressionString, "x", "z");
|
||||
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
||||
expression.optimize();
|
||||
|
||||
final EditSession editSession = this;
|
||||
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero);
|
||||
expression.setEnvironment(environment);
|
||||
|
||||
final int[] timedOut = {0};
|
||||
AtomicInteger timedOut = new AtomicInteger();
|
||||
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
||||
@Override
|
||||
protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
||||
@ -3041,7 +3038,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
|
||||
return defaultBiomeType;
|
||||
} catch (ExpressionTimeoutException e) {
|
||||
timedOut[0] = timedOut[0] + 1;
|
||||
timedOut.getAndIncrement();
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to create shape", e);
|
||||
@ -3050,10 +3047,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
};
|
||||
int changed = shape.generate(this, biomeType, hollow);
|
||||
if (timedOut[0] > 0) {
|
||||
if (timedOut.get() > 0) {
|
||||
throw new ExpressionTimeoutException(
|
||||
String.format("%d blocks changed. %d blocks took too long to evaluate (increase time with //timeout)",
|
||||
changed, timedOut[0]));
|
||||
String.format("%d biomes changed. %d biomes took too long to evaluate (increase time with //timeout)",
|
||||
changed, timedOut.get()));
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@
|
||||
"worldedit.pumpkins.created": "{0} pumpkin patches created.",
|
||||
"worldedit.pyramid.created": "{0} blocks have been created.",
|
||||
"worldedit.generate.created": "{0} blocks have been created.",
|
||||
"worldedit.generate.changed": "{0} columns affected.",
|
||||
"worldedit.generatebiome.changed": "{0} biomes affected.",
|
||||
|
||||
"worldedit.reload.config": "Configuration reloaded!",
|
||||
"worldedit.report.written": "FAWE report written to {0}",
|
||||
|
Loading…
Reference in New Issue
Block a user