3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

Merge pull request #110 from Mgazul/breaking

Fix fixLiquid
Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-12 00:55:59 +10:00 committet von GitHub
Commit a831ae17b7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 19 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -2196,18 +2196,24 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int fixLiquid(final BlockVector3 origin, final double radius, Mask liquidMask, Pattern pattern) {
public int fixLiquid(final BlockVector3 origin, final double radius, BlockType fluid) {
checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required");
// Our origins can only be liquids
Mask liquidMask = new BlockTypeMask(this, fluid);
// But we will also visit air blocks
MaskIntersection blockMask = new MaskUnion(liquidMask, Masks.negate(new ExistingBlockMask(this)));
// There are boundaries that the routine needs to stay in
MaskIntersection mask = new MaskIntersection(
new BoundedHeightMask(0, Math.min(origin.getBlockY(), getMaximumPoint().getBlockY())),
new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())),
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
liquidMask);
blockMask);
BlockReplace replace = new BlockReplace(this, pattern);
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace, (int) (radius * 2 + 1), this);
BlockReplace replace = new BlockReplace(this, new BlockPattern(fluid.getDefaultState()));
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
// Around the origin in a 3x3 block
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
@ -2216,8 +2222,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
}
Operations.completeBlindly(visitor);
return getBlockChangeCount();
Operations.completeLegacy(visitor);
return visitor.getAffected();
}
/**

Datei anzeigen

@ -317,10 +317,11 @@ public class UtilityCommands extends MethodCommands {
)
@CommandPermissions("worldedit.fixlava")
@Logging(PLACEMENT)
public void fixLava(Player player, LocalSession session, EditSession editSession, double radius) throws WorldEditException {
public void fixLava(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
double radius = Math.max(0, args.getDouble(0));
worldEdit.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, BlockTypes.LAVA.toMask(editSession), BlockTypes.LAVA.getDefaultState());
session.getPlacementPosition(player), radius, BlockTypes.LAVA);
player.print(BBC.getPrefix() + affected + " block(s) have been changed.");
}
@ -333,10 +334,11 @@ public class UtilityCommands extends MethodCommands {
)
@CommandPermissions("worldedit.fixwater")
@Logging(PLACEMENT)
public void fixWater(Player player, LocalSession session, EditSession editSession, double radius) throws WorldEditException {
public void fixWater(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
double radius = Math.max(0, args.getDouble(0));
worldEdit.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, BlockTypes.WATER.toMask(editSession), BlockTypes.WATER.getDefaultState());
session.getPlacementPosition(player), radius, BlockTypes.WATER);
BBC.VISITOR_BLOCK.send(player, affected);
}