mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
Fix dupe on exact count custom recipe.
This commit is contained in:
parent
a646d5ab02
commit
fe28e27285
1 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue