Changed //cyl and //hcyl to respect boundaries.

Dieser Commit ist enthalten in:
sk89q 2010-10-17 17:39:20 -07:00
Ursprung 3031480b38
Commit 3ad6577be6
3 geänderte Dateien mit 88 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -887,6 +887,19 @@ public class EditSession {
int d = (5 - radius * 4) / 4;
int affected = 0;
if (height == 0) {
return 0;
} else if (height < 0) {
height = -height;
pos = pos.subtract(0, height, 0);
}
if (pos.getBlockY() - height - 1 < 0) {
height = pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > 127) {
height = 127 - pos.getBlockY() + 1;
}
affected += makeHCylinderPoints(pos, x, z, height, block);
while (x < z) {
@ -961,6 +974,19 @@ public class EditSession {
int d = (5 - radius * 4) / 4;
int affected = 0;
if (height == 0) {
return 0;
} else if (height < 0) {
height = -height;
pos = pos.subtract(0, height, 0);
}
if (pos.getBlockY() - height - 1 < 0) {
height = pos.getBlockY() + 1;
} else if (pos.getBlockY() + height - 1 > 127) {
height = 127 - pos.getBlockY() + 1;
}
affected += makeCylinderPoints(pos, x, z, height, block);
while (x < z) {

Datei anzeigen

@ -411,7 +411,7 @@ public class WorldEdit {
checkArgs(split, 2, 3, split[0]);
BaseBlock block = getBlock(split[1]);
int radius = Math.max(1, Integer.parseInt(split[2]));
int height = split.length > 3 ? Math.max(1, Integer.parseInt(split[3])) : 1;
int height = split.length > 3 ? Integer.parseInt(split[3]) : 1;
Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeHollowCylinder(pos, block, radius, height);
@ -424,7 +424,7 @@ public class WorldEdit {
checkArgs(split, 2, 3, split[0]);
BaseBlock block = getBlock(split[1]);
int radius = Math.max(1, Integer.parseInt(split[2]));
int height = split.length > 3 ? Math.max(1, Integer.parseInt(split[3])) : 1;
int height = split.length > 3 ? Integer.parseInt(split[3]) : 1;
Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, block, radius, height);

Datei anzeigen

@ -99,6 +99,26 @@ public class Vector {
return (int)Math.round(x);
}
/**
* Set X.
*
* @param x
* @return new vector
*/
public Vector setX(double x) {
return new Vector(x, y, z);
}
/**
* Set X.
*
* @param x
* @return new vector
*/
public Vector setX(int x) {
return new Vector(x, y, z);
}
/**
* @return the y
*/
@ -113,6 +133,26 @@ public class Vector {
return (int)Math.round(y);
}
/**
* Set Y.
*
* @param y
* @return new vector
*/
public Vector setY(double y) {
return new Vector(x, y, z);
}
/**
* Set Y.
*
* @param y
* @return new vector
*/
public Vector setY(int y) {
return new Vector(x, y, z);
}
/**
* @return the z
*/
@ -127,6 +167,26 @@ public class Vector {
return (int)Math.round(z);
}
/**
* Set Z.
*
* @param z
* @return new vector
*/
public Vector setZ(double z) {
return new Vector(x, y, z);
}
/**
* Set Z.
*
* @param z
* @return new vector
*/
public Vector setZ(int z) {
return new Vector(x, y, z);
}
/**
* Adds two points.
*