From 4057094df7ba8ad9f35883a394510a0b9166804b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 22 Nov 2022 11:28:08 +0000 Subject: [PATCH] Fixed bug with anvil --- .../kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt index e85b3bd9..dc690a5f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt @@ -225,7 +225,8 @@ class AnvilSupport( } // Item repair - extra check for unit repair cost to prevent weird damage - if (leftMeta is Damageable && rightMeta is Damageable && unitRepairCost == 0) { + // Enchanted books seem to be damageable? Not quite sure why. Anyway, there's an extra check. + if (leftMeta is Damageable && rightMeta is Damageable && unitRepairCost == 0 && rightMeta !is EnchantmentStorageMeta) { val maxDamage = left.type.maxDurability.toInt() val leftDurability = maxDamage - leftMeta.damage val rightDurability = maxDamage - rightMeta.damage