Finished the new energy and fluid displays~

This commit is contained in:
Ellpeck 2016-07-21 13:22:55 +02:00
parent 5dc1951fa1
commit 3390a41a83
38 changed files with 195 additions and 214 deletions

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.event;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
@ -45,6 +46,8 @@ public class ClientEvents{
private static final String ADVANCED_INFO_TEXT_PRE = TextFormatting.DARK_GRAY+" ";
private static final String ADVANCED_INFO_HEADER_PRE = TextFormatting.GRAY+" -";
private static final EnergyDisplay ENERGY_DISPLAY = new EnergyDisplay(0, 0, null);
public ClientEvents(){
MinecraftForge.EVENT_BUS.register(this);
}
@ -172,8 +175,8 @@ public class ClientEvents{
IEnergyDisplay display = (IEnergyDisplay)tileHit;
if(!display.needsHoldShift() || player.isSneaking()){
profiler.startSection("EnergyDisplay");
String strg = display.getEnergy()+"/"+display.getMaxEnergy()+" RF";
font.drawStringWithShadow(TextFormatting.GOLD+strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE);
ENERGY_DISPLAY.setData(2, event.getResolution().getScaledHeight()-96, display.getEnergyStorage(), true, true);
ENERGY_DISPLAY.draw();
profiler.endSection();
}
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import cofh.api.energy.EnergyStorage;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraftforge.fml.client.config.GuiUtils;
@ -20,20 +21,26 @@ import java.util.Collections;
public class EnergyDisplay extends Gui{
private final EnergyStorage rfReference;
private final int x;
private final int y;
private final boolean outline;
private EnergyStorage rfReference;
private int x;
private int y;
private boolean outline;
private boolean drawTextNextTo;
public EnergyDisplay(int x, int y, EnergyStorage rfReference, boolean outline){
public EnergyDisplay(int x, int y, EnergyStorage rfReference, boolean outline, boolean drawTextNextTo){
this.setData(x, y, rfReference, outline, drawTextNextTo);
}
public EnergyDisplay(int x, int y, EnergyStorage rfReference){
this(x, y, rfReference, false, false);
}
public void setData(int x, int y, EnergyStorage rfReference, boolean outline, boolean drawTextNextTo){
this.x = x;
this.y = y;
this.rfReference = rfReference;
this.outline = outline;
}
public EnergyDisplay(int x, int y, EnergyStorage rfReference){
this(x, y, rfReference, false);
this.drawTextNextTo = drawTextNextTo;
}
public void draw(){
@ -55,13 +62,20 @@ public class EnergyDisplay extends Gui{
int i = this.rfReference.getEnergyStored()*83/this.rfReference.getMaxEnergyStored();
this.drawTexturedModalRect(barX+1, barY+84-i, 36, 172, 16, i);
}
if(this.drawTextNextTo){
this.drawString(mc.fontRendererObj, this.getOverlayText(), barX+25, barY+78, StringUtil.DECIMAL_COLOR_WHITE);
}
}
public void drawOverlay(int mouseX, int mouseY){
if(mouseX >= this.x && mouseY >= this.y && mouseX < this.x+(this.outline ? 26 : 18) && mouseY < this.y+(this.outline ? 93 : 85)){
Minecraft mc = Minecraft.getMinecraft();
String text = this.rfReference.getEnergyStored()+"/"+this.rfReference.getMaxEnergyStored()+" RF";
GuiUtils.drawHoveringText(Collections.singletonList(text), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
}
}
private String getOverlayText(){
return this.rfReference.getEnergyStored()+"/"+this.rfReference.getMaxEnergyStored()+" RF";
}
}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import cofh.api.energy.EnergyStorage;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
@ -25,24 +26,31 @@ import java.util.Collections;
public class FluidDisplay extends Gui{
private final FluidTank fluidReference;
private FluidTank fluidReference;
private Fluid oldFluid;
private final int x;
private final int y;
private final boolean outline;
private int x;
private int y;
private boolean outline;
private ResourceLocation resLoc;
public FluidDisplay(int x, int y, FluidTank fluidReference, boolean outline){
private boolean drawTextNextTo;
public FluidDisplay(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo){
this.setData(x, y, fluidReference, outline, drawTextNextTo);
}
public FluidDisplay(int x, int y, FluidTank fluidReference){
this(x, y, fluidReference, false, false);
}
public void setData(int x, int y, FluidTank fluidReference, boolean outline, boolean drawTextNextTo){
this.x = x;
this.y = y;
this.fluidReference = fluidReference;
this.outline = outline;
}
public FluidDisplay(int x, int y, FluidTank fluidReference){
this(x, y, fluidReference, false);
this.drawTextNextTo = drawTextNextTo;
}
public void draw(){
@ -82,15 +90,21 @@ public class FluidDisplay extends Gui{
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
}
if(this.drawTextNextTo){
this.drawString(mc.fontRendererObj, this.getOverlayText(), barX+25, barY+78, StringUtil.DECIMAL_COLOR_WHITE);
}
}
public void drawOverlay(int mouseX, int mouseY){
if(mouseX >= this.x && mouseY >= this.y && mouseX < this.x+(this.outline ? 26 : 18) && mouseY < this.y+(this.outline ? 93 : 85)){
FluidStack stack = this.fluidReference.getFluid();
Minecraft mc = Minecraft.getMinecraft();
String text = stack == null || stack.getFluid() == null ? "0/"+this.fluidReference.getCapacity()+" mB" : this.fluidReference.getFluidAmount()+"/"+this.fluidReference.getCapacity()+" mB "+stack.getLocalizedName();
GuiUtils.drawHoveringText(Collections.singletonList(text), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
}
}
private String getOverlayText(){
FluidStack stack = this.fluidReference.getFluid();
return stack == null || stack.getFluid() == null ? "0/"+this.fluidReference.getCapacity()+" mB" : this.fluidReference.getFluidAmount()+"/"+this.fluidReference.getCapacity()+" mB "+stack.getLocalizedName();
}
}

View file

@ -28,6 +28,7 @@ public class GuiCoalGenerator extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiCoalGenerator");
private final TileEntityCoalGenerator generator;
private EnergyDisplay energy;
public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerCoalGenerator(inventory, tile));
@ -36,13 +37,16 @@ public class GuiCoalGenerator extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+42, this.guiTop+5, this.generator.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -60,14 +64,11 @@ public class GuiCoalGenerator extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.generator.storage.getEnergyStored() > 0){
int i = this.generator.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
}
if(this.generator.currentBurnTime > 0){
int i = this.generator.getBurningScaled(13);
this.drawTexturedModalRect(this.guiLeft+87, this.guiTop+27+12-i, 176, 96-i, 14, i);
}
this.energy.draw();
}
}

View file

@ -41,6 +41,9 @@ public class GuiCoffeeMachine extends GuiContainer{
private final int z;
private final World world;
private EnergyDisplay energy;
private FluidDisplay fluid;
public GuiCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerCoffeeMachine(inventory, tile));
this.machine = (TileEntityCoffeeMachine)tile;
@ -58,6 +61,9 @@ public class GuiCoffeeMachine extends GuiContainer{
GuiButton buttonOkay = new GuiButton(0, this.guiLeft+60, this.guiTop+11, 58, 20, StringUtil.localize("info."+ModUtil.MOD_ID+".gui.ok"));
this.buttonList.add(buttonOkay);
this.energy = new EnergyDisplay(this.guiLeft+16, this.guiTop+5, this.machine.storage);
this.fluid = new FluidDisplay(this.guiLeft-30, this.guiTop+1, this.machine.tank, true, false);
}
@Override
@ -77,6 +83,9 @@ public class GuiCoffeeMachine extends GuiContainer{
if(x >= this.guiLeft+40 && y >= this.guiTop+25 && x <= this.guiLeft+49 && y <= this.guiTop+56){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
this.energy.drawOverlay(x, y);
this.fluid.drawOverlay(x, y);
}
@Override
@ -94,15 +103,6 @@ public class GuiCoffeeMachine extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.machine.storage.getEnergyStored() > 0){
int i = this.machine.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 6, i);
}
if(this.machine.tank.getFluidAmount() > 0){
int i = this.machine.getWaterScaled(64);
this.drawTexturedModalRect(this.guiLeft+27, this.guiTop+70-i, 182, 0, 6, i);
}
if(this.machine.coffeeCacheAmount > 0){
int i = this.machine.getCoffeeScaled(30);
this.drawTexturedModalRect(this.guiLeft+41, this.guiTop+56-i, 192, 0, 8, i);
@ -115,6 +115,9 @@ public class GuiCoffeeMachine extends GuiContainer{
int j = this.machine.getBrewScaled(26);
this.drawTexturedModalRect(this.guiLeft+99+25-j, this.guiTop+44, 192+25-j, 46, j, 12);
}
this.energy.draw();
this.fluid.draw();
}
@Override

View file

@ -28,6 +28,7 @@ public class GuiDirectionalBreaker extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiDirectionalBreaker");
private final TileEntityDirectionalBreaker breaker;
private EnergyDisplay energy;
public GuiDirectionalBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerDirectionalBreaker(inventory, tile));
@ -36,14 +37,17 @@ public class GuiDirectionalBreaker extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+42, this.guiTop+5, this.breaker.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.breaker.storage.getEnergyStored()+"/"+this.breaker.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -61,9 +65,6 @@ public class GuiDirectionalBreaker extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.breaker.storage.getEnergyStored() > 0){
int i = this.breaker.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 29, 16, i);
}
this.energy.draw();
}
}

