mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 10:17:39 +00:00
Made floating tree remover work on mushrooms
This commit is contained in:
parent
709cae1995
commit
dd358bc982
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.tools;
|
package com.sk89q.worldedit.tools;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -33,7 +34,7 @@ import com.sk89q.worldedit.blocks.BlockID;
|
|||||||
* @author Moo0
|
* @author Moo0
|
||||||
*/
|
*/
|
||||||
public class FloatingTreeRemover implements BlockTool {
|
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;
|
private int range;
|
||||||
|
|
||||||
public FloatingTreeRemover() {
|
public FloatingTreeRemover() {
|
||||||
@ -53,7 +54,10 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
|
|
||||||
EditSession editSession = session.createEditSession(player);
|
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.");
|
player.printError("That's not a floating tree.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -68,7 +72,10 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
for (Iterator<BlockVector> iterator = blockSet.iterator(); iterator.hasNext();) {
|
for (Iterator<BlockVector> iterator = blockSet.iterator(); iterator.hasNext();) {
|
||||||
BlockVector blockVector = iterator.next();
|
BlockVector blockVector = iterator.next();
|
||||||
block = editSession.getBlock(blockVector).getType();
|
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);
|
editSession.setBlock(blockVector, air);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,13 +92,14 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
* Helper method.
|
* Helper method.
|
||||||
*
|
*
|
||||||
* @param server
|
* @param server
|
||||||
* @param superPickaxeManyDrop
|
* @param editSession
|
||||||
* @param world
|
* @param world
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param origin
|
* @param origin
|
||||||
* @param size
|
* @param size
|
||||||
* @param initialType
|
* @param initialType
|
||||||
* @param visited
|
* @param visited
|
||||||
|
* @param lastBlock
|
||||||
*/
|
*/
|
||||||
private boolean recurse(ServerInterface server, EditSession editSession,
|
private boolean recurse(ServerInterface server, EditSession editSession,
|
||||||
LocalWorld world, BlockVector pos,
|
LocalWorld world, BlockVector pos,
|
||||||
@ -109,11 +117,13 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
if (block == BlockID.AIR || block == BlockID.SNOW){
|
if (block == BlockID.AIR || block == BlockID.SNOW){
|
||||||
return true;
|
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) {
|
if (lastBlock == BlockID.LEAVES) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user