Fixed the centrifuge, still needs some testing.

This commit is contained in:
Modmuss50 2015-04-14 08:35:44 +01:00
parent 4746968a04
commit f49b8c27c2
2 changed files with 47 additions and 32 deletions

View file

@ -1,6 +1,7 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileCentrifuge;
@ -11,6 +12,8 @@ public class ContainerCentrifuge extends TechRebornContainer {
TileCentrifuge tile;
public int tickTime;
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player){
tile = tileCentrifuge;
this.player = player;
@ -42,4 +45,24 @@ public class ContainerCentrifuge extends TechRebornContainer {
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.tickTime);
}
/**
* 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;
}
}