2015-04-13 19:40:13 +02:00
|
|
|
package techreborn.client.container;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-04-14 09:35:44 +02:00
|
|
|
import net.minecraft.inventory.ICrafting;
|
2015-04-13 19:40:13 +02:00
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
import techreborn.client.SlotOutput;
|
|
|
|
import techreborn.tiles.TileCentrifuge;
|
|
|
|
|
|
|
|
public class ContainerCentrifuge extends TechRebornContainer {
|
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
EntityPlayer player;
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
TileCentrifuge tile;
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
public int tickTime;
|
2015-04-14 09:35:44 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
public ContainerCentrifuge(TileCentrifuge tileCentrifuge,
|
|
|
|
EntityPlayer player)
|
|
|
|
{
|
|
|
|
tile = tileCentrifuge;
|
|
|
|
this.player = player;
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
// input
|
|
|
|
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 0, 80, 35));
|
|
|
|
// cells
|
|
|
|
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 1, 50, 5));
|
|
|
|
// outputs
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80,
|
|
|
|
5));
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3,
|
|
|
|
110, 35));
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80,
|
|
|
|
65));
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50,
|
|
|
|
35));
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
int i;
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
for (i = 0; i < 9; ++i)
|
|
|
|
{
|
|
|
|
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
|
|
|
142));
|
|
|
|
}
|
|
|
|
}
|
2015-04-13 19:40:13 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@Override
|
|
|
|
public boolean canInteractWith(EntityPlayer player)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-04-14 09:35:44 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@Override
|
|
|
|
public void addCraftingToCrafters(ICrafting crafting)
|
|
|
|
{
|
|
|
|
super.addCraftingToCrafters(crafting);
|
|
|
|
crafting.sendProgressBarUpdate(this, 0, tile.tickTime);
|
|
|
|
}
|
2015-04-14 09:35:44 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
/**
|
|
|
|
* Looks for changes made in the container, sends them to every listener.
|
|
|
|
*/
|
|
|
|
public void detectAndSendChanges()
|
|
|
|
{
|
|
|
|
super.detectAndSendChanges();
|
|
|
|
for (int i = 0; i < this.crafters.size(); ++i)
|
|
|
|
{
|
|
|
|
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
|
|
|
if (this.tickTime != this.tile.tickTime)
|
|
|
|
{
|
|
|
|
icrafting.sendProgressBarUpdate(this, 0, this.tile.tickTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.tickTime = this.tile.tickTime;
|
|
|
|
}
|
2015-04-13 19:40:13 +02:00
|
|
|
}
|