Fixed MMOCore not decreasing durability on custom mining/fishing if the item has full durability

This commit is contained in:
ASangarin 2021-01-02 07:35:00 +01:00
parent 041fc7b5e1
commit ad23380c1f

View File

@ -132,7 +132,6 @@ public class MMOCoreUtils {
* chunk (worst case border of 4 chunks), the entity will still be included * chunk (worst case border of 4 chunks), the entity will still be included
*/ */
public static List<Entity> getNearbyChunkEntities(Location loc) { public static List<Entity> getNearbyChunkEntities(Location loc) {
/* /*
* another method to save performance is if an entity bounding box * another method to save performance is if an entity bounding box
* calculation is made twice in the same tick then the method does not * calculation is made twice in the same tick then the method does not
@ -191,7 +190,6 @@ public class MMOCoreUtils {
} }
public static void heal(LivingEntity target, double value) { public static void heal(LivingEntity target, double value) {
double max = target.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); double max = target.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
double gain = Math.min(max, target.getHealth() + value) - target.getHealth(); double gain = Math.min(max, target.getHealth() + value) - target.getHealth();
@ -220,7 +218,7 @@ public class MMOCoreUtils {
return; return;
NBTItem nbt = NBTItem.get(item); NBTItem nbt = NBTItem.get(item);
if (!nbt.getBoolean("Unbreakable") && item.hasItemMeta() && item.getItemMeta() instanceof Damageable) { if (!nbt.getBoolean("Unbreakable") && item.getItemMeta() instanceof Damageable) {
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
((Damageable) meta).setDamage(((Damageable) meta).getDamage() + damage); ((Damageable) meta).setDamage(((Damageable) meta).getDamage() + damage);
item.setItemMeta(meta); item.setItemMeta(meta);