Handle tool unbreaking tags in 1.9+

This commit is contained in:
Esophose 2019-06-15 16:27:04 -06:00
parent 0b57057b4d
commit 2524442911
3 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ public class CurrentAdapter implements VersionAdapter {
@Override
public void applyToolDurability(Player player, int damage) {
ItemStack tool = this.getItemInHand(player);
if (tool.getType().getMaxDurability() < 1)
if (tool.getType().getMaxDurability() < 1 || (tool.getItemMeta() != null && tool.getItemMeta().isUnbreakable()))
return;
int unbreakingLevel = tool.getEnchantmentLevel(Enchantment.DURABILITY);

View File

@ -106,7 +106,7 @@ public class LegacyAdapter implements VersionAdapter {
@Override
public void applyToolDurability(Player player, int damage) {
ItemStack tool = this.getItemInHand(player);
if (tool.getType().getMaxDurability() < 1)
if (tool.getType().getMaxDurability() < 1 || (NMSUtil.getVersionNumber() > 8 && tool.getItemMeta() != null && tool.getItemMeta().isUnbreakable()))
return;
int unbreakingLevel = tool.getEnchantmentLevel(Enchantment.DURABILITY);

View File

@ -212,7 +212,7 @@ trees:
- LEAVES:1,5,9,13
sapling: SAPLING:1
plantable-soil: []
max-log-distance-from-trunk: 1
max-log-distance-from-trunk: 2
max-leaf-distance-from-log: 6
search-for-leaves-diagonally: false
drop-original-log: true