crafting works, still have to make it so it gets from the network

This commit is contained in:
Raoul Van den Berge
2015-12-22 13:54:21 +01:00
parent 7a99d963b0
commit f502595758
5 changed files with 64 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package storagecraft.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import storagecraft.container.slot.SlotGridCraftingResult;
import storagecraft.tile.TileGrid;
public class ContainerGrid extends ContainerBase
@@ -17,7 +18,7 @@ public class ContainerGrid extends ContainerBase
for (int i = 0; i < 9; ++i)
{
addSlotToContainer(new Slot(grid.getCraftingInventory(), i, x, y));
addSlotToContainer(new Slot(grid.getCraftingMatrix(), i, x, y));
x += 18;
@@ -28,7 +29,7 @@ public class ContainerGrid extends ContainerBase
}
}
addSlotToContainer(new Slot(grid.getCraftingInventory(), 9, 125, 124));
addSlotToContainer(new SlotGridCraftingResult(player, grid.getCraftingMatrix(), grid.getCraftingResult(), 0, 125, 124));
}
addPlayerInventory(8, grid.isCrafting() ? 174 : 108);

View File

@@ -0,0 +1,28 @@
package storagecraft.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import storagecraft.tile.TileGrid;
public class ContainerGridCrafting extends Container
{
private TileGrid grid;
public ContainerGridCrafting(TileGrid grid)
{
this.grid = grid;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return false;
}
@Override
public void onCraftMatrixChanged(IInventory inventory)
{
grid.onCraftingMatrixChanged();
}
}

View File

@@ -0,0 +1,13 @@
package storagecraft.container.slot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.SlotCrafting;
public class SlotGridCraftingResult extends SlotCrafting
{
public SlotGridCraftingResult(EntityPlayer player, IInventory craftingMatrix, IInventory craftingResult, int id, int x, int y)
{
super(player, craftingMatrix, craftingResult, id, x, y);
}
}