diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt index c250b3862..60d54ca09 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/JEIPlugin.kt @@ -75,7 +75,6 @@ class JEIPlugin : IModPlugin { val level = minecraft.level ?: throw NullPointerException("No ClientLevel. OLOLOLOLOLOLO") registration.addRecipes(PlatePressRecipeCategory.recipeType, level.recipeManager.getAllRecipesFor(MRecipes.PLATE_PRESS).filter { !it.isIncomplete }) - registration.addRecipes(RecipeTypes.CRAFTING, level.recipeManager.getAllRecipesFor(RecipeType.CRAFTING).filterIsInstance().map { it.parent }) } override fun registerRecipeTransferHandlers(registration: IRecipeTransferRegistration) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/EnergyContainerRecipe.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/EnergyContainerRecipe.kt index b230e97b9..138e93e22 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/EnergyContainerRecipe.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/EnergyContainerRecipe.kt @@ -1,11 +1,13 @@ package ru.dbotthepony.mc.otm.recipe import com.google.gson.JsonObject +import net.minecraft.core.NonNullList import net.minecraft.network.FriendlyByteBuf import net.minecraft.resources.ResourceLocation import net.minecraft.world.inventory.CraftingContainer import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.CraftingRecipe +import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.RecipeSerializer import net.minecraft.world.item.crafting.ShapedRecipe import net.minecraft.world.level.Level @@ -16,10 +18,17 @@ import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.tagNotNull class EnergyContainerRecipe( - val parent: ShapedRecipe -) : CraftingRecipe by parent { + p_44153_: ResourceLocation, + p_44154_: String, + p_44155_: Int, + p_44156_: Int, + p_44157_: NonNullList, + p_44158_: ItemStack, +) : ShapedRecipe(p_44153_, p_44154_, p_44155_, p_44156_, p_44157_, p_44158_) { + constructor(parent: ShapedRecipe) : this(parent.id, parent.group, parent.width, parent.height, parent.ingredients, parent.resultItem) + override fun assemble(container: CraftingContainer): ItemStack { - val itemStack = parent.assemble(container) + val itemStack = super.assemble(container) val battery = container.stream() .filter { !it.isEmpty } @@ -35,7 +44,7 @@ class EnergyContainerRecipe( } override fun matches(p_44002_: CraftingContainer, p_44003_: Level): Boolean { - return parent.matches(p_44002_, p_44003_) && !p_44002_.stream().anyMatch { it.isDamaged } + return super.matches(p_44002_, p_44003_) && !p_44002_.stream().anyMatch { it.isDamaged } } override fun getSerializer(): RecipeSerializer<*> { @@ -44,16 +53,15 @@ class EnergyContainerRecipe( companion object : RecipeSerializer { override fun fromJson(p_44103_: ResourceLocation, p_44104_: JsonObject): EnergyContainerRecipe { - return EnergyContainerRecipe(ShapedRecipe.Serializer.SHAPED_RECIPE.fromJson(p_44103_, p_44104_)) + return EnergyContainerRecipe(Serializer.SHAPED_RECIPE.fromJson(p_44103_, p_44104_)) } override fun fromNetwork(p_44105_: ResourceLocation, p_44106_: FriendlyByteBuf): EnergyContainerRecipe? { - return ShapedRecipe.Serializer.SHAPED_RECIPE.fromNetwork(p_44105_, p_44106_)?.let(::EnergyContainerRecipe) + return Serializer.SHAPED_RECIPE.fromNetwork(p_44105_, p_44106_)?.let(::EnergyContainerRecipe) } override fun toNetwork(p_44101_: FriendlyByteBuf, p_44102_: EnergyContainerRecipe) { - ShapedRecipe.Serializer.SHAPED_RECIPE.toNetwork(p_44101_, p_44102_.parent) + Serializer.SHAPED_RECIPE.toNetwork(p_44101_, p_44102_) } } - } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/PlatePressRecipe.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/PlatePressRecipe.kt index bde482193..9242d442e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/PlatePressRecipe.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/recipe/PlatePressRecipe.kt @@ -13,6 +13,7 @@ import net.minecraft.world.item.crafting.Recipe import net.minecraft.world.item.crafting.RecipeSerializer import net.minecraft.world.item.crafting.RecipeType import net.minecraft.world.level.Level +import net.minecraftforge.common.ForgeHooks import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.block.entity.PlatePressBlockEntity @@ -52,7 +53,7 @@ class PlatePressRecipe( } override fun isIncomplete(): Boolean { - return !(input.items.any { it.item != Items.BARRIER } && output.items.any { it.item != Items.BARRIER }) + return ForgeHooks.hasNoElements(input) || ForgeHooks.hasNoElements(output) } override fun assemble(p_44001_: Container): ItemStack = outputStack.copy()