2015-11-17 22:48:06 +01:00
|
|
|
package techreborn.client.container;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.inventory.ICrafting;
|
|
|
|
import net.minecraft.inventory.Slot;
|
2015-11-23 20:19:18 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-11-17 22:48:06 +01:00
|
|
|
import reborncore.client.gui.SlotOutput;
|
|
|
|
import techreborn.tiles.TileVacuumFreezer;
|
|
|
|
|
|
|
|
public class ContainerVacuumFreezer extends ContainerCrafting {
|
|
|
|
|
|
|
|
EntityPlayer player;
|
|
|
|
|
|
|
|
TileVacuumFreezer tile;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canInteractWith(EntityPlayer player) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int tickTime;
|
|
|
|
public int machineStatus;
|
|
|
|
|
|
|
|
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter,
|
|
|
|
EntityPlayer player) {
|
|
|
|
super(tileAlloysmelter.crafter);
|
|
|
|
tile = tileAlloysmelter;
|
|
|
|
this.player = player;
|
|
|
|
|
|
|
|
// input
|
|
|
|
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 56, 34));
|
|
|
|
// outputs
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
|
|
|
|
|
|
|
|
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 void detectAndSendChanges() {
|
|
|
|
super.detectAndSendChanges();
|
|
|
|
for (int i = 0; i < this.crafters.size(); i++) {
|
|
|
|
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
|
|
|
if (this.machineStatus != tile.multiBlockStatus) {
|
|
|
|
icrafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-11-23 20:19:18 +01:00
|
|
|
public void onCraftGuiOpened(ICrafting crafting) {
|
|
|
|
super.onCraftGuiOpened(crafting);
|
2015-11-17 22:48:06 +01:00
|
|
|
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
@Override
|
|
|
|
public void updateProgressBar(int id, int value) {
|
2015-11-18 09:35:34 +01:00
|
|
|
super.updateProgressBar(id, value);
|
2015-11-17 22:48:06 +01:00
|
|
|
if (id == 3) {
|
|
|
|
machineStatus = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|