View file

@ -28,6 +28,7 @@ public class GuiEnergizer extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiEnergizer");
private final TileEntityEnergizer energizer;
private EnergyDisplay energy;
public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnergizer(inventory, tile));
@ -36,13 +37,16 @@ public class GuiEnergizer extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+56, this.guiTop+5, this.energizer.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.energizer.storage.getEnergyStored()+"/"+this.energizer.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+57 && y >= this.guiTop+6 && x <= this.guiLeft+72 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -60,9 +64,6 @@ public class GuiEnergizer extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.energizer.storage.getEnergyStored() > 0){
int i = this.energizer.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
this.energy.draw();
}
}

View file

@ -28,6 +28,7 @@ public class GuiEnervator extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiEnergizer");
private final TileEntityEnervator enervator;
private EnergyDisplay energy;
public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnervator(inventory, tile));
@ -36,13 +37,16 @@ public class GuiEnervator extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+56, this.guiTop+5, this.enervator.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.enervator.storage.getEnergyStored()+"/"+this.enervator.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+57 && y >= this.guiTop+6 && x <= this.guiLeft+72 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -60,9 +64,6 @@ public class GuiEnervator extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.enervator.storage.getEnergyStored() > 0){
int i = this.enervator.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
this.energy.draw();
}
}

