reduce diff

This commit is contained in:
Jesse Boyd
2019-11-21 07:57:32 +00:00
parent 52a502a1c6
commit 37b6c406ac
18 changed files with 248 additions and 269 deletions

View File

@ -127,12 +127,12 @@ public class BiomeCommands {
return;
}
BiomeType biome = player.getWorld().getBiome(blockPosition.toBlockPoint().toBlockVector2());
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
biomes.add(biome);
qualifier = "at line of sight point";
} else if (usePosition) {
BiomeType biome = player.getWorld().getBiome(player.getLocation().toBlockPoint().toBlockVector2());
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
biomes.add(biome);
qualifier = "at your position";
@ -145,11 +145,9 @@ public class BiomeCommands {
biomes.add(world.getBiome(pt));
}
} else {
RegionVisitor visitor = new RegionVisitor(region, pt -> {
for (BlockVector3 pt : region) {
biomes.add(world.getBiome(pt.toBlockVector2()));
return true;
});
Operations.completeBlindly(visitor);
}
}
qualifier = "in your selection";

View File

@ -448,15 +448,17 @@ public class ClipboardCommands {
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
checkPaste(actor, editSession, to, holder, clipboard);
Operation operation = holder
.createPaste(editSession)
.to(to)
.ignoreAirBlocks(ignoreAirBlocks)
.copyBiomes(pasteBiomes)
.copyEntities(pasteEntities)
.maskSource(sourceMask)
.build();
Operations.completeLegacy(operation);
if (!onlySelect) {
Operation operation = holder
.createPaste(editSession)
.to(to)
.ignoreAirBlocks(ignoreAirBlocks)
.copyBiomes(pasteBiomes)
.copyEntities(pasteEntities)
.maskSource(sourceMask)
.build();
Operations.completeLegacy(operation);
}
if (selectPasted || onlySelect) {
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());

View File

@ -194,7 +194,7 @@ public class GeneralCommands {
} else {
session.setUseServerCUI(true);
session.updateServerCUI(player);
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32×32×32.");
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
}
}

View File

@ -231,35 +231,33 @@ public class HistoryCommands {
@Arg(name = "player", desc = "Undo this player's operations", def = "")
String playerName) throws WorldEditException {
times = Math.max(1, times);
LocalSession undoSession;
LocalSession undoSession = session;
if (session.hasFastMode()) {
player.print(BBC.COMMAND_UNDO_DISABLED.s());
return;
}
if (playerName != null && !playerName.isEmpty()) {
if (playerName != null) {
player.checkPermission("worldedit.history.undo.other");
undoSession = worldEdit.getSessionManager().findByName(playerName);
if (undoSession == null) {
BBC.COMMAND_HISTORY_OTHER_ERROR.send(player, playerName);
player.printError("Unable to find session for " + playerName);
return;
}
}
int timesUndone = 0;
for (int i = 0; i < times; ++i) {
EditSession undone = undoSession.undo(undoSession.getBlockBag(player), player);
if (undone != null) {
timesUndone++;
worldEdit.flushBlockBag(player, undone);
} else {
break;
}
}
if (timesUndone > 0) {
player.print("Undid " + timesUndone + " available edits.");
} else {
undoSession = session;
}
int finalTimes = times;
EditSession undone = null;
int i = 0;
for (; i < finalTimes; ++i) {
undone = undoSession.undo(undoSession.getBlockBag(player), player);
if (undone == null) break;
worldEdit.flushBlockBag(player, undone);
}
if (undone == null) i--;
if (i > 0) {
BBC.COMMAND_UNDO_SUCCESS.send(player, i == 1 ? "" : " x" + i);
}
if (undone == null) {
player.printError(BBC.COMMAND_UNDO_ERROR.s());
player.printError("Nothing left to undo.");
}
}

View File

@ -59,13 +59,11 @@ public class QueryTool implements BlockTool {
builder.append(TextComponent.of(block.getBlockType().getName(), TextColor.YELLOW));
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block state"))));
/*
final OptionalInt internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
if (internalId.isPresent()) {
builder.append(TextComponent.of(" (" + internalId.getAsInt() + ") ", TextColor.DARK_GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Internal ID"))));
}
*/
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block Light/Light Above"))));