mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-13 05:54:17 +01:00
Simplify the event to not include a te aware inventory
This commit is contained in:
parent
df0b9c3a17
commit
f0736bdc41
@ -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<? extends IInventory> 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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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<TileEntity> {
|
||||
private final TileEntity tileEntity;
|
||||
|
||||
public TileEntityAwareRecipeWrapper(IItemHandlerModifiable inv, TileEntity tileEntity) {
|
||||
super(inv);
|
||||
this.tileEntity = tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity get() {
|
||||
return tileEntity;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user