Bug fixes

This commit is contained in:
Esophose 2019-04-28 22:43:13 -06:00
parent 4b35f0ee4e
commit 53ba40fb65
2 changed files with 5 additions and 4 deletions

View File

@ -22,7 +22,8 @@ public class TreeBlockSet<BlockType> implements Collection {
this.logBlocks = new HashSet<>();
this.leafBlocks = new HashSet<>();
this.logBlocks.add(initialLogBlock);
if (initialLogBlock != null)
this.logBlocks.add(initialLogBlock);
}
/**

View File

@ -105,7 +105,7 @@ public class TreeDetectionManager extends Manager {
// Detect branches off the main trunk
for (Block trunkBlock : trunkBlocks)
this.recursiveBranchSearch(possibleTreeDefinitions, detectedTreeBlocks, trunkBlock, initialBlock.getY());
this.recursiveBranchSearch(possibleTreeDefinitions, detectedTreeBlocks, trunkBlock, initialBlock.getLocation().getBlockY());
// Detect leaves off the trunk/branches
Set<ITreeBlock<Block>> branchBlocks = new HashSet<>(detectedTreeBlocks.getLogBlocks());
@ -123,7 +123,7 @@ public class TreeDetectionManager extends Manager {
if (this.entireTreeBase) {
Set<Block> groundBlocks = new HashSet<>();
for (ITreeBlock<Block> treeBlock : detectedTreeBlocks.getLogBlocks())
if (treeBlock.getLocation().getBlockY() == initialBlock.getLocation().getBlockY())
if (treeBlock != detectedTreeBlocks.getInitialLogBlock() && treeBlock.getLocation().getBlockY() == initialBlock.getLocation().getBlockY())
groundBlocks.add(treeBlock.getBlock());
for (Block block : groundBlocks) {
@ -137,7 +137,7 @@ public class TreeDetectionManager extends Manager {
}
}
if (!blockBelowIsLog && blockBelowIsSoil)
if (blockBelowIsLog || blockBelowIsSoil)
return null;
}
}