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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ public class GuiMatterFabricator extends GuiContainer{
|
|||
"techreborn", "textures/gui/matterfabricator.png");
|
||||
|
||||
TileMatterFabricator matterfab;
|
||||
|
||||
ContainerMatterFabricator containerMatterFabricator;
|
||||
|
||||
public GuiMatterFabricator(EntityPlayer player, TileMatterFabricator tilematterfab)
|
||||
{
|
||||
|
@ -21,7 +23,7 @@ public class GuiMatterFabricator extends GuiContainer{
|
|||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
matterfab = tilematterfab;
|
||||
|
||||
containerMatterFabricator = (ContainerMatterFabricator) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,6 +34,11 @@ public class GuiMatterFabricator extends GuiContainer{
|
|||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = containerMatterFabricator.getProgressScaled(24);
|
||||
if(j > 0) {
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue