Add block break effect to area pickaxe (#1770)

* Add block break effect to area pickaxe

* Create pos lower

* Check before queueing block effect

* comment
Dieser Commit ist enthalten in:
Owen 2022-06-09 06:48:24 -04:00 committet von GitHub
Ursprung a16074cbe4
Commit af234b284b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -27,7 +27,9 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -73,9 +75,14 @@ public class AreaPickaxe implements BlockTool {
if (!initialType.equals(editSession.getBlock(x, y, z).getBlockType())) {
continue;
}
// FAWE start - Only queue the block break effect if setting the block is successful
if (editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState())) {
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
BlockVector3 pos = BlockVector3.at(x, y, z);
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType,
clicked.toVector().toBlockPoint().distanceSq(pos));
}
// FAWE end
}
}
}