use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class RotateTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
AffineTransform transform = new AffineTransform();
Extent extent;
if (arguments.length == 1) {
transform = transform.rotateY(Double.parseDouble(arguments[0]));
extent = context.requireExtent();
} else if (arguments.length == 3 || arguments.length == 4) {
transform = transform.rotateX(Double.parseDouble(arguments[0]));
transform = transform.rotateY(Double.parseDouble(arguments[1]));
transform = transform.rotateZ(Double.parseDouble(arguments[2]));
extent = arguments.length == 4 ? worldEdit.getTransformFactory().parseFromInput(arguments[3], context) : context.requireExtent();
} else {
return null;
}
return new BlockTransformExtent(extent, transform);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class TransformFactory method parseFromInput.
@Override
public ResettableExtent parseFromInput(String input, ParserContext context) throws InputParseException {
List<ResettableExtent> transforms = new ArrayList<>();
for (String component : input.split(" ")) {
if (component.isEmpty()) {
continue;
}
ResettableExtent match = richTransformParser.parseFromInput(component, context);
if (match != null) {
transforms.add(match);
continue;
}
parseFromParsers(context, transforms, component);
}
return getResettableExtent(input, transforms);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class PatternTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length > 2) {
return null;
}
Pattern pattern = worldEdit.getPatternFactory().parseFromInput(arguments[0], context);
Extent extent = arguments.length == 2 ? worldEdit.getTransformFactory().parseFromInput(arguments[1], context) : context.requireExtent();
return new PatternTransform(extent, pattern);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class RandomTransformParser method parseFromInput.
@Override
public ResettableExtent parseFromInput(String input, ParserContext context) throws InputParseException {
if (input.isEmpty()) {
return null;
}
List<String> split = StringUtil.split(input, ',', '[', ']');
if (split.size() == 1) {
return null;
}
RandomTransform randomTransform = new RandomTransform();
for (String s : split) {
ResettableExtent transform = worldEdit.getTransformFactory().parseFromInput(s, context);
randomTransform.add(transform, 1d);
}
return randomTransform;
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class ScaleTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
double xScale;
double yScale;
double zScale;
Extent extent;
if (arguments.length == 1) {
xScale = yScale = zScale = Double.parseDouble(arguments[0]);
extent = context.requireExtent();
} else if (arguments.length == 3 || arguments.length == 4) {
xScale = Double.parseDouble(arguments[0]);
yScale = Double.parseDouble(arguments[1]);
zScale = Double.parseDouble(arguments[2]);
extent = arguments.length == 4 ? worldEdit.getTransformFactory().parseFromInput(arguments[3], context) : context.requireExtent();
} else {
return null;
}
return new ScaleTransform(extent, xScale, yScale, zScale);
}
Aggregations