Updated NEI module to reflect new GUI changes, added PRC to RecipeHelper

This commit is contained in:
Aidan C. Brady committed 2014-06-14 18:33:48 +02:00
1 parent 3b99d376a4
commit 5c36612146
38 files changed
+336 -109

No files matched your search

@@ -17,15 +17,51 @@ public class GuiPowerBar extends GuiElement
private int height = 56;
private int innerOffsetY = 2;
private TileEntityElectricBlock tileEntityElectric;
private TileEntityElectricBlock tileEntity;
private IPowerInfoHandler handler;
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
tileEntityElectric = tile;
tileEntity = tile;
handler = new IPowerInfoHandler() {
@Override
public String getTooltip()
{
return MekanismUtils.getEnergyDisplay(tileEntity.getEnergy());
}
@Override
public double getLevel()
{
return tileEntity.getEnergy()/tileEntity.getMaxEnergy();
}
};
xLocation = x;
yLocation = y;
}
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
handler = h;
xLocation = x;
yLocation = y;
}
public static abstract class IPowerInfoHandler
{
public String getTooltip()
{
return null;
}
public abstract double getLevel();
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
@@ -33,8 +69,12 @@ public class GuiPowerBar extends GuiElement
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
int displayInt = tileEntityElectric.getScaledEnergyLevel(52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
if(handler.getLevel() > 0)
{
int displayInt = (int)(handler.getLevel()*52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@@ -44,9 +84,9 @@ public class GuiPowerBar extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
if(handler.getTooltip() != null && xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
{
displayTooltip(MekanismUtils.getEnergyDisplay(tileEntityElectric.getEnergy()), xAxis, yAxis);
displayTooltip(handler.getTooltip(), xAxis, yAxis);
}
mc.renderEngine.bindTexture(defaultLocation);