use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class TransformFactory method parseFromParsers.
private void parseFromParsers(final ParserContext context, final List<ResettableExtent> transforms, final String component) {
ResettableExtent match = null;
for (InputParser<ResettableExtent> parser : getParsers()) {
match = parser.parseFromInput(component, context);
if (match != null) {
break;
}
}
if (match == null) {
throw new NoMatchException(Caption.of("worldedit.error.no-match", TextComponent.of(component)));
}
transforms.add(match);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class OffsetTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length != 3 && arguments.length != 4) {
throw new InputParseException(Caption.of("fawe.error.command.syntax", TextComponent.of("#offset[x][y][z]")));
}
int xOffset = Integer.parseInt(arguments[0]);
int yOffset = Integer.parseInt(arguments[1]);
int zOffset = Integer.parseInt(arguments[2]);
Extent extent;
extent = arguments.length == 4 ? worldEdit.getTransformFactory().parseFromInput(arguments[3], context) : context.requireExtent();
return new OffsetTransform(extent, xOffset, yOffset, zOffset);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class RotateTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@NotNull 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 SpreadTransformParser method parseFromInput.
@Override
protected ResettableExtent parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length != 3 && arguments.length != 4) {
return null;
}
int xOffset = Integer.parseInt(arguments[0]);
int yOffset = Integer.parseInt(arguments[1]);
int zOffset = Integer.parseInt(arguments[2]);
Extent extent = arguments.length == 4 ? worldEdit.getTransformFactory().parseFromInput(arguments[3], context) : context.requireExtent();
return new RandomOffsetTransform(extent, xOffset, yOffset, zOffset);
}
use of com.fastasyncworldedit.core.extent.ResettableExtent in project FastAsyncWorldEdit by IntellectualSites.
the class RandomTransform method setExtent.
@Override
public ResettableExtent setExtent(Extent extent) {
if (collection == null) {
collection = RandomCollection.of(weights, random);
extents = new LinkedHashSet<>(weights.keySet());
}
super.setExtent(extent);
for (ResettableExtent current : extents) {
current.setExtent(extent);
}
return this;
}
Aggregations