Finished Matrix Statistics interface, need to figure out why induction cells aren't loading from NBT
This commit is contained in:
parent
cd2068677d
commit
5747c9f904
8 changed files with 140 additions and 9 deletions
src/main
java/mekanism
client/gui
common
resources/assets/mekanism
|
@ -3,6 +3,7 @@ package mekanism.client.gui;
|
|||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.gui.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.GuiMatrixTab.MatrixTab;
|
||||
import mekanism.client.gui.GuiRateBar.IRateInfoHandler;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -32,6 +33,20 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
return tileEntity;
|
||||
}
|
||||
}, GuiEnergyGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 6, 13));
|
||||
guiElements.add(new GuiRateBar(this, new IRateInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
return MekanismUtils.localize("gui.outputting") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
return tileEntity.structure.lastOutput/tileEntity.structure.outputCap;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 30, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,10 +56,16 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.matrixStats"), 45, 6, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.energy") + ":", 53, 26, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()) + "/" + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()), 53, 35, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.output") + ":", 53, 44, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/" + MekanismUtils.getEnergyDisplay(tileEntity.structure.outputCap), 53, 53, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.energy") + ":", 53, 26, 0x797979);
|
||||
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()) + "/" + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()), 59, 35, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.output") + ":", 53, 46, 0x797979);
|
||||
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/" + MekanismUtils.getEnergyDisplay(tileEntity.structure.outputCap), 59, 55, 0x404040);
|
||||
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.dimensions") + ":", 8, 82, 0x797979);
|
||||
fontRendererObj.drawString(tileEntity.structure.volWidth + " x " + tileEntity.structure.volHeight + " x " + tileEntity.structure.volLength, 14, 91, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.constituents") + ":", 8, 102, 0x797979);
|
||||
fontRendererObj.drawString(tileEntity.clientCells + " " + MekanismUtils.localize("gui.cells"), 14, 111, 0x404040);
|
||||
fontRendererObj.drawString(tileEntity.clientProviders + " " + MekanismUtils.localize("gui.providers"), 14, 120, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
@ -52,12 +73,12 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,11 @@ package mekanism.client.gui;
|
|||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPowerBar extends GuiElement
|
||||
{
|
||||
|
@ -52,6 +50,7 @@ public class GuiPowerBar extends GuiElement
|
|||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
|
||||
|
||||
handler = h;
|
||||
|
||||
xLocation = x;
|
||||
yLocation = y;
|
||||
}
|
||||
|
|
81
src/main/java/mekanism/client/gui/GuiRateBar.java
Normal file
81
src/main/java/mekanism/client/gui/GuiRateBar.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiRateBar extends GuiElement
|
||||
{
|
||||
private int xLocation;
|
||||
private int yLocation;
|
||||
|
||||
private int width = 8;
|
||||
private int height = 60;
|
||||
|
||||
private IRateInfoHandler handler;
|
||||
|
||||
public GuiRateBar(IGuiWrapper gui, IRateInfoHandler h, ResourceLocation def, int x, int y)
|
||||
{
|
||||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiRateBar.png"), gui, def);
|
||||
|
||||
handler = h;
|
||||
|
||||
xLocation = x;
|
||||
yLocation = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth + xLocation, guiHeight + yLocation, width, height);
|
||||
}
|
||||
|
||||
public static abstract class IRateInfoHandler
|
||||
{
|
||||
public String getTooltip()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract double getLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
|
||||
|
||||
if(handler.getLevel() > 0)
|
||||
{
|
||||
int displayInt = (int)(handler.getLevel()*58);
|
||||
guiObj.drawTexturedRect(guiWidth + xLocation+1, guiHeight + yLocation + height-1 - displayInt, 8, height-2 - displayInt, width-2, displayInt);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(handler.getTooltip() != null && xAxis >= xLocation+1 && xAxis <= xLocation + width-1 && yAxis >= yLocation+1 && yAxis <= yLocation + height-1)
|
||||
{
|
||||
displayTooltip(handler.getTooltip(), xAxis, yAxis);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button) {}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button) {}
|
||||
}
|
|
@ -15,6 +15,9 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class TileEntityInductionCasing extends TileEntityMultiblock<SynchronizedMatrixData> implements IStrictEnergyStorage
|
||||
{
|
||||
public int clientCells;
|
||||
public int clientProviders;
|
||||
|
||||
public TileEntityInductionCasing()
|
||||
{
|
||||
this("InductionCasing");
|
||||
|
@ -55,6 +58,13 @@ public class TileEntityInductionCasing extends TileEntityMultiblock<Synchronized
|
|||
data.add(structure.storageCap);
|
||||
data.add(structure.outputCap);
|
||||
data.add(structure.lastOutput);
|
||||
|
||||
data.add(structure.volWidth);
|
||||
data.add(structure.volHeight);
|
||||
data.add(structure.volLength);
|
||||
|
||||
data.add(structure.cells.size());
|
||||
data.add(structure.providers.size());
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -71,6 +81,13 @@ public class TileEntityInductionCasing extends TileEntityMultiblock<Synchronized
|
|||
structure.storageCap = dataStream.readDouble();
|
||||
structure.outputCap = dataStream.readDouble();
|
||||
structure.lastOutput = dataStream.readDouble();
|
||||
|
||||
structure.volWidth = dataStream.readInt();
|
||||
structure.volHeight = dataStream.readInt();
|
||||
structure.volLength = dataStream.readInt();
|
||||
|
||||
clientCells = dataStream.readInt();
|
||||
clientProviders = dataStream.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1349,10 +1349,17 @@ public final class MekanismUtils
|
|||
public static boolean hasUsableWrench(EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
ItemStack tool = player.getCurrentEquippedItem();
|
||||
|
||||
if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(player, x, y, z))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && tool.getItem() instanceof IToolWrench && ((IToolWrench)tool.getItem()).canWrench(player, x, y, z))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before ![]() (image error) Size: 2.3 KiB After ![]() (image error) Size: 2.8 KiB ![]() ![]() |
BIN
src/main/resources/assets/mekanism/gui/elements/GuiRateBar.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/elements/GuiRateBar.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 2.6 KiB |
|
@ -406,6 +406,12 @@ gui.incomplete=Incomplete
|
|||
gui.inductionMatrix=Induction Matrix
|
||||
gui.matrixStats=Matrix Statistics
|
||||
gui.main=Main
|
||||
gui.outputting=Outputting
|
||||
gui.dimensions=Dimensions
|
||||
gui.constituents=Constituents
|
||||
gui.cells=cells
|
||||
gui.providers=providers
|
||||
gui.structure=Structure
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue