use of com.fastasyncworldedit.core.math.random.NoiseRandom in project FastAsyncWorldEdit by IntellectualSites.
the class NoisePatternParser method parseFromInput.
@Override
protected Pattern parseFromInput(@Nonnull String[] arguments, ParserContext context) {
if (arguments.length != 2) {
throw new InputParseException(Caption.of("fawe.error.command.syntax", TextComponent.of(getPrefix() + "[scale][pattern] (e.g. " + getPrefix() + "[5][dirt,stone])")));
}
double scale = parseScale(arguments[0]);
Pattern inner = worldEdit.getPatternFactory().parseFromInput(arguments[1], context);
if (inner instanceof RandomPattern) {
return new RandomPattern(new NoiseRandom(this.generatorSupplier.get(), scale), (RandomPattern) inner);
} else if (inner instanceof BlockStateHolder) {
// single blocks won't have any impact on how a noise behaves
return inner;
} else {
throw new InputParseException(TextComponent.of("Pattern " + inner.getClass().getSimpleName() + " cannot be used with #" + this.name));
}
}
Aggregations