Add block break effect to area pickaxe (#1770)

* Add block break effect to area pickaxe

* Create pos lower

* Check before queueing block effect

* comment
This commit is contained in:
Owen 2022-06-09 06:48:24 -04:00 committed by GitHub
parent a16074cbe4
commit af234b284b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,9 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; 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.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; 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())) { if (!initialType.equals(editSession.getBlock(x, y, z).getBlockType())) {
continue; 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
} }
} }
} }