mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Add the missing y variable to generate biome
This commit is contained in:
parent
4999018f36
commit
cc1f530aa4
@ -135,6 +135,7 @@
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -2640,23 +2641,21 @@ private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||||
final String expressionString, final boolean hollow)
|
final String expressionString, final boolean hollow) throws ExpressionException {
|
||||||
throws ExpressionException, MaxChangedBlocksException {
|
|
||||||
return makeBiomeShape(region, zero, unit, biomeType, expressionString, hollow, WorldEdit.getInstance().getConfiguration().calculationTimeout);
|
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,
|
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||||
final String expressionString, final boolean hollow, final int timeout)
|
final String expressionString, final boolean hollow, final int timeout) throws ExpressionException {
|
||||||
throws ExpressionException, MaxChangedBlocksException {
|
|
||||||
|
|
||||||
final Expression expression = Expression.compile(expressionString, "x", "z");
|
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
||||||
expression.optimize();
|
expression.optimize();
|
||||||
|
|
||||||
final EditSession editSession = this;
|
final EditSession editSession = this;
|
||||||
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero);
|
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero);
|
||||||
expression.setEnvironment(environment);
|
expression.setEnvironment(environment);
|
||||||
|
|
||||||
final int[] timedOut = {0};
|
AtomicInteger timedOut = new AtomicInteger();
|
||||||
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
||||||
@Override
|
@Override
|
||||||
protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
||||||
@ -2672,7 +2671,7 @@ protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
|||||||
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
|
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
|
||||||
return defaultBiomeType;
|
return defaultBiomeType;
|
||||||
} catch (ExpressionTimeoutException e) {
|
} catch (ExpressionTimeoutException e) {
|
||||||
timedOut[0] = timedOut[0] + 1;
|
timedOut.getAndIncrement();
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Failed to create shape", e);
|
log.warn("Failed to create shape", e);
|
||||||
@ -2681,10 +2680,10 @@ protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
int changed = shape.generate(this, biomeType, hollow);
|
int changed = shape.generate(this, biomeType, hollow);
|
||||||
if (timedOut[0] > 0) {
|
if (timedOut.get() > 0) {
|
||||||
throw new ExpressionTimeoutException(
|
throw new ExpressionTimeoutException(
|
||||||
String.format("%d blocks changed. %d blocks took too long to evaluate (increase time with //timeout)",
|
String.format("%d biomes changed. %d biomes took too long to evaluate (increase time with //timeout)",
|
||||||
changed, timedOut[0]));
|
changed, timedOut.get()));
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ private void loadTranslations(Locale locale) throws IOException {
|
|||||||
// In dev, reading lang/strings.json from either i18n.zip or the config folder
|
// In dev, reading lang/strings.json from either i18n.zip or the config folder
|
||||||
// WILL NOT OCCUR!
|
// WILL NOT OCCUR!
|
||||||
URL devStrings;
|
URL devStrings;
|
||||||
if (locale == defaultLocale
|
if (defaultLocale.equals(locale)
|
||||||
&& (devStrings = resourceLoader.getRootResource("lang/strings.json")) != null) {
|
&& (devStrings = resourceLoader.getRootResource("lang/strings.json")) != null) {
|
||||||
try (InputStream in = devStrings.openStream()) {
|
try (InputStream in = devStrings.openStream()) {
|
||||||
putTranslationData(entries, in);
|
putTranslationData(entries, in);
|
||||||
|
@ -231,7 +231,7 @@
|
|||||||
"worldedit.pumpkins.created": "{0} pumpkin patches created.",
|
"worldedit.pumpkins.created": "{0} pumpkin patches created.",
|
||||||
"worldedit.pyramid.created": "{0} blocks have been created.",
|
"worldedit.pyramid.created": "{0} blocks have been created.",
|
||||||
"worldedit.generate.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.reload.config": "Configuration reloaded!",
|
||||||
"worldedit.report.written": "WorldEdit report written to {0}",
|
"worldedit.report.written": "WorldEdit report written to {0}",
|
||||||
|
Loading…
Reference in New Issue
Block a user