crafting works, still have to make it so it gets from the network
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package storagecraft.tile;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import storagecraft.container.ContainerGridCrafting;
|
||||
import storagecraft.inventory.InventorySimple;
|
||||
import storagecraft.util.InventoryUtils;
|
||||
|
||||
public class TileGrid extends TileMachine
|
||||
{
|
||||
private InventorySimple craftingInventory = new InventorySimple("crafting", 10);
|
||||
private InventoryCrafting craftingMatrix = new InventoryCrafting(new ContainerGridCrafting(this), 3, 3);
|
||||
private InventorySimple craftingResult = new InventorySimple("craftingResult", 1);
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage()
|
||||
@@ -29,9 +33,19 @@ public class TileGrid extends TileMachine
|
||||
return getType() == 1;
|
||||
}
|
||||
|
||||
public InventorySimple getCraftingInventory()
|
||||
public InventoryCrafting getCraftingMatrix()
|
||||
{
|
||||
return craftingInventory;
|
||||
return craftingMatrix;
|
||||
}
|
||||
|
||||
public void onCraftingMatrixChanged()
|
||||
{
|
||||
craftingResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftingMatrix, worldObj));
|
||||
}
|
||||
|
||||
public InventorySimple getCraftingResult()
|
||||
{
|
||||
return craftingResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +53,7 @@ public class TileGrid extends TileMachine
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
InventoryUtils.restoreInventory(craftingInventory, nbt);
|
||||
InventoryUtils.restoreInventory(craftingMatrix, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,6 +61,6 @@ public class TileGrid extends TileMachine
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
InventoryUtils.saveInventory(craftingInventory, nbt);
|
||||
InventoryUtils.saveInventory(craftingMatrix, nbt);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user