Made floating tree remover work on mushrooms

This commit is contained in:
Wizjany 2011-09-18 02:37:11 -04:00
parent 709cae1995
commit dd358bc982

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.tools;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@ -33,7 +34,7 @@ import com.sk89q.worldedit.blocks.BlockID;
* @author Moo0
*/
public class FloatingTreeRemover implements BlockTool {
private static final BaseBlock air = new BaseBlock(0);
private static final BaseBlock air = new BaseBlock(BlockID.AIR);
private int range;
public FloatingTreeRemover() {
@ -53,7 +54,10 @@ public class FloatingTreeRemover implements BlockTool {
EditSession editSession = session.createEditSession(player);
if (initialType != BlockID.LEAVES && initialType != BlockID.LOG) {
if (initialType != BlockID.LOG
&& initialType != BlockID.LEAVES
&& initialType != BlockID.BROWN_MUSHROOM_CAP
&& initialType != BlockID.RED_MUSHROOM_CAP) {
player.printError("That's not a floating tree.");
return true;
}
@ -68,7 +72,10 @@ public class FloatingTreeRemover implements BlockTool {
for (Iterator<BlockVector> iterator = blockSet.iterator(); iterator.hasNext();) {
BlockVector blockVector = iterator.next();
block = editSession.getBlock(blockVector).getType();
if (block == BlockID.LEAVES || block == BlockID.LOG) {
if (block == BlockID.LOG
|| block == BlockID.LEAVES
|| block == BlockID.BROWN_MUSHROOM_CAP
|| block == BlockID.RED_MUSHROOM_CAP) {
editSession.setBlock(blockVector, air);
}
}
@ -85,13 +92,14 @@ public class FloatingTreeRemover implements BlockTool {
* Helper method.
*
* @param server
* @param superPickaxeManyDrop
* @param editSession
* @param world
* @param pos
* @param origin
* @param size
* @param initialType
* @param visited
* @param lastBlock
*/
private boolean recurse(ServerInterface server, EditSession editSession,
LocalWorld world, BlockVector pos,
@ -109,11 +117,13 @@ public class FloatingTreeRemover implements BlockTool {
if (block == BlockID.AIR || block == BlockID.SNOW){
return true;
}
if (block != BlockID.LEAVES && block != BlockID.LOG) {
if (block != BlockID.LOG
&& block != BlockID.LEAVES
&& block != BlockID.BROWN_MUSHROOM_CAP
&& block != BlockID.RED_MUSHROOM_CAP) {
if (lastBlock == BlockID.LEAVES) {
return true;
}
else {
} else {
return false;
}