2014-04-03 02:08:50 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
2014-04-03 02:08:50 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-04-03 02:08:50 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
package com.sk89q.worldedit.command;
|
|
|
|
|
2018-07-30 13:26:06 +00:00
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
|
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL;
|
|
|
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
|
|
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
|
|
|
|
|
2014-04-03 02:08:50 +00:00
|
|
|
import com.sk89q.minecraft.util.commands.Command;
|
|
|
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
|
|
|
import com.sk89q.minecraft.util.commands.Logging;
|
2014-07-17 07:21:13 +00:00
|
|
|
import com.sk89q.worldedit.EditSession;
|
|
|
|
import com.sk89q.worldedit.LocalSession;
|
|
|
|
import com.sk89q.worldedit.WorldEdit;
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
2014-06-28 08:01:49 +00:00
|
|
|
import com.sk89q.worldedit.entity.Player;
|
|
|
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
|
|
import com.sk89q.worldedit.internal.annotation.Selection;
|
2014-04-03 02:08:50 +00:00
|
|
|
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
2018-10-14 10:40:53 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
|
|
|
import com.sk89q.worldedit.math.Vector3;
|
2014-04-03 02:08:50 +00:00
|
|
|
import com.sk89q.worldedit.regions.Region;
|
2014-06-28 08:01:49 +00:00
|
|
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
|
|
|
import com.sk89q.worldedit.util.command.binding.Range;
|
|
|
|
import com.sk89q.worldedit.util.command.binding.Switch;
|
|
|
|
import com.sk89q.worldedit.util.command.binding.Text;
|
|
|
|
import com.sk89q.worldedit.util.command.parametric.Optional;
|
2019-02-16 07:27:00 +00:00
|
|
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
2014-06-28 08:01:49 +00:00
|
|
|
|
2014-04-03 02:08:50 +00:00
|
|
|
/**
|
2014-06-28 08:01:49 +00:00
|
|
|
* Commands for the generation of shapes and other objects.
|
2014-04-03 02:08:50 +00:00
|
|
|
*/
|
|
|
|
public class GenerationCommands {
|
2014-06-28 08:01:49 +00:00
|
|
|
|
|
|
|
private final WorldEdit worldEdit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new instance.
|
|
|
|
*
|
|
|
|
* @param worldEdit reference to WorldEdit
|
|
|
|
*/
|
|
|
|
public GenerationCommands(WorldEdit worldEdit) {
|
|
|
|
checkNotNull(worldEdit);
|
|
|
|
this.worldEdit = worldEdit;
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/hcyl" },
|
2014-06-28 08:01:49 +00:00
|
|
|
usage = "<pattern> <radius>[,<radius>] [height]",
|
2014-04-03 02:08:50 +00:00
|
|
|
desc = "Generates a hollow cylinder.",
|
|
|
|
help =
|
|
|
|
"Generates a hollow cylinder.\n" +
|
|
|
|
"By specifying 2 radii, separated by a comma,\n" +
|
|
|
|
"you can generate elliptical cylinders.\n" +
|
|
|
|
"The 1st radius is north/south, the 2nd radius is east/west.",
|
|
|
|
min = 2,
|
|
|
|
max = 3
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.cylinder")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void hcyl(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("1") int height) throws WorldEditException {
|
|
|
|
cyl(player, session, editSession, pattern, radiusString, height, true);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/cyl" },
|
|
|
|
usage = "<block> <radius>[,<radius>] [height]",
|
2014-06-28 08:01:49 +00:00
|
|
|
flags = "h",
|
2014-04-03 02:08:50 +00:00
|
|
|
desc = "Generates a cylinder.",
|
|
|
|
help =
|
|
|
|
"Generates a cylinder.\n" +
|
|
|
|
"By specifying 2 radii, separated by a comma,\n" +
|
|
|
|
"you can generate elliptical cylinders.\n" +
|
|
|
|
"The 1st radius is north/south, the 2nd radius is east/west.",
|
|
|
|
min = 2,
|
|
|
|
max = 3
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.cylinder")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void cyl(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException {
|
|
|
|
String[] radii = radiusString.split(",");
|
2014-04-03 02:08:50 +00:00
|
|
|
final double radiusX, radiusZ;
|
2014-06-28 08:01:49 +00:00
|
|
|
switch (radii.length) {
|
2014-04-03 02:08:50 +00:00
|
|
|
case 1:
|
2014-06-28 08:01:49 +00:00
|
|
|
radiusX = radiusZ = Math.max(1, Double.parseDouble(radii[0]));
|
2014-04-03 02:08:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2014-06-28 08:01:49 +00:00
|
|
|
radiusX = Math.max(1, Double.parseDouble(radii[0]));
|
|
|
|
radiusZ = Math.max(1, Double.parseDouble(radii[1]));
|
2014-04-03 02:08:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
player.printError("You must either specify 1 or 2 radius values.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-28 08:01:49 +00:00
|
|
|
worldEdit.checkMaxRadius(radiusX);
|
|
|
|
worldEdit.checkMaxRadius(radiusZ);
|
|
|
|
worldEdit.checkMaxRadius(height);
|
2014-04-03 02:08:50 +00:00
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
BlockVector3 pos = session.getPlacementPosition(player);
|
2018-06-15 05:41:37 +00:00
|
|
|
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
|
2014-04-03 02:08:50 +00:00
|
|
|
player.print(affected + " block(s) have been created.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/hsphere" },
|
|
|
|
usage = "<block> <radius>[,<radius>,<radius>] [raised?]",
|
|
|
|
desc = "Generates a hollow sphere.",
|
|
|
|
help =
|
|
|
|
"Generates a hollow sphere.\n" +
|
|
|
|
"By specifying 3 radii, separated by commas,\n" +
|
|
|
|
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
|
|
|
|
"is north/south, up/down, east/west.",
|
|
|
|
min = 2,
|
|
|
|
max = 3
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.sphere")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void hsphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised) throws WorldEditException {
|
|
|
|
sphere(player, session, editSession, pattern, radiusString, raised, true);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/sphere" },
|
|
|
|
usage = "<block> <radius>[,<radius>,<radius>] [raised?]",
|
2014-06-28 08:01:49 +00:00
|
|
|
flags = "h",
|
2014-04-03 02:08:50 +00:00
|
|
|
desc = "Generates a filled sphere.",
|
|
|
|
help =
|
|
|
|
"Generates a filled sphere.\n" +
|
|
|
|
"By specifying 3 radii, separated by commas,\n" +
|
|
|
|
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
|
|
|
|
"is north/south, up/down, east/west.",
|
|
|
|
min = 2,
|
|
|
|
max = 3
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.sphere")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow) throws WorldEditException {
|
|
|
|
String[] radii = radiusString.split(",");
|
2014-04-03 02:08:50 +00:00
|
|
|
final double radiusX, radiusY, radiusZ;
|
2014-06-28 08:01:49 +00:00
|
|
|
switch (radii.length) {
|
2014-04-03 02:08:50 +00:00
|
|
|
case 1:
|
2014-06-28 08:01:49 +00:00
|
|
|
radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0]));
|
2014-04-03 02:08:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2014-06-28 08:01:49 +00:00
|
|
|
radiusX = Math.max(1, Double.parseDouble(radii[0]));
|
|
|
|
radiusY = Math.max(1, Double.parseDouble(radii[1]));
|
|
|
|
radiusZ = Math.max(1, Double.parseDouble(radii[2]));
|
2014-04-03 02:08:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
player.printError("You must either specify 1 or 3 radius values.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-28 08:01:49 +00:00
|
|
|
worldEdit.checkMaxRadius(radiusX);
|
|
|
|
worldEdit.checkMaxRadius(radiusY);
|
|
|
|
worldEdit.checkMaxRadius(radiusZ);
|
2014-04-03 02:08:50 +00:00
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
BlockVector3 pos = session.getPlacementPosition(player);
|
2014-04-03 02:08:50 +00:00
|
|
|
if (raised) {
|
2018-10-14 10:40:53 +00:00
|
|
|
pos = pos.add(0, (int) radiusY, 0);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
2018-06-15 05:41:37 +00:00
|
|
|
int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow);
|
2014-04-03 02:08:50 +00:00
|
|
|
player.findFreePosition();
|
|
|
|
player.print(affected + " block(s) have been created.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "forestgen" },
|
|
|
|
usage = "[size] [type] [density]",
|
|
|
|
desc = "Generate a forest",
|
|
|
|
min = 0,
|
|
|
|
max = 3
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.forest")
|
|
|
|
@Logging(POSITION)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException {
|
|
|
|
density = density / 100;
|
2018-06-19 07:03:09 +00:00
|
|
|
int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type);
|
2014-04-03 02:08:50 +00:00
|
|
|
player.print(affected + " trees created.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "pumpkins" },
|
|
|
|
usage = "[size]",
|
|
|
|
desc = "Generate pumpkin patches",
|
|
|
|
min = 0,
|
|
|
|
max = 1
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.pumpkins")
|
|
|
|
@Logging(POSITION)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException {
|
|
|
|
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem);
|
2014-04-03 02:08:50 +00:00
|
|
|
player.print(affected + " pumpkin patches created.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2014-06-28 08:01:49 +00:00
|
|
|
aliases = { "/hpyramid" },
|
|
|
|
usage = "<block> <size>",
|
|
|
|
desc = "Generate a hollow pyramid",
|
|
|
|
min = 2,
|
|
|
|
max = 2
|
2014-04-03 02:08:50 +00:00
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.pyramid")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void hollowPyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size) throws WorldEditException {
|
|
|
|
pyramid(player, session, editSession, pattern, size, true);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2014-06-28 08:01:49 +00:00
|
|
|
aliases = { "/pyramid" },
|
2014-04-03 02:08:50 +00:00
|
|
|
usage = "<block> <size>",
|
2014-06-28 08:01:49 +00:00
|
|
|
flags = "h",
|
|
|
|
desc = "Generate a filled pyramid",
|
2014-04-03 02:08:50 +00:00
|
|
|
min = 2,
|
|
|
|
max = 2
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.pyramid")
|
|
|
|
@Logging(PLACEMENT)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
|
2018-10-14 10:40:53 +00:00
|
|
|
BlockVector3 pos = session.getPlacementPosition(player);
|
2014-06-28 08:01:49 +00:00
|
|
|
worldEdit.checkMaxRadius(size);
|
2018-06-15 05:41:37 +00:00
|
|
|
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
2014-04-03 02:08:50 +00:00
|
|
|
player.findFreePosition();
|
|
|
|
player.print(affected + " block(s) have been created.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/generate", "/gen", "/g" },
|
|
|
|
usage = "<block> <expression>",
|
|
|
|
desc = "Generates a shape according to a formula.",
|
|
|
|
help =
|
|
|
|
"Generates a shape according to a formula that is expected to\n" +
|
|
|
|
"return positive numbers (true) if the point is inside the shape\n" +
|
|
|
|
"Optionally set type/data to the desired block.\n" +
|
|
|
|
"Flags:\n" +
|
|
|
|
" -h to generate a hollow shape\n" +
|
|
|
|
" -r to use raw minecraft coordinates\n" +
|
|
|
|
" -o is like -r, except offset from placement.\n" +
|
|
|
|
" -c is like -r, except offset selection center.\n" +
|
|
|
|
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
|
|
|
|
"See also tinyurl.com/wesyntax.",
|
|
|
|
flags = "hroc",
|
|
|
|
min = 2,
|
|
|
|
max = -1
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.generation.shape")
|
|
|
|
@Logging(ALL)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void generate(Player player, LocalSession session, EditSession editSession,
|
|
|
|
@Selection Region region,
|
|
|
|
Pattern pattern,
|
|
|
|
@Text String expression,
|
|
|
|
@Switch('h') boolean hollow,
|
|
|
|
@Switch('r') boolean useRawCoords,
|
|
|
|
@Switch('o') boolean offset,
|
|
|
|
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
2014-04-03 02:08:50 +00:00
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 zero;
|
|
|
|
Vector3 unit;
|
2014-04-03 02:08:50 +00:00
|
|
|
|
2014-06-28 08:01:49 +00:00
|
|
|
if (useRawCoords) {
|
2018-10-14 10:40:53 +00:00
|
|
|
zero = Vector3.ZERO;
|
|
|
|
unit = Vector3.ONE;
|
2014-06-28 08:01:49 +00:00
|
|
|
} else if (offset) {
|
2018-10-14 10:40:53 +00:00
|
|
|
zero = session.getPlacementPosition(player).toVector3();
|
|
|
|
unit = Vector3.ONE;
|
2014-06-28 08:01:49 +00:00
|
|
|
} else if (offsetCenter) {
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 min = region.getMinimumPoint().toVector3();
|
|
|
|
final Vector3 max = region.getMaximumPoint().toVector3();
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
zero = max.add(min).multiply(0.5);
|
2018-10-14 10:40:53 +00:00
|
|
|
unit = Vector3.ONE;
|
2014-04-03 02:08:50 +00:00
|
|
|
} else {
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 min = region.getMinimumPoint().toVector3();
|
|
|
|
final Vector3 max = region.getMaximumPoint().toVector3();
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
zero = max.add(min).multiply(0.5);
|
|
|
|
unit = max.subtract(zero);
|
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
if (unit.getX() == 0) unit = unit.withX(1.0);
|
|
|
|
if (unit.getY() == 0) unit = unit.withY(1.0);
|
|
|
|
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2019-03-07 00:58:32 +00:00
|
|
|
final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow, session.getTimeout());
|
2014-04-03 02:08:50 +00:00
|
|
|
player.findFreePosition();
|
|
|
|
player.print(affected + " block(s) have been created.");
|
|
|
|
} catch (ExpressionException e) {
|
|
|
|
player.printError(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "/generatebiome", "/genbiome", "/gb" },
|
2016-07-06 15:14:11 +00:00
|
|
|
usage = "<biome> <expression>",
|
2014-04-03 02:08:50 +00:00
|
|
|
desc = "Sets biome according to a formula.",
|
|
|
|
help =
|
|
|
|
"Generates a shape according to a formula that is expected to\n" +
|
|
|
|
"return positive numbers (true) if the point is inside the shape\n" +
|
2016-07-06 15:14:11 +00:00
|
|
|
"Sets the biome of blocks in that shape.\n" +
|
2014-04-03 02:08:50 +00:00
|
|
|
"Flags:\n" +
|
|
|
|
" -h to generate a hollow shape\n" +
|
|
|
|
" -r to use raw minecraft coordinates\n" +
|
|
|
|
" -o is like -r, except offset from placement.\n" +
|
|
|
|
" -c is like -r, except offset selection center.\n" +
|
|
|
|
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
|
|
|
|
"See also tinyurl.com/wesyntax.",
|
|
|
|
flags = "hroc",
|
|
|
|
min = 2,
|
|
|
|
max = -1
|
|
|
|
)
|
2019-03-07 00:58:32 +00:00
|
|
|
@CommandPermissions("worldedit.generation.shape.biome")
|
2014-04-03 02:08:50 +00:00
|
|
|
@Logging(ALL)
|
2014-06-28 08:01:49 +00:00
|
|
|
public void generateBiome(Player player, LocalSession session, EditSession editSession,
|
|
|
|
@Selection Region region,
|
2019-02-16 07:27:00 +00:00
|
|
|
BiomeType target,
|
2014-06-28 08:01:49 +00:00
|
|
|
@Text String expression,
|
|
|
|
@Switch('h') boolean hollow,
|
|
|
|
@Switch('r') boolean useRawCoords,
|
|
|
|
@Switch('o') boolean offset,
|
|
|
|
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 zero;
|
|
|
|
Vector3 unit;
|
2014-04-03 02:08:50 +00:00
|
|
|
|
2014-06-28 08:01:49 +00:00
|
|
|
if (useRawCoords) {
|
2018-10-14 10:40:53 +00:00
|
|
|
zero = Vector3.ZERO;
|
|
|
|
unit = Vector3.ONE;
|
2014-06-28 08:01:49 +00:00
|
|
|
} else if (offset) {
|
2018-10-14 10:40:53 +00:00
|
|
|
zero = session.getPlacementPosition(player).toVector3();
|
|
|
|
unit = Vector3.ONE;
|
2014-06-28 08:01:49 +00:00
|
|
|
} else if (offsetCenter) {
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 min = region.getMinimumPoint().toVector3();
|
|
|
|
final Vector3 max = region.getMaximumPoint().toVector3();
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
zero = max.add(min).multiply(0.5);
|
2018-10-14 10:40:53 +00:00
|
|
|
unit = Vector3.ONE;
|
2014-04-03 02:08:50 +00:00
|
|
|
} else {
|
2018-10-14 10:40:53 +00:00
|
|
|
final Vector3 min = region.getMinimumPoint().toVector3();
|
|
|
|
final Vector3 max = region.getMaximumPoint().toVector3();
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
zero = max.add(min).multiply(0.5);
|
|
|
|
unit = max.subtract(zero);
|
|
|
|
|
2018-10-14 10:40:53 +00:00
|
|
|
if (unit.getX() == 0) unit = unit.withX(1.0);
|
|
|
|
if (unit.getY() == 0) unit = unit.withY(1.0);
|
|
|
|
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2019-03-07 00:58:32 +00:00
|
|
|
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow, session.getTimeout());
|
2014-04-03 02:08:50 +00:00
|
|
|
player.findFreePosition();
|
2014-07-17 07:21:13 +00:00
|
|
|
player.print("" + affected + " columns affected.");
|
2014-04-03 02:08:50 +00:00
|
|
|
} catch (ExpressionException e) {
|
|
|
|
player.printError(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
2014-06-28 08:01:49 +00:00
|
|
|
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|