View file

@ -29,6 +29,8 @@ public class GuiFermentingBarrel extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFermentingBarrel");
private final TileEntityFermentingBarrel press;
private FluidDisplay input;
private FluidDisplay output;
public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFermentingBarrel(inventory, tile));
@ -40,16 +42,15 @@ public class GuiFermentingBarrel extends GuiContainer{
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
this.input.drawOverlay(x, y);
this.output.drawOverlay(x, y);
}
String text1 = StringUtil.getFluidInfo(this.press.canolaTank);
if(x >= this.guiLeft+61 && y >= this.guiTop+6 && x <= this.guiLeft+76 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text2 = StringUtil.getFluidInfo(this.press.oilTank);
if(x >= this.guiLeft+99 && y >= this.guiTop+6 && x <= this.guiLeft+114 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
@Override
public void initGui(){
super.initGui();
this.input = new FluidDisplay(this.guiLeft+60, this.guiTop+5, this.press.canolaTank);
this.output = new FluidDisplay(this.guiLeft+98, this.guiTop+5, this.press.oilTank);
}
@Override
@ -67,19 +68,12 @@ public class GuiFermentingBarrel extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.press.canolaTank.getFluidAmount() > 0){
int i = this.press.getCanolaTankScaled(83);
this.drawTexturedModalRect(this.guiLeft+61, this.guiTop+89-i, 192, 29, 16, i);
}
if(this.press.oilTank.getFluidAmount() > 0){
int i = this.press.getOilTankScaled(83);
this.drawTexturedModalRect(this.guiLeft+99, this.guiTop+89-i, 176, 29, 16, i);
}
if(this.press.currentProcessTime > 0){
int i = this.press.getProcessScaled(29);
this.drawTexturedModalRect(this.guiLeft+82, this.guiTop+34, 176, 0, 12, i);
}
this.input.draw();
this.output.draw();
}
}

