mirror of
https://github.com/songoda/UltimateTimber.git
synced 2025-03-14 07:29:05 +01:00
Misc bug fixes
This commit is contained in:
parent
119e54ad28
commit
8988679f2a
@ -60,7 +60,7 @@ public class CurrentAdapter implements VersionAdapter {
|
||||
@Override
|
||||
public void applyToolDurability(Player player, int damage) {
|
||||
ItemStack tool = this.getItemInHand(player);
|
||||
if (!tool.hasItemMeta() || !(tool.getItemMeta() instanceof Damageable) || tool.getType().getMaxDurability() < 1)
|
||||
if (tool.getType().getMaxDurability() < 1)
|
||||
return;
|
||||
|
||||
int unbreakingLevel = tool.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||
|
@ -128,10 +128,10 @@ public class TreeDefinitionManager extends Manager {
|
||||
this.globalLeafLoot.add(this.getTreeLootEntry(versionAdapter, TreeBlockType.LEAF, leafSection.getConfigurationSection(lootKey)));
|
||||
|
||||
// Load global entire tree drops
|
||||
ConfigurationSection entireTreeSection = config.getConfigurationSection("global-leaf-loot");
|
||||
ConfigurationSection entireTreeSection = config.getConfigurationSection("global-entire-tree-loot");
|
||||
if (entireTreeSection != null)
|
||||
for (String lootKey : entireTreeSection.getKeys(false))
|
||||
this.globalEntireTreeLoot.add(this.getTreeLootEntry(versionAdapter, TreeBlockType.LEAF, entireTreeSection.getConfigurationSection(lootKey)));
|
||||
this.globalEntireTreeLoot.add(this.getTreeLootEntry(versionAdapter, TreeBlockType.LOG, entireTreeSection.getConfigurationSection(lootKey)));
|
||||
|
||||
// Load global tools
|
||||
for (String itemStackString : config.getStringList("global-required-tools"))
|
||||
|
@ -98,6 +98,14 @@ public class TreeDetectionManager extends Manager {
|
||||
possibleTreeDefinitions.retainAll(this.treeDefinitionManager.narrowTreeDefinition(possibleTreeDefinitions, targetBlock, TreeBlockType.LOG));
|
||||
}
|
||||
|
||||
if (!this.onlyBreakLogsUpwards) {
|
||||
targetBlock = initialBlock;
|
||||
while (this.isValidLogType(possibleTreeDefinitions, null, (targetBlock = targetBlock.getRelative(BlockFace.DOWN)))) {
|
||||
trunkBlocks.add(targetBlock);
|
||||
possibleTreeDefinitions.retainAll(this.treeDefinitionManager.narrowTreeDefinition(possibleTreeDefinitions, targetBlock, TreeBlockType.LOG));
|
||||
}
|
||||
}
|
||||
|
||||
// Lowest blocks at the front of the list
|
||||
Collections.reverse(trunkBlocks);
|
||||
|
||||
@ -256,6 +264,8 @@ public class TreeDetectionManager extends Manager {
|
||||
Location location = block.getLocation();
|
||||
for (TreeDefinition treeDefinition : treeDefinitions) {
|
||||
double maxDistance = treeDefinition.getMaxLogDistanceFromTrunk() * treeDefinition.getMaxLogDistanceFromTrunk();
|
||||
if (!this.onlyBreakLogsUpwards) // Help detect logs more often if the tree isn't broken at the base
|
||||
maxDistance *= 1.5;
|
||||
for (Block trunkBlock : trunkBlocks)
|
||||
if (location.distanceSquared(trunkBlock.getLocation()) < maxDistance)
|
||||
return true;
|
||||
|
@ -47,7 +47,7 @@ protect-tool: false
|
||||
apply-silk-touch: true
|
||||
|
||||
# Damage the tool extra for each leaf block broken, this is vanilla behavior but can be disabled here
|
||||
# Note: Does nothing if realistic-tool-damage is false
|
||||
# Does nothing if realistic-tool-damage is false
|
||||
# Default: true
|
||||
apply-silk-touch-tool-damage: true
|
||||
|
||||
@ -82,6 +82,7 @@ player-tree-topple-cooldown: false
|
||||
|
||||
# The amount of seconds a player has to wait before they can chop a tree again
|
||||
# Does nothing if player-tree-topple-cooldown is false
|
||||
# The time is in seconds and must be a postive whole number
|
||||
# Default: 5
|
||||
player-tree-topple-cooldown-length: 5
|
||||
|
||||
@ -100,6 +101,7 @@ always-replant-sapling: false
|
||||
# How many seconds to prevent players from breaking replanted saplings
|
||||
# Set to 0 to disable
|
||||
# Does nothing if replant-saplings is false
|
||||
# The time is in seconds and must be a postive whole number
|
||||
# Default: 3
|
||||
replant-saplings-cooldown: 3
|
||||
|
||||
|
@ -48,7 +48,7 @@ protect-tool: false
|
||||
apply-silk-touch: true
|
||||
|
||||
# Damage the tool extra for each leaf block broken, this is vanilla behavior but can be disabled here
|
||||
# Note: Does nothing if realistic-tool-damage is false
|
||||
# Does nothing if realistic-tool-damage is false
|
||||
# Default: true
|
||||
apply-silk-touch-tool-damage: true
|
||||
|
||||
@ -83,6 +83,7 @@ player-tree-topple-cooldown: false
|
||||
|
||||
# The amount of seconds a player has to wait before they can chop a tree again
|
||||
# Does nothing if player-tree-topple-cooldown is false
|
||||
# The time is in seconds and must be a postive whole number
|
||||
# Default: 5
|
||||
player-tree-topple-cooldown-length: 5
|
||||
|
||||
@ -101,6 +102,7 @@ always-replant-sapling: false
|
||||
# How many seconds to prevent players from breaking replanted saplings
|
||||
# Set to 0 to disable
|
||||
# Does nothing if replant-saplings is false
|
||||
# The time is in seconds and must be a postive whole number
|
||||
# Default: 3
|
||||
replant-saplings-cooldown: 3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user