Fix matter manager recipe finder creating item stacks with infinite cost
This commit is contained in:
parent
9efad96aff
commit
1c7abed6e9
@ -546,6 +546,12 @@ object MatterManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream.map {
|
stream.map {
|
||||||
|
// avoid reality snap when recipe has no output
|
||||||
|
val resultItem = it.getResultItem(server.registryAccess())
|
||||||
|
|
||||||
|
if (resultItem.isEmpty) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
val width: Int
|
val width: Int
|
||||||
val height: Int
|
val height: Int
|
||||||
|
|
||||||
@ -603,12 +609,13 @@ object MatterManager {
|
|||||||
|
|
||||||
ResolvedRecipe(
|
ResolvedRecipe(
|
||||||
realIngredients.stream().map { it.stream() },
|
realIngredients.stream().map { it.stream() },
|
||||||
ImmutableStack(it.getResultItem(server.registryAccess())),
|
ImmutableStack(resultItem),
|
||||||
isCritical = isCritical,
|
isCritical = isCritical,
|
||||||
name = it.id,
|
name = it.id,
|
||||||
allowBacktrack = allowBacktrack
|
allowBacktrack = allowBacktrack
|
||||||
)
|
)
|
||||||
}.filter {
|
}
|
||||||
|
}.filterNotNull().filter {
|
||||||
if (it.inputs.isEmpty()) {
|
if (it.inputs.isEmpty()) {
|
||||||
LOGGER.warn("${it.formattedName} with output '${it.output.item.registryName}' ended up with no inputs!")
|
LOGGER.warn("${it.formattedName} with output '${it.output.item.registryName}' ended up with no inputs!")
|
||||||
false
|
false
|
||||||
@ -1388,6 +1395,11 @@ object MatterManager {
|
|||||||
val item: Item,
|
val item: Item,
|
||||||
val multiplier: Double = 1.0
|
val multiplier: Double = 1.0
|
||||||
) {
|
) {
|
||||||
|
init {
|
||||||
|
require(!multiplier.isNaN()) { "Provided stack cost multiplier is NaN" }
|
||||||
|
require(!multiplier.isInfinite()) { "Provided stack cost multiplier is infinite" }
|
||||||
|
}
|
||||||
|
|
||||||
constructor(item: Item, count: Int) : this(item, 1.0 / count.toDouble())
|
constructor(item: Item, count: Int) : this(item, 1.0 / count.toDouble())
|
||||||
constructor(item: ItemStack) : this(item.item, item.count)
|
constructor(item: ItemStack) : this(item.item, item.count)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user