View file

@ -29,6 +29,7 @@ public class GuiFluidCollector extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFluidCollector");
private final TileEntityFluidCollector collector;
private FluidDisplay fluid;
public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFluidCollector(inventory, tile));
@ -41,10 +42,13 @@ public class GuiFluidCollector extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text2 = StringUtil.getFluidInfo(this.collector.tank);
if(x >= this.guiLeft+68 && y >= this.guiTop+6 && x <= this.guiLeft+83 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
this.fluid.drawOverlay(x, y);
}
@Override
public void initGui(){
super.initGui();
this.fluid = new FluidDisplay(this.guiLeft+67, this.guiTop+5, this.collector.tank);
}
@Override
@ -62,9 +66,6 @@ public class GuiFluidCollector extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.collector.tank.getFluidAmount() > 0){
int i = this.collector.getTankScaled(83);
this.drawTexturedModalRect(this.guiLeft+68, this.guiTop+89-i, 176, 0, 16, i);
}
this.fluid.draw();
}
}

View file

@ -28,6 +28,7 @@ public class GuiFurnaceDouble extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiFurnaceDouble");
private final TileEntityFurnaceDouble tileFurnace;
private EnergyDisplay energy;
public GuiFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFurnaceDouble(inventory, tile));
@ -39,10 +40,13 @@ public class GuiFurnaceDouble extends GuiContainer{
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileFurnace.storage.getEnergyStored()+"/"+this.tileFurnace.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+28 && y >= this.guiTop+6 && x <= this.guiLeft+43 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+27, this.guiTop+5, this.tileFurnace.storage);
}
@Override
@ -60,10 +64,6 @@ public class GuiFurnaceDouble extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileFurnace.storage.getEnergyStored() > 0){
int i = this.tileFurnace.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
}
if(this.tileFurnace.firstSmeltTime > 0){
int i = this.tileFurnace.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft+51, this.guiTop+40, 176, 0, 24, i);
@ -72,5 +72,7 @@ public class GuiFurnaceDouble extends GuiContainer{
int i = this.tileFurnace.getSecondTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft+101, this.guiTop+40, 176, 22, 24, i);
}
this.energy.draw();
}
}

View file

@ -30,6 +30,7 @@ public class GuiGrinder extends GuiContainer{
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("guiGrinderDouble");
private final TileEntityGrinder tileGrinder;
private final boolean isDouble;
private EnergyDisplay energy;
public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){
this(inventoryPlayer, tile, false);
@ -43,13 +44,16 @@ public class GuiGrinder extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+(this.isDouble ? 13 : 42), this.guiTop+5, this.tileGrinder.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileGrinder.storage.getEnergyStored()+"/"+this.tileGrinder.storage.getMaxEnergyStored()+" RF";
if((this.isDouble && x >= this.guiLeft+14 && y >= this.guiTop+6 && x <= this.guiLeft+29 && y <= this.guiTop+88) || (!this.isDouble && x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88)){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -67,10 +71,6 @@ public class GuiGrinder extends GuiContainer{
this.mc.getTextureManager().bindTexture(this.isDouble ? RES_LOC_DOUBLE : RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileGrinder.storage.getEnergyStored() > 0){
int i = this.tileGrinder.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+(this.isDouble ? 14 : 43), this.guiTop+89-i, 176, (this.isDouble ? 44 : 23), 16, i);
}
if(this.tileGrinder.firstCrushTime > 0){
int i = this.tileGrinder.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft+(this.isDouble ? 51 : 80), this.guiTop+40, 176, 0, 24, i);
@ -81,6 +81,8 @@ public class GuiGrinder extends GuiContainer{
this.drawTexturedModalRect(this.guiLeft+101, this.guiTop+40, 176, 22, 24, i);
}
}
this.energy.draw();
}
public static class GuiGrinderDouble extends GuiGrinder{

View file

@ -30,6 +30,9 @@ public class GuiOilGenerator extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiOilGenerator");
private final TileEntityOilGenerator generator;
private EnergyDisplay energy;
private FluidDisplay fluid;
public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerOilGenerator(inventory, tile));
this.generator = (TileEntityOilGenerator)tile;
@ -37,17 +40,18 @@ public class GuiOilGenerator extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+42, this.guiTop+5, this.generator.storage);
this.fluid = new FluidDisplay(this.guiLeft+116, this.guiTop+5, this.generator.tank);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+43 && y >= this.guiTop+6 && x <= this.guiLeft+58 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text1), x, y);
}
String text2 = StringUtil.getFluidInfo(this.generator.tank);
if(x >= this.guiLeft+117 && y >= this.guiTop+6 && x <= this.guiLeft+132 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
this.energy.drawOverlay(x, y);
this.fluid.drawOverlay(x, y);
}
@Override
@ -65,19 +69,12 @@ public class GuiOilGenerator extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.generator.storage.getEnergyStored() > 0){
int i = this.generator.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
}
if(this.generator.tank.getFluidAmount() > 0){
int i = this.generator.getTankScaled(83);
this.drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 0, 16, i);
}
if(this.generator.currentBurnTime > 0){
int i = this.generator.getBurningScaled(13);
this.drawTexturedModalRect(this.guiLeft+72, this.guiTop+44+12-i, 176, 96-i, 14, i);
}
this.energy.draw();
this.fluid.draw();
}
}

View file

@ -28,6 +28,7 @@ public class GuiRepairer extends GuiContainer{
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("guiRepairer");
private final TileEntityItemRepairer tileRepairer;
private EnergyDisplay energy;
public GuiRepairer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerRepairer(inventory, tile));
@ -36,13 +37,16 @@ public class GuiRepairer extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void initGui(){
super.initGui();
this.energy = new EnergyDisplay(this.guiLeft+27, this.guiTop+5, this.tileRepairer.storage);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text = this.tileRepairer.storage.getEnergyStored()+"/"+this.tileRepairer.storage.getMaxEnergyStored()+" RF";
if(x >= this.guiLeft+28 && y >= this.guiTop+6 && x <= this.guiLeft+43 && y <= this.guiTop+88){
this.drawHoveringText(Collections.singletonList(text), x, y);
}
this.energy.drawOverlay(x, y);
}
@Override
@ -60,13 +64,11 @@ public class GuiRepairer extends GuiContainer{
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileRepairer.storage.getEnergyStored() > 0){
int i = this.tileRepairer.getEnergyScaled(83);
this.drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
}
if(TileEntityItemRepairer.canBeRepaired(this.tileRepairer.slots[TileEntityItemRepairer.SLOT_INPUT])){
int i = this.tileRepairer.getItemDamageToScale(22);
this.drawTexturedModalRect(this.guiLeft+73, this.guiTop+52, 176, 28, i, 16);
}
this.energy.draw();
}
}

View file

@ -10,16 +10,14 @@
package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IEnergyDisplay{
@SideOnly(Side.CLIENT)
int getEnergy();
@SideOnly(Side.CLIENT)
int getMaxEnergy();
EnergyStorage getEnergyStorage();
@SideOnly(Side.CLIENT)
boolean needsHoldShift();

View file

@ -202,9 +202,8 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -104,13 +104,8 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -166,14 +166,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -90,14 +90,8 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -101,16 +101,9 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
}
@Override
public boolean needsHoldShift(){
return false;

View file

@ -122,14 +122,8 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -123,14 +123,8 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -234,14 +234,8 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
@SideOnly(Side.CLIENT)
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -216,13 +216,8 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

View file

@ -98,13 +98,8 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy
}
@Override
public int getEnergy(){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergy(){
return this.storage.getMaxEnergyStored();
public EnergyStorage getEnergyStorage(){
return this.storage;
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB