2015-04-17 02:09:12 +02:00
|
|
|
package techreborn.client.container;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-05-18 17:53:54 +02:00
|
|
|
import net.minecraft.inventory.IContainerListener;
|
2016-11-19 13:50:08 +01:00
|
|
|
import reborncore.client.gui.slots.BaseSlot;
|
|
|
|
import reborncore.client.gui.slots.SlotOutput;
|
2016-07-24 21:26:15 +02:00
|
|
|
import techreborn.tiles.multiblock.TileBlastFurnace;
|
2015-04-17 02:09:12 +02:00
|
|
|
|
2016-10-08 21:46:16 +02:00
|
|
|
public class ContainerBlastFurnace extends ContainerCrafting {
|
2015-04-17 02:09:12 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public int heat;
|
|
|
|
public int tickTime;
|
|
|
|
EntityPlayer player;
|
|
|
|
TileBlastFurnace tile;
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2016-10-08 21:46:16 +02:00
|
|
|
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace, EntityPlayer player) {
|
2016-03-25 10:47:34 +01:00
|
|
|
super(tileblastfurnace.crafter);
|
|
|
|
tile = tileblastfurnace;
|
|
|
|
this.player = player;
|
2015-04-17 02:09:12 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
// input
|
2016-04-12 09:33:38 +02:00
|
|
|
this.addSlotToContainer(new BaseSlot(tileblastfurnace.inventory, 0, 40, 25));// Input
|
2016-10-08 21:46:16 +02:00
|
|
|
// 1
|
2016-04-12 09:33:38 +02:00
|
|
|
this.addSlotToContainer(new BaseSlot(tileblastfurnace.inventory, 1, 40, 43));// Input
|
2016-10-08 21:46:16 +02:00
|
|
|
// 2
|
2016-03-25 10:47:34 +01:00
|
|
|
// outputs
|
|
|
|
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 100, 35));// Output
|
2016-10-08 21:46:16 +02:00
|
|
|
// 1
|
2016-03-25 10:47:34 +01:00
|
|
|
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 3, 118, 35));// Output
|
2016-10-08 21:46:16 +02:00
|
|
|
// 2
|
2015-07-20 16:19:23 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
int i;
|
2015-04-17 02:09:12 +02:00
|
|
|
|
2016-10-08 21:46:16 +02:00
|
|
|
for (i = 0; i < 3; ++i) {
|
|
|
|
for (int j = 0; j < 9; ++j) {
|
2016-04-12 09:33:38 +02:00
|
|
|
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
2016-03-25 10:47:34 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-17 02:09:12 +02:00
|
|
|
|
2016-10-08 21:46:16 +02:00
|
|
|
for (i = 0; i < 9; ++i) {
|
2016-04-12 09:33:38 +02:00
|
|
|
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
|
2016-03-25 10:47:34 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
2016-10-08 21:46:16 +02:00
|
|
|
public boolean canInteractWith(EntityPlayer player) {
|
2016-03-25 10:47:34 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
2016-10-08 21:46:16 +02:00
|
|
|
public void detectAndSendChanges() {
|
2016-03-25 10:47:34 +01:00
|
|
|
super.detectAndSendChanges();
|
2016-10-08 21:46:16 +02:00
|
|
|
for (int i = 0; i < this.listeners.size(); i++) {
|
2016-05-18 17:53:54 +02:00
|
|
|
IContainerListener IContainerListener = this.listeners.get(i);
|
2016-10-08 21:46:16 +02:00
|
|
|
if (this.heat != tile.getHeat()) {
|
2016-05-18 17:53:54 +02:00
|
|
|
IContainerListener.sendProgressBarUpdate(this, 10, tile.getHeat());
|
2016-03-25 10:47:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
2016-10-08 21:46:16 +02:00
|
|
|
public void addListener(IContainerListener crafting) {
|
2016-05-18 17:53:54 +02:00
|
|
|
super.addListener(crafting);
|
2016-03-25 10:47:34 +01:00
|
|
|
crafting.sendProgressBarUpdate(this, 10, tile.getHeat());
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
2016-10-08 21:46:16 +02:00
|
|
|
public void updateProgressBar(int id, int value) {
|
|
|
|
if (id == 10) {
|
2016-03-25 10:47:34 +01:00
|
|
|
this.heat = value;
|
|
|
|
}
|
|
|
|
super.updateProgressBar(id, value);
|
|
|
|
}
|
2015-04-17 02:09:12 +02:00
|
|
|
}
|