From fe28e272850c9377b4df46a75fc4fc77c378b914 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Sun, 7 Apr 2024 04:29:40 +0200 Subject: [PATCH] Fix dupe on exact count custom recipe. --- src/main/kotlin/io/delilaheve/AnvilEventListener.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/io/delilaheve/AnvilEventListener.kt b/src/main/kotlin/io/delilaheve/AnvilEventListener.kt index dca6723..4de60f4 100644 --- a/src/main/kotlin/io/delilaheve/AnvilEventListener.kt +++ b/src/main/kotlin/io/delilaheve/AnvilEventListener.kt @@ -263,7 +263,8 @@ class AnvilEventListener : Listener { // Then we try to find the new values for the anvil val newAmount = getCustomRecipeAmount(recipe, leftItem, rightItem) - if(newAmount <= 0){ + CustomAnvil.verboseLog("new amount is $newAmount") + if(newAmount <= 0 || recipe.exactCount){ inventory.setItem(ANVIL_OUTPUT_SLOT, null) }else{ val resultItem: ItemStack = recipe.resultItem!!.clone() @@ -481,7 +482,15 @@ class AnvilEventListener : Listener { leftItem: ItemStack, rightItem: ItemStack? ): Int{ - return if(recipe.exactCount) { 1 } + return if(recipe.exactCount) { + if(leftItem.amount != recipe.leftItem!!.amount){ + 0 + }else if(rightItem != null && rightItem.amount != recipe.rightItem!!.amount){ + 0 + }else{ + 1 + } + } else { // test amount val resultItem = recipe.resultItem!! // we know exist as the recipe was returned to us