mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Made Tree Feller much less aggressive.
This commit is contained in:
parent
ca3b7f2172
commit
f274d47c81
@ -121,29 +121,29 @@ public class WoodCutting
|
|||||||
}
|
}
|
||||||
private static boolean treeFellerCompatible(Block block)
|
private static boolean treeFellerCompatible(Block block)
|
||||||
{
|
{
|
||||||
return block.getType() == Material.LOG || block.getType() == Material.LEAVES;
|
return block.getType() == Material.LOG || block.getType() == Material.LEAVES || block.getType() == Material.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processTreeFelling(Block currentBlock, World world, ArrayList<Block> toBeFelled)
|
private static void processTreeFelling(Block currentBlock, World world, ArrayList<Block> toBeFelled)
|
||||||
{
|
{
|
||||||
int x = currentBlock.getX(), y = currentBlock.getY(), z = currentBlock.getZ();
|
int x = currentBlock.getX(), y = currentBlock.getY(), z = currentBlock.getZ();
|
||||||
|
toBeFelled.add(currentBlock);
|
||||||
|
|
||||||
|
//These 2 are to make sure that Tree Feller isn't so aggressive
|
||||||
|
boolean isAirOrLeaves = currentBlock.getType() == Material.LEAVES || currentBlock.getType() == Material.AIR;
|
||||||
|
|
||||||
toBeFelled.add(currentBlock);
|
|
||||||
|
|
||||||
//ORDER = X+, Z+, Z-, X-
|
|
||||||
Block xPositive = world.getBlockAt(x+1, y, z);
|
Block xPositive = world.getBlockAt(x+1, y, z);
|
||||||
Block xNegative = world.getBlockAt(x-1, y, z);
|
Block xNegative = world.getBlockAt(x-1, y, z);
|
||||||
Block zPositive = world.getBlockAt(x, y, z+1);
|
Block zPositive = world.getBlockAt(x, y, z+1);
|
||||||
Block zNegative = world.getBlockAt(x, y, z-1);
|
Block zNegative = world.getBlockAt(x, y, z-1);
|
||||||
|
|
||||||
if(treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive))
|
if(!isTooAgressive(isAirOrLeaves, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive))
|
||||||
processTreeFelling(xPositive, world, toBeFelled);
|
processTreeFelling(xPositive, world, toBeFelled);
|
||||||
if(treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative))
|
if(!isTooAgressive(isAirOrLeaves, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative))
|
||||||
processTreeFelling(xNegative, world, toBeFelled);
|
processTreeFelling(xNegative, world, toBeFelled);
|
||||||
if(treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive))
|
if(!isTooAgressive(isAirOrLeaves, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive))
|
||||||
processTreeFelling(zPositive, world, toBeFelled);
|
processTreeFelling(zPositive, world, toBeFelled);
|
||||||
if(treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative))
|
if(!isTooAgressive(isAirOrLeaves, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative))
|
||||||
processTreeFelling(zNegative, world, toBeFelled);
|
processTreeFelling(zNegative, world, toBeFelled);
|
||||||
|
|
||||||
//Finally go Y+
|
//Finally go Y+
|
||||||
@ -158,6 +158,11 @@ public class WoodCutting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isTooAgressive(boolean bool, Block block)
|
||||||
|
{
|
||||||
|
return bool && (block.getType() == Material.AIR || block.getType() == Material.LEAVES);
|
||||||
|
}
|
||||||
|
|
||||||
public static void woodCuttingProcCheck(Player player, Block block)
|
public static void woodCuttingProcCheck(Player player, Block block)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user