Used vector constants in all appropriate placed.

This commit is contained in:
TomyLobo 2013-08-05 19:47:49 +02:00 committed by wizjany
parent 4c496bfaac
commit b28fdbfe4e
5 changed files with 16 additions and 16 deletions

View File

@ -64,7 +64,7 @@ public class ClipboardCommands {
Vector pos = session.getPlacementPosition(player);
CuboidClipboard clipboard = new CuboidClipboard(
max.subtract(min).add(new Vector(1, 1, 1)),
max.subtract(min).add(Vector.ONE),
min, min.subtract(pos));
clipboard.copy(editSession);
if (args.hasFlag('e')) {
@ -107,7 +107,7 @@ public class ClipboardCommands {
Vector pos = session.getPlacementPosition(player);
CuboidClipboard clipboard = new CuboidClipboard(
max.subtract(min).add(new Vector(1, 1, 1)),
max.subtract(min).add(Vector.ONE),
min, min.subtract(pos));
clipboard.copy(editSession);
if (args.hasFlag('e')) {

View File

@ -384,17 +384,17 @@ public class GenerationCommands {
Vector unit;
if (args.hasFlag('r')) {
zero = new Vector(0, 0, 0);
unit = new Vector(1, 1, 1);
zero = Vector.ZERO;
unit = Vector.ONE;
} else if (args.hasFlag('o')) {
zero = session.getPlacementPosition(player);
unit = new Vector(1, 1, 1);
unit = Vector.ONE;
} else if (args.hasFlag('c')) {
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();
zero = max.add(min).multiply(0.5);
unit = new Vector(1, 1, 1);
unit = Vector.ONE;
} else {
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();

View File

@ -393,11 +393,11 @@ public class RegionCommands {
Vector unit;
if (args.hasFlag('r')) {
zero = new Vector(0, 0, 0);
unit = new Vector(1, 1, 1);
zero = Vector.ZERO;
unit = Vector.ONE;
} else if (args.hasFlag('o')) {
zero = session.getPlacementPosition(player);
unit = new Vector(1, 1, 1);
unit = Vector.ONE;
} else {
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();

View File

@ -602,7 +602,7 @@ public class SelectionCommands {
player.print("Size: " + size);
player.print("Offset: " + offset);
player.print("Cuboid distance: " + size.distance( new Vector(1, 1, 1)));
player.print("Cuboid distance: " + size.distance(Vector.ONE));
player.print("# of blocks: "
+ (int) (size.getX() * size.getY() * size.getZ()));
return;

View File

@ -90,7 +90,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
}
public boolean selectPrimary(Vector pos) {
if (!region.getCenter().equals(new Vector(0, 0, 0)) && pos.compareTo(region.getCenter()) == 0) {
if (!region.getCenter().equals(Vector.ZERO) && pos.compareTo(region.getCenter()) == 0) {
return false;
}
@ -103,7 +103,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
public boolean selectSecondary(Vector pos) {
Vector center = region.getCenter();
if ((center.compareTo(new Vector(0, 0, 0))) == 0) {
if ((center.compareTo(Vector.ZERO)) == 0) {
return true;
}
@ -124,7 +124,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
Vector center = region.getCenter();
if (!center.equals(new Vector(0, 0, 0))) {
if (!center.equals(Vector.ZERO)) {
player.print("Radius set to " + format.format(region.getRadius().getX()) + "/" + format.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ").");
} else {
player.printError("You must select the center point before setting the radius.");
@ -159,7 +159,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
}
public boolean isDefined() {
return !region.getRadius().equals(new Vector2D(0, 0));
return !region.getRadius().equals(Vector2D.ZERO);
}
public void learnChanges() {
@ -176,10 +176,10 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
public List<String> getInformationLines() {
final List<String> lines = new ArrayList<String>();
if (!region.getCenter().equals(new Vector(0, 0, 0))) {
if (!region.getCenter().equals(Vector.ZERO)) {
lines.add("Center: " + region.getCenter());
}
if (!region.getRadius().equals(new Vector2D(0, 0))) {
if (!region.getRadius().equals(Vector2D.ZERO)) {
lines.add("Radius: " + region.getRadius());
}