From 36e4b99ade9a0011120c7ba55878e2886388f213 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Tue, 29 Nov 2011 09:10:25 +0100 Subject: [PATCH] Added particle effects to area and recursive pickaxe. --- .../sk89q/worldedit/tools/AreaPickaxe.java | 15 +++++++++------ .../worldedit/tools/RecursivePickaxe.java | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/tools/AreaPickaxe.java b/src/main/java/com/sk89q/worldedit/tools/AreaPickaxe.java index 00c0f875f..20ef357d9 100644 --- a/src/main/java/com/sk89q/worldedit/tools/AreaPickaxe.java +++ b/src/main/java/com/sk89q/worldedit/tools/AreaPickaxe.java @@ -63,13 +63,16 @@ public class AreaPickaxe implements BlockTool { for (int y = oy - range; y <= oy + range; ++y) { for (int z = oz - range; z <= oz + range; ++z) { Vector pos = new Vector(x, y, z); - if (world.getBlockType(pos) == initialType) { - if (config.superPickaxeManyDrop) { - world.simulateBlockMine(pos); - } - - editSession.setBlock(pos, air); + if (world.getBlockType(pos) != initialType) { + continue; } + if (config.superPickaxeManyDrop) { + world.simulateBlockMine(pos); + } + + world.queueBlockBreakEffect(server, pos, initialType, clicked.distanceSq(pos)); + + editSession.setBlock(pos, air); } } } diff --git a/src/main/java/com/sk89q/worldedit/tools/RecursivePickaxe.java b/src/main/java/com/sk89q/worldedit/tools/RecursivePickaxe.java index 1c7b9a05e..7b0c5aee2 100644 --- a/src/main/java/com/sk89q/worldedit/tools/RecursivePickaxe.java +++ b/src/main/java/com/sk89q/worldedit/tools/RecursivePickaxe.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.tools; import java.util.HashSet; import java.util.Set; + import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; @@ -90,21 +91,25 @@ public class RecursivePickaxe implements BlockTool { Set visited, boolean drop) throws MaxChangedBlocksException { - if (origin.distance(pos) > size || visited.contains(pos)) { + final double distanceSq = origin.distanceSq(pos); + if (distanceSq > size*size || visited.contains(pos)) { return; } visited.add(pos); - if (editSession.getBlock(pos).getType() == initialType) { - if (drop) { - world.simulateBlockMine(pos); - } - editSession.setBlock(pos, air); - } else { + if (editSession.getBlock(pos).getType() != initialType) { return; } + if (drop) { + world.simulateBlockMine(pos); + } + + world.queueBlockBreakEffect(server, pos, initialType, distanceSq); + + editSession.setBlock(pos, air); + recurse(server, editSession, world, pos.add(1, 0, 0).toBlockVector(), origin, size, initialType, visited, drop); recurse(server, editSession, world, pos.add(-1, 0, 0).toBlockVector(),