mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:38:35 +00:00
Use a long to refer to the volume of a region to prevent overflow (#1350)
* Use a long to refer to the volume of a region, and rename the method to getVolume * Fixed issues noted in review * Forgot to floor * Fixed review notes * Can use a long here rather than BigDecimal * Improve javadocs * style (cherry picked from commit 328030fd6281e58a4ea1d0cdd0a2e274da90afbe)
This commit is contained in:
@ -176,7 +176,7 @@ public class ClipboardCommands {
|
||||
|
||||
lazyClipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
actor.print(Caption.of("fawe.worldedit.copy.command.copy" , region.getArea()));
|
||||
actor.print(Caption.of("fawe.worldedit.copy.command.copy" , region.getVolume()));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
|
@ -104,14 +104,14 @@ public class ExpandCommands {
|
||||
private static void expandVert(LocalSession session, Actor actor, World world) throws IncompleteRegionException {
|
||||
Region region = session.getSelection(world);
|
||||
try {
|
||||
int oldSize = region.getArea();
|
||||
long oldSize = region.getVolume();
|
||||
region.expand(
|
||||
BlockVector3.at(0, (world.getMaxY() + 1), 0),
|
||||
BlockVector3.at(0, -(world.getMaxY() + 1), 0));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
long newSize = region.getVolume();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
int changeSize = newSize - oldSize;
|
||||
long changeSize = newSize - oldSize;
|
||||
actor.printInfo(
|
||||
TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
|
||||
);
|
||||
@ -134,7 +134,7 @@ public class ExpandCommands {
|
||||
@MultiDirection
|
||||
List<BlockVector3> direction) throws WorldEditException {
|
||||
Region region = session.getSelection(world);
|
||||
int oldSize = region.getArea();
|
||||
long oldSize = region.getVolume();
|
||||
|
||||
if (reverseAmount == 0) {
|
||||
for (BlockVector3 dir : direction) {
|
||||
@ -147,11 +147,11 @@ public class ExpandCommands {
|
||||
}
|
||||
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
long newSize = region.getVolume();
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
int changeSize = newSize - oldSize;
|
||||
long changeSize = newSize - oldSize;
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ public class SelectionCommands {
|
||||
List<BlockVector3> direction) throws WorldEditException {
|
||||
try {
|
||||
Region region = session.getSelection(world);
|
||||
int oldSize = region.getArea();
|
||||
long oldSize = region.getVolume();
|
||||
if (reverseAmount == 0) {
|
||||
for (BlockVector3 dir : direction) {
|
||||
region.contract(dir.multiply(amount));
|
||||
@ -350,7 +350,7 @@ public class SelectionCommands {
|
||||
}
|
||||
}
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
long newSize = region.getVolume();
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
@ -501,7 +501,7 @@ public class SelectionCommands {
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.size", TextComponent.of(size.toString())));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.distance", TextComponent.of(region.getMaximumPoint().distance(region.getMinimumPoint()))));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.blocks", TextComponent.of(region.getArea())));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.blocks", TextComponent.of(region.getVolume())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
Reference in New Issue
Block a user