rewritten matter fab
Take 3 should be good :)
This commit is contained in:
parent
6d99b28e7d
commit
74a9ace574
3 changed files with 89 additions and 44 deletions
|
@ -1,6 +1,9 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import techreborn.tiles.TileMatterFabricator;
|
||||
|
@ -11,7 +14,7 @@ public class ContainerMatterFabricator extends TechRebornContainer{
|
|||
|
||||
TileMatterFabricator tile;
|
||||
|
||||
public int tickTime;
|
||||
public int progressTime;
|
||||
|
||||
public ContainerMatterFabricator(TileMatterFabricator tileMatterfab,
|
||||
EntityPlayer player)
|
||||
|
@ -55,4 +58,36 @@ public class ContainerMatterFabricator extends TechRebornContainer{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.progressTime != tile.progresstime) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, tile.progresstime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.progresstime);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 0) {
|
||||
this.progressTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if(progressTime != 0) {
|
||||
return progressTime * scale / tile.maxProgresstime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue