A bit of work on the Matrix Stats GUI, hopefully completely fixed the transmitter issue
This commit is contained in:
parent
a18b42beee
commit
a0323f9334
12 changed files with 215 additions and 15 deletions
|
@ -35,6 +35,7 @@ import mekanism.client.gui.GuiGasTank;
|
|||
import mekanism.client.gui.GuiInductionMatrix;
|
||||
import mekanism.client.gui.GuiLaserAmplifier;
|
||||
import mekanism.client.gui.GuiLaserTractorBeam;
|
||||
import mekanism.client.gui.GuiMatrixStats;
|
||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPRC;
|
||||
|
@ -503,6 +504,8 @@ public class ClientProxy extends CommonProxy
|
|||
return new GuiAmbientAccumulator(player, (TileEntityAmbientAccumulator)tileEntity);
|
||||
case 49:
|
||||
return new GuiInductionMatrix(player.inventory, (TileEntityInductionCasing)tileEntity);
|
||||
case 50:
|
||||
return new GuiMatrixStats(player.inventory, (TileEntityInductionCasing)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.gui.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.GuiMatrixTab.MatrixTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.inventory.container.ContainerInductionMatrix;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -24,6 +22,7 @@ public class GuiInductionMatrix extends GuiMekanism
|
|||
{
|
||||
super(tentity, new ContainerInductionMatrix(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiMatrixTab(this, tileEntity, MatrixTab.STAT, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiInductionMatrix.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,12 +31,12 @@ public class GuiInductionMatrix extends GuiMekanism
|
|||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 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.getEnergyDisplay(tileEntity.getEnergy()), 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.getEnergyDisplay(tileEntity.structure.lastOutput), 53, 53, 0x00CD00);
|
||||
|
||||
if(xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72)
|
||||
{
|
||||
|
|
63
src/main/java/mekanism/client/gui/GuiMatrixStats.java
Normal file
63
src/main/java/mekanism/client/gui/GuiMatrixStats.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.gui.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.GuiMatrixTab.MatrixTab;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMatrixStats extends GuiMekanism
|
||||
{
|
||||
public TileEntityInductionCasing tileEntity;
|
||||
|
||||
public GuiMatrixStats(InventoryPlayer inventory, TileEntityInductionCasing tentity)
|
||||
{
|
||||
super(tentity, new ContainerNull(inventory.player, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiMatrixTab(this, tileEntity, MatrixTab.MAIN, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png")));
|
||||
guiElements.add(new GuiEnergyGauge(new IEnergyInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public IStrictEnergyStorage getEnergyStorage()
|
||||
{
|
||||
return tileEntity;
|
||||
}
|
||||
}, GuiEnergyGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 6, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
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);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
115
src/main/java/mekanism/client/gui/GuiMatrixTab.java
Normal file
115
src/main/java/mekanism/client/gui/GuiMatrixTab.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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 GuiMatrixTab extends GuiElement
|
||||
{
|
||||
private TileEntity tileEntity;
|
||||
private MatrixTab tabType;
|
||||
private int yPos;
|
||||
|
||||
public GuiMatrixTab(IGuiWrapper gui, TileEntity tile, MatrixTab type, int y, ResourceLocation def)
|
||||
{
|
||||
super(type.getResource(), gui, def);
|
||||
|
||||
tileEntity = tile;
|
||||
tabType = type;
|
||||
yPos = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + yPos, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + yPos, 0, 0, 26, 26);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 18, 18, 18);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
displayTooltip(tabType.getDesc(), 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)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
tabType.openGui(tileEntity);
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum MatrixTab
|
||||
{
|
||||
MAIN("GuiEnergyTab.png", 49, "gui.main"),
|
||||
STAT("GuiStatsTab.png", 50, "gui.stats");
|
||||
|
||||
private String path;
|
||||
private int guiId;
|
||||
private String desc;
|
||||
|
||||
private MatrixTab(String s, int id, String s1)
|
||||
{
|
||||
path = s;
|
||||
guiId = id;
|
||||
desc = s1;
|
||||
}
|
||||
|
||||
public ResourceLocation getResource()
|
||||
{
|
||||
return MekanismUtils.getResource(ResourceType.GUI_ELEMENT, path);
|
||||
}
|
||||
|
||||
public void openGui(TileEntity tile)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
|
||||
}
|
||||
|
||||
public String getDesc()
|
||||
{
|
||||
return MekanismUtils.localize(desc);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -484,6 +484,8 @@ public class CommonProxy
|
|||
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
||||
case 49:
|
||||
return new ContainerInductionMatrix(player.inventory, (TileEntityInductionCasing)tileEntity);
|
||||
case 50:
|
||||
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -11,26 +11,34 @@ public class HeatUtils
|
|||
{
|
||||
public static double[] simulate(IHeatTransfer source)
|
||||
{
|
||||
double heatTransferred[] = new double[]{0,0};
|
||||
double heatTransferred[] = new double[] {0,0};
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
IHeatTransfer sink = source.getAdjacent(side);
|
||||
|
||||
if(sink != null)
|
||||
{
|
||||
double invConduction = sink.getInverseConductionCoefficient() + source.getInverseConductionCoefficient();
|
||||
double heatToTransfer = source.getTemp() / invConduction;
|
||||
source.transferHeatTo(-heatToTransfer);
|
||||
sink.transferHeatTo(heatToTransfer);
|
||||
|
||||
if(!(sink instanceof IGridTransmitter))
|
||||
{
|
||||
heatTransferred[0] += heatToTransfer;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//Transfer to air otherwise
|
||||
double invConduction = IHeatTransfer.AIR_INVERSE_COEFFICIENT + source.getInsulationCoefficient(side) + source.getInverseConductionCoefficient();
|
||||
double heatToTransfer = source.getTemp() / invConduction;
|
||||
source.transferHeatTo(-heatToTransfer);
|
||||
heatTransferred[1] += heatToTransfer;
|
||||
}
|
||||
|
||||
return heatTransferred;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,12 +664,24 @@ public final class MekanismUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* A better "isBlockIndirectlyGettingPowered()" that doesn't load chunks
|
||||
* A better "isBlockIndirectlyGettingPowered()" that doesn't load chunks.
|
||||
* @param world - the world to perform the check in
|
||||
* @param coord - the coordinate of the block performing the check
|
||||
* @return if the block is indirectly getting powered by LOADED chunks
|
||||
*/
|
||||
public static boolean isGettingPowered(World world, Coord4D coord)
|
||||
{
|
||||
return isGettingPowered(world, coord, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension of preceding isGettingPowered() method, used to define expansions of the check.
|
||||
* @param world - the world to perform the check in
|
||||
* @param coord - the coordinate of the block performing the check
|
||||
* @param expand - whether or not the check should be recursively called on the surrounding coordinates
|
||||
* @return if the block is indirectly getting powered by LOADED chunks
|
||||
*/
|
||||
public static boolean isGettingPowered(World world, Coord4D coord, boolean expand)
|
||||
{
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
|
@ -677,14 +689,11 @@ public final class MekanismUtils
|
|||
|
||||
if(sideCoord.exists(world) && sideCoord.getFromSide(side).exists(world))
|
||||
{
|
||||
if(sideCoord.getFromSide(side).exists(world))
|
||||
if(world.isBlockProvidingPowerTo(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, side.getOpposite().ordinal()) > 0)
|
||||
{
|
||||
if(world.getIndirectPowerLevelTo(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, side.ordinal()) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(world.isBlockProvidingPowerTo(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, side.ordinal()) > 0)
|
||||
else if(expand && isGettingPowered(world, sideCoord, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ public class GuiReactorStats extends GuiMekanism
|
|||
public TileEntityReactorController tileEntity;
|
||||
public static NumberFormat nf = NumberFormat.getIntegerInstance();
|
||||
|
||||
|
||||
public GuiReactorStats(InventoryPlayer inventory, final TileEntityReactorController tentity)
|
||||
{
|
||||
super(new ContainerNull(inventory.player, tentity));
|
||||
|
|
BIN
src/main/resources/assets/mekanism/gui/GuiMatrixStats.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/GuiMatrixStats.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
src/main/resources/assets/mekanism/gui/elements/GuiEnergyTab.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/elements/GuiEnergyTab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.5 KiB |
|
@ -404,6 +404,8 @@ gui.heat=Heat
|
|||
gui.formed=Formed
|
||||
gui.incomplete=Incomplete
|
||||
gui.inductionMatrix=Induction Matrix
|
||||
gui.matrixStats=Matrix Statistics
|
||||
gui.main=Main
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Reference in a new issue