fix: use TileMagicWorkbench as inventory (WTF)

This commit is contained in:
Timo Ley 2022-11-21 09:53:06 +01:00
parent d3936a3b4e
commit a5b3ad4d4c
2 changed files with 16 additions and 4 deletions

View file

@ -10,12 +10,13 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.common.tiles.TileArcaneWorkbench;
public class SlotCraftingArcaneWorkbench extends SlotCrafting {
private final IInventory craftMatrix;
private final TileArcaneWorkbench craftMatrix;
private EntityPlayer thePlayer;
public SlotCraftingArcaneWorkbench(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6) {
public SlotCraftingArcaneWorkbench(EntityPlayer par1EntityPlayer, TileArcaneWorkbench par2IInventory, IInventory par3IInventory, int par4, int par5, int par6) {
super(par1EntityPlayer, par2IInventory, par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;

View file

@ -6,10 +6,11 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.common.tiles.TileMagicWorkbench;
public class AuracoreCraftingManager {
public static IArcaneRecipe findMatchingArcaneRecipe(IInventory awb, EntityPlayer player) {
public static IArcaneRecipe findMatchingArcaneRecipe(TileMagicWorkbench awb, EntityPlayer player) {
for (Object recipe : ThaumcraftApi.getCraftingRecipes()) {
if (recipe instanceof IArcaneRecipe && ((IArcaneRecipe)recipe).matches(awb, player.worldObj, player)) {
return (IArcaneRecipe) recipe;
@ -19,7 +20,7 @@ public class AuracoreCraftingManager {
return null;
}
public static int getArcaneRecipeVisCost(IArcaneRecipe recipe, IInventory awb) {
public static int getArcaneRecipeVisCost(IArcaneRecipe recipe, TileMagicWorkbench awb) {
if (recipe == null) return 0;
int sum = 0;
AspectList aspects = recipe.getAspects(awb);
@ -29,4 +30,14 @@ public class AuracoreCraftingManager {
return sum;
}
public static TileMagicWorkbench createBridgeInventory(IInventory sourceInventory, int firstSlotIndex, int gridSize )
{
TileMagicWorkbench workbenchTile = new TileMagicWorkbench();
for( int i = 0; i < gridSize; i++ )
{
workbenchTile.setInventorySlotContentsSoftly( i, sourceInventory.getStackInSlot( i + firstSlotIndex ) );
}
return workbenchTile;
}
}