basic crafting grid gui stuff (no functionality yet)

This commit is contained in:
Raoul Van den Berge
2015-12-22 13:31:00 +01:00
parent 2c65adaaee
commit 7a99d963b0
9 changed files with 107 additions and 8 deletions

View File

@@ -1,7 +1,13 @@
package storagecraft.tile;
import net.minecraft.nbt.NBTTagCompound;
import storagecraft.inventory.InventorySimple;
import storagecraft.util.InventoryUtils;
public class TileGrid extends TileMachine
{
private InventorySimple craftingInventory = new InventorySimple("crafting", 10);
@Override
public int getEnergyUsage()
{
@@ -12,4 +18,35 @@ public class TileGrid extends TileMachine
public void updateMachine()
{
}
public int getType()
{
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
}
public boolean isCrafting()
{
return getType() == 1;
}
public InventorySimple getCraftingInventory()
{
return craftingInventory;
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
InventoryUtils.restoreInventory(craftingInventory, nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
InventoryUtils.saveInventory(craftingInventory, nbt);
}
}