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

Don't overwrite history during changes.

Fixes issues with some changes not being undone.

I mean, the sphere algorithm needs to not set blocks 20 times,
but other things can trigger this too.

Also allow radius 0 sphere via //sphere (because /br sphere allows it).
Dieser Commit ist enthalten in:
wizjany 2019-07-16 21:43:14 -04:00
Ursprung f75104f2ac
Commit 05cee0a30b
2 geänderte Dateien mit 8 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -162,13 +162,13 @@ public class GenerationCommands {
final double radiusX, radiusY, radiusZ; final double radiusX, radiusY, radiusZ;
switch (radii.size()) { switch (radii.size()) {
case 1: case 1:
radiusX = radiusY = radiusZ = Math.max(1, radii.get(0)); radiusX = radiusY = radiusZ = Math.max(0, radii.get(0));
break; break;
case 3: case 3:
radiusX = Math.max(1, radii.get(0)); radiusX = Math.max(0, radii.get(0));
radiusY = Math.max(1, radii.get(1)); radiusY = Math.max(0, radii.get(1));
radiusZ = Math.max(1, radii.get(2)); radiusZ = Math.max(0, radii.get(2));
break; break;
default: default:
@ -205,7 +205,7 @@ public class GenerationCommands {
@Arg(desc = "The density of the forest, between 0 and 100", def = "5") @Arg(desc = "The density of the forest, between 0 and 100", def = "5")
double density) throws WorldEditException { double density) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100"); checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100");
density = density / 100; density /= 100;
int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type);
player.print(affected + " trees created."); player.print(affected + " trees created.");
return affected; return affected;

Datei anzeigen

@ -55,7 +55,9 @@ public class BlockOptimizedHistory extends ArrayListHistory {
if (change instanceof BlockChange) { if (change instanceof BlockChange) {
BlockChange blockChange = (BlockChange) change; BlockChange blockChange = (BlockChange) change;
BlockVector3 position = blockChange.getPosition(); BlockVector3 position = blockChange.getPosition();
previous.add(position, blockChange.getPrevious()); if (!previous.containsLocation(position)) {
previous.add(position, blockChange.getPrevious());
}
current.add(position, blockChange.getCurrent()); current.add(position, blockChange.getCurrent());
} else { } else {
super.add(change); super.add(change);