3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Added support for non-integer radius to //fill, //fillr, //drain, //fixlava, //fixwater, //snow and //thaw.

Dieser Commit ist enthalten in:
TomyLobo 2011-08-15 14:35:21 +02:00
Ursprung a57830706e
Commit c79d90bb99
3 geänderte Dateien mit 20 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -590,7 +590,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int fillXZ(Vector origin, BaseBlock block, int radius, int depth,
public int fillXZ(Vector origin, BaseBlock block, double radius, int depth,
boolean recursive) throws MaxChangedBlocksException {
int affected = 0;
@ -695,7 +695,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int fillXZ(Vector origin, Pattern pattern, int radius, int depth,
public int fillXZ(Vector origin, Pattern pattern, double radius, int depth,
boolean recursive) throws MaxChangedBlocksException {
int affected = 0;
@ -1492,7 +1492,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int drainArea(Vector pos, int radius)
public int drainArea(Vector pos, double radius)
throws MaxChangedBlocksException {
int affected = 0;
@ -1559,7 +1559,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int fixLiquid(Vector pos, int radius, int moving, int stationary)
public int fixLiquid(Vector pos, double radius, int moving, int stationary)
throws MaxChangedBlocksException {
int affected = 0;
@ -1920,7 +1920,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int thaw(Vector pos, int radius)
public int thaw(Vector pos, double radius)
throws MaxChangedBlocksException {
int affected = 0;
int radiusSq = (int)Math.pow(radius, 2);
@ -1932,8 +1932,9 @@ public class EditSession {
BaseBlock air = new BaseBlock(0);
BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
for (int x = ox - radius; x <= ox + radius; ++x) {
for (int z = oz - radius; z <= oz + radius; ++z) {
int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
continue;
}
@ -1968,7 +1969,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int simulateSnow(Vector pos, int radius)
public int simulateSnow(Vector pos, double radius)
throws MaxChangedBlocksException {
int affected = 0;
int radiusSq = (int)Math.pow(radius, 2);
@ -1980,8 +1981,9 @@ public class EditSession {
BaseBlock ice = new BaseBlock(79);
BaseBlock snow = new BaseBlock(78);
for (int x = ox - radius; x <= ox + radius; ++x) {
for (int z = oz - radius; z <= oz + radius; ++z) {
int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) {
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
continue;
}

Datei anzeigen

@ -661,7 +661,7 @@ public class WorldEdit {
* @param radius
* @throws MaxRadiusException
*/
public void checkMaxRadius(int radius) throws MaxRadiusException {
public void checkMaxRadius(double radius) throws MaxRadiusException {
if (config.maxRadius > 0 && radius > config.maxRadius) {
throw new MaxRadiusException();
}

Datei anzeigen

@ -52,7 +52,7 @@ public class UtilityCommands {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0));
int radius = Math.max(1, args.getInteger(1));
double radius = Math.max(1, args.getDouble(1));
we.checkMaxRadius(radius);
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1;
@ -82,7 +82,7 @@ public class UtilityCommands {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0));
int radius = Math.max(1, args.getInteger(1));
double radius = Math.max(1, args.getDouble(1));
we.checkMaxRadius(radius);
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1;
@ -111,7 +111,7 @@ public class UtilityCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
int radius = Math.max(0, args.getInteger(0));
double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius);
int affected = editSession.drainArea(
session.getPlacementPosition(player), radius);
@ -131,7 +131,7 @@ public class UtilityCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
int radius = Math.max(0, args.getInteger(0));
double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, 10, 11);
@ -151,7 +151,7 @@ public class UtilityCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
int radius = Math.max(0, args.getInteger(0));
double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, 8, 9);
@ -270,7 +270,7 @@ public class UtilityCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;
double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
int affected = editSession.simulateSnow(session.getPlacementPosition(player), size);
player.print(affected + " surfaces covered. Let it snow~");
@ -289,7 +289,7 @@ public class UtilityCommands {
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;
double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
int affected = editSession.thaw(session.getPlacementPosition(player), size);
player.print(affected + " surfaces thawed.");