2015-04-14 01:12:24 +02:00
|
|
|
package techreborn.client.container;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-04-15 18:27:05 +02:00
|
|
|
import net.minecraft.inventory.IInventory;
|
2015-04-14 01:12:24 +02:00
|
|
|
import net.minecraft.inventory.Slot;
|
2015-04-15 18:27:05 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import techreborn.api.RollingMachineRecipe;
|
|
|
|
import techreborn.client.SlotFake;
|
2015-04-15 17:23:12 +02:00
|
|
|
import techreborn.client.SlotOutput;
|
|
|
|
import techreborn.tiles.TileRollingMachine;
|
2015-04-14 01:12:24 +02:00
|
|
|
|
2015-04-15 17:23:12 +02:00
|
|
|
public class ContainerRollingMachine extends TechRebornContainer {
|
|
|
|
|
|
|
|
EntityPlayer player;
|
|
|
|
TileRollingMachine tile;
|
|
|
|
|
|
|
|
public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player) {
|
|
|
|
tile = tileRollingmachine;
|
|
|
|
this.player = player;
|
|
|
|
|
2015-04-15 18:27:05 +02:00
|
|
|
|
|
|
|
for (int l = 0; l < 3; l++) {
|
|
|
|
for (int k1 = 0; k1 < 3; k1++) {
|
|
|
|
this.addSlotToContainer(new Slot(tileRollingmachine.craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//output
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
|
|
|
|
|
|
|
|
//fakeOutput
|
|
|
|
this.addSlotToContainer(new SlotFake(tileRollingmachine.inventory, 1, 124, 10, false, false, 1));
|
2015-04-15 17:23:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
|
|
for (int j = 0; j < 9; ++j) {
|
|
|
|
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 9; ++i) {
|
|
|
|
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canInteractWith(EntityPlayer player) {
|
|
|
|
return true;
|
|
|
|
}
|
2015-04-14 01:12:24 +02:00
|
|
|
|
2015-04-15 18:27:05 +02:00
|
|
|
@Override
|
|
|
|
public final void onCraftMatrixChanged(IInventory inv) {
|
|
|
|
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(tile.craftMatrix, tile.getWorldObj());
|
|
|
|
tile.inventory.setInventorySlotContents(1, output);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-14 01:12:24 +02:00
|
|
|
}
|