Skip to content

Commit

Permalink
Some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
DuchLord committed Nov 1, 2016
1 parent 63f4026 commit ed54612
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/treechopper/common/handler/TreeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,26 @@ public boolean destroyBlockOverr(BlockPos pos, boolean dropBlock, World world) {

public int treeDestroy(BlockEvent.BreakEvent event) {
int logCount = tree.size();
int soundMuter = 0;
boolean destruction;
Map<String, Integer> leafVariantCount = new HashMap<String, Integer>();

for (BlockPos blockPos : tree) {

if (blockPos.getX() != event.getPos().getX() || blockPos.getY() != event.getPos().getY() || blockPos.getZ() != event.getPos().getZ()) {
destruction = event.getWorld().destroyBlock(blockPos, true);

// DESTROY WOOD
if (soundMuter <= 2)
destruction = event.getWorld().destroyBlock(blockPos, true);
else
destruction = destroyBlockOverr(blockPos, true, event.getWorld());
if (!destruction)
System.out.println("Problem with block.. " + blockPos);
event.getWorld().setBlockToAir(blockPos);
//
}

soundMuter++;
}

if (!ConfigHandler.decayLeaves) {
Expand Down Expand Up @@ -234,7 +243,7 @@ public int treeDestroy(BlockEvent.BreakEvent event) {
leaves.add(blockPos);
}

int soundMuter = 0;
soundMuter = 0;
for (BlockPos blockPos : leaves) {
if (event.getWorld().getBlockState(blockPos).getPropertyNames().toString().contains("variant"))
leafVariant = event.getWorld().getBlockState(blockPos).getValue(event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant")).toString().toUpperCase();
Expand Down

0 comments on commit ed54612

Please sign in to comment.