Use isActuallyEmpty
This commit is contained in:
parent
9459b398db
commit
a688f775b8
@ -18,6 +18,7 @@ import org.apache.logging.log4j.LogManager
|
|||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
import ru.dbotthepony.mc.otm.block.entity.PlatePressBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.PlatePressBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.container.get
|
import ru.dbotthepony.mc.otm.container.get
|
||||||
|
import ru.dbotthepony.mc.otm.core.isActuallyEmpty
|
||||||
import ru.dbotthepony.mc.otm.registry.MRecipes
|
import ru.dbotthepony.mc.otm.registry.MRecipes
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
|
|
||||||
@ -29,14 +30,14 @@ class PlatePressRecipe(
|
|||||||
val workTime: Int = 200
|
val workTime: Int = 200
|
||||||
) : Recipe<Container> {
|
) : Recipe<Container> {
|
||||||
override fun matches(container: Container, p_44003_: Level): Boolean {
|
override fun matches(container: Container, p_44003_: Level): Boolean {
|
||||||
if (output.isEmpty || input.isEmpty)
|
if (output.isActuallyEmpty || input.isActuallyEmpty)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return input.test(container[PlatePressBlockEntity.SLOT_INPUT])
|
return input.test(container[PlatePressBlockEntity.SLOT_INPUT])
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outputStack: ItemStack by lazy {
|
private val outputStack: ItemStack by lazy {
|
||||||
if (output.isEmpty || input.isEmpty) {
|
if (output.isActuallyEmpty || input.isActuallyEmpty) {
|
||||||
ItemStack.EMPTY
|
ItemStack.EMPTY
|
||||||
} else {
|
} else {
|
||||||
val items = output.items
|
val items = output.items
|
||||||
@ -46,14 +47,14 @@ class PlatePressRecipe(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getIngredients(): NonNullList<Ingredient> {
|
override fun getIngredients(): NonNullList<Ingredient> {
|
||||||
if (input.isEmpty || output.isEmpty)
|
if (input.isActuallyEmpty || output.isActuallyEmpty)
|
||||||
return super.getIngredients()
|
return super.getIngredients()
|
||||||
|
|
||||||
return NonNullList.of(Ingredient.EMPTY, input)
|
return NonNullList.of(Ingredient.EMPTY, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isIncomplete(): Boolean {
|
override fun isIncomplete(): Boolean {
|
||||||
return ForgeHooks.hasNoElements(input) || ForgeHooks.hasNoElements(output)
|
return input.isActuallyEmpty || output.isActuallyEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun assemble(p_44001_: Container): ItemStack = outputStack.copy()
|
override fun assemble(p_44001_: Container): ItemStack = outputStack.copy()
|
||||||
|
Loading…
Reference in New Issue
Block a user