Skip to content

Commit

Permalink
fix: 中空のアイテムや階段のレシピを複製できないバグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Ponzu-IKA committed Nov 2, 2024
1 parent 0d68ecb commit 0e0994e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.trc.clayium.common.pan.factories
import com.github.trc.clayium.api.ClayEnergy
import com.github.trc.clayium.api.pan.IPanRecipe
import com.github.trc.clayium.api.pan.IPanRecipeFactory
import com.github.trc.clayium.api.util.CLog
import com.github.trc.clayium.api.util.copyWithSize
import com.github.trc.clayium.common.pan.PanRecipe
import com.github.trc.clayium.common.recipe.ingredient.CItemRecipeInput
Expand Down Expand Up @@ -31,11 +32,13 @@ object CraftingTablePanRecipeFactory : IPanRecipeFactory {
val inputs = recipe.ingredients.map { ingredient ->
// field `matchingStacks` and method `getMatchingStacks` is not the same.
// `matchingStacks` is an empty list in OreIngredient.
val stacks = ingredient.getMatchingStacks()
val stacks2 = ingredient.getMatchingStacks()
// todo: use cached recipe inputs instead of creating new one
CItemRecipeInput(stacks.map { it.copyWithSize(1) }, 1)
CItemRecipeInput(stacks2.map { it.copyWithSize(1)}, 1)
}

return PanRecipe(inputs, listOf(output), ENERGY)
CLog.info(inputs.toList())

return PanRecipe(inputs.filter { it.stacks.isNotEmpty() }, listOf(output), ENERGY)
}
}

0 comments on commit 0e0994e

Please sign in to comment.