diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRecipeSearchEvent.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRecipeSearchEvent.java index f8673abd7..0b204fc4f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRecipeSearchEvent.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRecipeSearchEvent.java @@ -5,20 +5,19 @@ import java.util.function.Supplier; import javax.annotation.Nullable; -import com.simibubi.create.foundation.utility.recipe.TileEntityAwareRecipeWrapper; - import net.minecraft.inventory.IInventory; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.items.wrapper.RecipeWrapper; public class DeployerRecipeSearchEvent extends Event { private final DeployerTileEntity tileEntity; - private final TileEntityAwareRecipeWrapper inventory; + private final RecipeWrapper inventory; @Nullable IRecipe recipe = null; private int maxPriority = 0; - public DeployerRecipeSearchEvent(DeployerTileEntity tileEntity, TileEntityAwareRecipeWrapper inventory) { + public DeployerRecipeSearchEvent(DeployerTileEntity tileEntity, RecipeWrapper inventory) { this.tileEntity = tileEntity; this.inventory = inventory; } @@ -32,7 +31,7 @@ public class DeployerRecipeSearchEvent extends Event { return tileEntity; } - public TileEntityAwareRecipeWrapper getInventory() { + public RecipeWrapper getInventory() { return inventory; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java index a68df86a8..22e7c28e7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java @@ -25,8 +25,6 @@ import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; -import com.simibubi.create.foundation.utility.recipe.TileEntityAwareRecipeWrapper; - import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.IInventory; @@ -48,7 +46,6 @@ import net.minecraft.util.math.RayTraceContext.FluidMode; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; @@ -441,7 +438,7 @@ public class DeployerTileEntity extends KineticTileEntity { animatedOffset.setValue(offset); } - TileEntityAwareRecipeWrapper recipeInv = new TileEntityAwareRecipeWrapper(new ItemStackHandler(2), this); + RecipeWrapper recipeInv = new RecipeWrapper(new ItemStackHandler(2)); SandPaperInv sandpaperInv = new SandPaperInv(ItemStack.EMPTY); @Nullable @@ -466,9 +463,9 @@ public class DeployerTileEntity extends KineticTileEntity { DeployerRecipeSearchEvent event = new DeployerRecipeSearchEvent(this, recipeInv); // creates deployer recipes - event.addRecipe(() -> SequencedAssemblyRecipe.getRecipe(level, recipeInv, + event.addRecipe(() -> SequencedAssemblyRecipe.getRecipe(level, event.getInventory(), AllRecipeTypes.DEPLOYING.getType(), DeployerApplicationRecipe.class), 100); - event.addRecipe(() -> AllRecipeTypes.DEPLOYING.find(recipeInv, level), 50); + event.addRecipe(() -> AllRecipeTypes.DEPLOYING.find(event.getInventory(), level), 50); // post the event, get result MinecraftForge.EVENT_BUS.post(event); diff --git a/src/main/java/com/simibubi/create/foundation/utility/recipe/TileEntityAwareRecipeWrapper.java b/src/main/java/com/simibubi/create/foundation/utility/recipe/TileEntityAwareRecipeWrapper.java deleted file mode 100644 index 143924e86..000000000 --- a/src/main/java/com/simibubi/create/foundation/utility/recipe/TileEntityAwareRecipeWrapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.simibubi.create.foundation.utility.recipe; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.items.IItemHandlerModifiable; -import net.minecraftforge.items.wrapper.RecipeWrapper; - -import java.util.function.Supplier; - -public class TileEntityAwareRecipeWrapper extends RecipeWrapper implements Supplier { - private final TileEntity tileEntity; - - public TileEntityAwareRecipeWrapper(IItemHandlerModifiable inv, TileEntity tileEntity) { - super(inv); - this.tileEntity = tileEntity; - } - - @Override - public TileEntity get() { - return tileEntity; - } -}