Added progress bar to ACT
This commit is contained in:
parent
4ac9a0fc45
commit
7a320cbba0
3 changed files with 16 additions and 6 deletions
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
|
@ -147,6 +147,7 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
}
|
||||
private static final int[] SLOTS = Utils.createSlotArray(0, 24);
|
||||
private static final EnumSet<ForgeDirection> SEARCH_SIDES = EnumSet.of(DOWN, NORTH, SOUTH, EAST, WEST);
|
||||
private static final float REQUIRED_POWER = 500F;
|
||||
private final SimpleInventory craftingSlots;
|
||||
private final SimpleInventory storageSlots;
|
||||
private final InventoryMapper invInput;
|
||||
|
@ -242,7 +243,11 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
}
|
||||
|
||||
public float getRequiredEnergy() {
|
||||
return craftResult.getStackInSlot(0) != null ? 500f : 0f;
|
||||
return craftResult.getStackInSlot(0) != null ? REQUIRED_POWER : 0f;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int i) {
|
||||
return (int) ((storedEnergy * i) / REQUIRED_POWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -347,7 +352,8 @@ public class TileAdvancedCraftingTable extends TileEntity implements IInventory,
|
|||
}
|
||||
for (IInvSlot slot : InventoryIterator.getIterable(craftingSlots, ForgeDirection.UP)) {
|
||||
ItemStack ingred = slot.getStackInSlot();
|
||||
if(ingred == null) continue;
|
||||
if (ingred == null)
|
||||
continue;
|
||||
IStackFilter filter = new CraftingFilter(ingred);
|
||||
if (InvUtils.countItems(invInput, ForgeDirection.UP, filter) < InvUtils.countItems(craftingSlots, ForgeDirection.UP, filter)) {
|
||||
for (ForgeDirection side : SEARCH_SIDES) {
|
||||
|
|
|
@ -12,7 +12,9 @@ import net.minecraft.inventory.IInventory;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAdvancedCraftingTable extends GuiBuildCraft {
|
||||
|
||||
class AssemblyWorkbenchLedger extends Ledger {
|
||||
|
||||
int headerColour = 0xe1c92f;
|
||||
int subheaderColour = 0xaaafb8;
|
||||
int textColour = 0x000000;
|
||||
|
@ -49,9 +51,7 @@ public class GuiAdvancedCraftingTable extends GuiBuildCraft {
|
|||
public String getTooltip() {
|
||||
return String.format("%3.2f MJ/t", workbench.getRecentEnergyAverage() / 100.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TileAdvancedCraftingTable workbench;
|
||||
|
||||
public GuiAdvancedCraftingTable(InventoryPlayer playerInventory, TileAdvancedCraftingTable advancedWorkbench) {
|
||||
|
@ -70,12 +70,16 @@ public class GuiAdvancedCraftingTable extends GuiBuildCraft {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(DefaultProps.TEXTURE_PATH_GUI + "/assembly_advancedworkbench.png");
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
if (workbench.getStoredEnergy() > 0) {
|
||||
int progress = workbench.getProgressScaled(24);
|
||||
drawTexturedModalRect(cornerX + 93, cornerY + 32, 176, 0, progress + 1, 18);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue