diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/ShapedRecipeListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/ShapedRecipeListener.kt index 4b77582f..7c2bf477 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/ShapedRecipeListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/ShapedRecipeListener.kt @@ -49,15 +49,13 @@ class ShapedRecipeListener : Listener { } isStackedRecipe = true } else if (inMatrix != null) { - val max = Math.floorDiv(inMatrix.amount, inRecipe.item.amount) + val max = inMatrix.amount if (max < upperBound) { upperBound = max } - isStackedRecipe = true } } - if (!isStackedRecipe) { return } @@ -68,10 +66,8 @@ class ShapedRecipeListener : Listener { upperBound-- } - val newMatrix = matrix; - for (i in 0..8) { - val inMatrix = matrix[i] + val inMatrix = event.inventory.matrix[i] val inRecipe = matched.parts[i] if (inRecipe is TestableStack) { @@ -80,35 +76,13 @@ class ShapedRecipeListener : Listener { for (j in 0..upperBound) { amount -= inRecipe.amount } - inMatrix.amount = amount; - newMatrix[i] = inMatrix - + inMatrix.amount = amount } else { inMatrix.amount = inMatrix.amount - (inRecipe.amount - 1) - newMatrix[i] = inMatrix - } - } else { - @Suppress("SENSELESS_COMPARISON") - if (inMatrix == null) { - continue - } - - if (event.isShiftClick) { - var amount = inMatrix.amount + 1 - for (j in 0..upperBound) { - amount -= inRecipe.item.amount - } - inMatrix.amount = amount; - newMatrix[i] = inMatrix - } else { - inMatrix.amount = inMatrix.amount - (inRecipe.item.amount - 1) - newMatrix[i] = inMatrix } } } - event.inventory.matrix = newMatrix; - if (event.isShiftClick) { val result = event.inventory.result ?: return @@ -161,4 +135,4 @@ class ShapedRecipeListener : Listener { listeners.add(listener) } } -} \ No newline at end of file +}