Use isActuallyEmpty

This commit is contained in:
DBotThePony 2022-10-15 15:22:33 +07:00
parent 9459b398db
commit a688f775b8
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -18,6 +18,7 @@ import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.entity.PlatePressBlockEntity
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.core.registryName
@ -29,14 +30,14 @@ class PlatePressRecipe(
val workTime: Int = 200
) : Recipe<Container> {
override fun matches(container: Container, p_44003_: Level): Boolean {
if (output.isEmpty || input.isEmpty)
if (output.isActuallyEmpty || input.isActuallyEmpty)
return false
return input.test(container[PlatePressBlockEntity.SLOT_INPUT])
}
private val outputStack: ItemStack by lazy {
if (output.isEmpty || input.isEmpty) {
if (output.isActuallyEmpty || input.isActuallyEmpty) {
ItemStack.EMPTY
} else {
val items = output.items
@ -46,14 +47,14 @@ class PlatePressRecipe(
}
override fun getIngredients(): NonNullList<Ingredient> {
if (input.isEmpty || output.isEmpty)
if (input.isActuallyEmpty || output.isActuallyEmpty)
return super.getIngredients()
return NonNullList.of(Ingredient.EMPTY, input)
}
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()