mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Added support for non-integer radius to //fill, //fillr, //drain, //fixlava, //fixwater, //snow and //thaw.
This commit is contained in:
parent
a57830706e
commit
c79d90bb99
@ -590,7 +590,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @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 {
|
boolean recursive) throws MaxChangedBlocksException {
|
||||||
|
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
@ -695,7 +695,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @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 {
|
boolean recursive) throws MaxChangedBlocksException {
|
||||||
|
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
@ -1492,7 +1492,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int drainArea(Vector pos, int radius)
|
public int drainArea(Vector pos, double radius)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
@ -1559,7 +1559,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @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 {
|
throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
@ -1920,7 +1920,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int thaw(Vector pos, int radius)
|
public int thaw(Vector pos, double radius)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
int radiusSq = (int)Math.pow(radius, 2);
|
int radiusSq = (int)Math.pow(radius, 2);
|
||||||
@ -1932,8 +1932,9 @@ public class EditSession {
|
|||||||
BaseBlock air = new BaseBlock(0);
|
BaseBlock air = new BaseBlock(0);
|
||||||
BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
|
BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
|
||||||
|
|
||||||
for (int x = ox - radius; x <= ox + radius; ++x) {
|
int ceilRadius = (int) Math.ceil(radius);
|
||||||
for (int z = oz - radius; z <= oz + radius; ++z) {
|
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) {
|
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1968,7 +1969,7 @@ public class EditSession {
|
|||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int simulateSnow(Vector pos, int radius)
|
public int simulateSnow(Vector pos, double radius)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
int radiusSq = (int)Math.pow(radius, 2);
|
int radiusSq = (int)Math.pow(radius, 2);
|
||||||
@ -1980,8 +1981,9 @@ public class EditSession {
|
|||||||
BaseBlock ice = new BaseBlock(79);
|
BaseBlock ice = new BaseBlock(79);
|
||||||
BaseBlock snow = new BaseBlock(78);
|
BaseBlock snow = new BaseBlock(78);
|
||||||
|
|
||||||
for (int x = ox - radius; x <= ox + radius; ++x) {
|
int ceilRadius = (int) Math.ceil(radius);
|
||||||
for (int z = oz - radius; z <= oz + radius; ++z) {
|
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) {
|
if ((new Vector(x, oy, z)).distanceSq(pos) > radiusSq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ public class WorldEdit {
|
|||||||
* @param radius
|
* @param radius
|
||||||
* @throws MaxRadiusException
|
* @throws MaxRadiusException
|
||||||
*/
|
*/
|
||||||
public void checkMaxRadius(int radius) throws MaxRadiusException {
|
public void checkMaxRadius(double radius) throws MaxRadiusException {
|
||||||
if (config.maxRadius > 0 && radius > config.maxRadius) {
|
if (config.maxRadius > 0 && radius > config.maxRadius) {
|
||||||
throw new MaxRadiusException();
|
throw new MaxRadiusException();
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class UtilityCommands {
|
|||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
Pattern pattern = we.getBlockPattern(player, args.getString(0));
|
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);
|
we.checkMaxRadius(radius);
|
||||||
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1;
|
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public class UtilityCommands {
|
|||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
Pattern pattern = we.getBlockPattern(player, args.getString(0));
|
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);
|
we.checkMaxRadius(radius);
|
||||||
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1;
|
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)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
int radius = Math.max(0, args.getInteger(0));
|
double radius = Math.max(0, args.getDouble(0));
|
||||||
we.checkMaxRadius(radius);
|
we.checkMaxRadius(radius);
|
||||||
int affected = editSession.drainArea(
|
int affected = editSession.drainArea(
|
||||||
session.getPlacementPosition(player), radius);
|
session.getPlacementPosition(player), radius);
|
||||||
@ -131,7 +131,7 @@ public class UtilityCommands {
|
|||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
int radius = Math.max(0, args.getInteger(0));
|
double radius = Math.max(0, args.getDouble(0));
|
||||||
we.checkMaxRadius(radius);
|
we.checkMaxRadius(radius);
|
||||||
int affected = editSession.fixLiquid(
|
int affected = editSession.fixLiquid(
|
||||||
session.getPlacementPosition(player), radius, 10, 11);
|
session.getPlacementPosition(player), radius, 10, 11);
|
||||||
@ -151,7 +151,7 @@ public class UtilityCommands {
|
|||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
int radius = Math.max(0, args.getInteger(0));
|
double radius = Math.max(0, args.getDouble(0));
|
||||||
we.checkMaxRadius(radius);
|
we.checkMaxRadius(radius);
|
||||||
int affected = editSession.fixLiquid(
|
int affected = editSession.fixLiquid(
|
||||||
session.getPlacementPosition(player), radius, 8, 9);
|
session.getPlacementPosition(player), radius, 8, 9);
|
||||||
@ -270,7 +270,7 @@ public class UtilityCommands {
|
|||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
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);
|
int affected = editSession.simulateSnow(session.getPlacementPosition(player), size);
|
||||||
player.print(affected + " surfaces covered. Let it snow~");
|
player.print(affected + " surfaces covered. Let it snow~");
|
||||||
@ -289,7 +289,7 @@ public class UtilityCommands {
|
|||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
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);
|
int affected = editSession.thaw(session.getPlacementPosition(player), size);
|
||||||
player.print(affected + " surfaces thawed.");
|
player.print(affected + " surfaces thawed.");
|
||||||
|
Loading…
Reference in New Issue
Block a user