Many more fixes

This commit is contained in:
aidancbrady 2016-02-28 19:11:43 -05:00
parent 7c160cc264
commit f09010a927
11 changed files with 100 additions and 24 deletions

View file

@ -1,10 +1,95 @@
package mekanism.client.gui;
import java.util.List;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.generators;
import mekanism.api.util.ListUtils;
import mekanism.api.util.UnitDisplayUtils;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.client.gui.element.GuiBoilerTab;
import mekanism.client.gui.element.GuiBoilerTab.BoilerTab;
import mekanism.client.gui.element.GuiElement.IInfoHandler;
import mekanism.client.gui.element.GuiHeatInfo;
import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.tile.TileEntityBoilerCasing;
import mekanism.common.util.LangUtils;
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 GuiBoilerStats
public class GuiBoilerStats extends GuiMekanism
{
public TileEntityBoilerCasing tileEntity;
public GuiBoilerStats(InventoryPlayer inventory, TileEntityBoilerCasing tentity)
{
super(tentity, new ContainerNull(inventory.player, tentity));
tileEntity = tentity;
guiElements.add(new GuiBoilerTab(this, tileEntity, BoilerTab.MAIN, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png")));
guiElements.add(new GuiHeatInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
String loss = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss, TemperatureUnit.KELVIN);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + loss + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png")));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
String stats = LangUtils.localize("gui.boilerStats");
String limiting = EnumColor.DARK_RED + " (" + LangUtils.localize("gui.limiting") + ")";
/*fontRendererObj.drawString(stats, (xSize/2)-(fontRendererObj.getStringWidth(stats)/2), 6, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.tankVolume") + ": " + tileEntity.structure.lowerVolume, 8, 26, 0x404040);
boolean dispersersLimiting = tileEntity.structure.lowerVolume*tileEntity.structure.clientDispersers*generators.turbineDisperserGasFlow <
tileEntity.structure.vents*generators.turbineVentGasFlow;
boolean ventsLimiting = tileEntity.structure.lowerVolume*tileEntity.structure.clientDispersers*generators.turbineDisperserGasFlow >
tileEntity.structure.vents*generators.turbineVentGasFlow;
fontRendererObj.drawString(LangUtils.localize("gui.steamFlow"), 8, 40, 0x797979);
fontRendererObj.drawString(LangUtils.localize("gui.dispersers") + ": " + tileEntity.structure.clientDispersers + (dispersersLimiting ? limiting : ""), 14, 49, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.vents") + ": " + tileEntity.structure.vents + (ventsLimiting ? limiting : ""), 14, 58, 0x404040);
boolean bladesLimiting = tileEntity.structure.coils*4 > tileEntity.structure.blades;
boolean coilsLimiting = tileEntity.structure.coils*4 < tileEntity.structure.blades;
fontRendererObj.drawString(LangUtils.localize("gui.production"), 8, 72, 0x797979);
fontRendererObj.drawString(LangUtils.localize("gui.blades") + ": " + tileEntity.structure.blades + (bladesLimiting ? limiting : ""), 14, 81, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.coils") + ": " + tileEntity.structure.coils + (coilsLimiting ? limiting : ""), 14, 90, 0x404040);
double energyMultiplier = generators.turbineBaseEnergyPerSteam*Math.min(tileEntity.structure.blades, tileEntity.structure.coils*generators.turbineBladesPerCoil);
double rate = tileEntity.structure.lowerVolume*(tileEntity.structure.clientDispersers*generators.turbineDisperserGasFlow);
rate = Math.min(rate, tileEntity.structure.vents*generators.turbineVentGasFlow);
fontRendererObj.drawString(LangUtils.localize("gui.maxProduction") + ": " + MekanismUtils.getEnergyDisplay(rate*energyMultiplier), 8, 104, 0x404040);*/
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiNull.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);
}
}

View file

@ -66,7 +66,7 @@ public class GuiThermoelectricBoiler extends GuiMekanism
public double getLevel()
{
double max = Math.floor(tileEntity.structure.clientHeatAvailable / tileEntity.structure.enthalpyOfVaporization);
double cap = tileEntity.structure.superheatingElements*general.superheatingHeatTransfer;
double cap = (tileEntity.structure.superheatingElements*general.superheatingHeatTransfer) / tileEntity.structure.enthalpyOfVaporization;
return max/cap;
}
}, MekanismUtils.getResource(ResourceType.GUI, "GuiThermoelectricBoiler.png"), 144, 13));

View file

@ -60,6 +60,8 @@ public class MekanismRenderer
public static IIcon energyIcon;
public static IIcon heatIcon;
public static float GAS_RENDER_BASE = 0.2F;
public static Map<TransmissionType, IIcon> overlays = new HashMap<TransmissionType, IIcon>();
private static float lightmapLastX;

View file

@ -61,7 +61,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
if(tileEntity.structure.fluidStored.getFluid().isGaseous())
{
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.clientCapacity)+0.3F));
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.clientCapacity)+MekanismRenderer.GAS_RENDER_BASE));
displayList[getStages(data.height)-1].render();
}
else {

View file

@ -59,7 +59,7 @@ public class RenderFluidTank extends TileEntitySpecialRenderer
if(fluid.isGaseous())
{
GL11.glColor4f(1F, 1F, 1F, Math.min(1, fluidScale+0.3F));
GL11.glColor4f(1F, 1F, 1F, Math.min(1, fluidScale+MekanismRenderer.GAS_RENDER_BASE));
displayList[stages-1].render();
}
else {

View file

@ -42,7 +42,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityBoilerCasing tileEntity, double x, double y, double z, float partialTick)
{
if(tileEntity.clientHasStructure && tileEntity.isRendering && tileEntity.structure != null)
if(tileEntity.clientHasStructure && tileEntity.isRendering && tileEntity.structure != null && tileEntity.structure.renderLocation != null && tileEntity.structure.upperRenderLocation != null)
{
if(tileEntity.structure.waterStored != null && tileEntity.structure.waterStored.amount != 0)
{
@ -52,8 +52,6 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
data.height = (tileEntity.structure.upperRenderLocation.yCoord-1)-tileEntity.structure.renderLocation.yCoord;
data.length = tileEntity.structure.volLength;
data.width = tileEntity.structure.volWidth;
System.out.println("Water height: " + data.height);
bindTexture(MekanismRenderer.getBlocksTexture());
@ -70,7 +68,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
if(tileEntity.structure.waterStored.getFluid().isGaseous())
{
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.waterStored.amount / (float)tileEntity.clientWaterCapacity)+0.3F));
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.waterStored.amount / (float)tileEntity.clientWaterCapacity)+MekanismRenderer.GAS_RENDER_BASE));
displayList[getStages(data.height)-1].render();
}
else {
@ -108,8 +106,6 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
data.height = (tileEntity.structure.renderLocation.yCoord+tileEntity.structure.volHeight-2)-(tileEntity.structure.upperRenderLocation.yCoord);
data.length = tileEntity.structure.volLength;
data.width = tileEntity.structure.volWidth;
System.out.println("Steam height: " + data.height);
bindTexture(MekanismRenderer.getBlocksTexture());
@ -124,7 +120,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
DisplayInteger display = getUpperDisplay(data, tileEntity.structure.steamStored.getFluid(), tileEntity.getWorldObj());
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.steamStored.amount / (float)tileEntity.clientSteamCapacity)+0.3F));
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.steamStored.amount / (float)tileEntity.clientSteamCapacity)+MekanismRenderer.GAS_RENDER_BASE));
display.render();
MekanismRenderer.glowOff();
@ -179,7 +175,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
toReturn.minZ = 0 + .01;
toReturn.maxX = data.length - .01;
toReturn.maxY = ((float)i/(float)stages)*(data.height-2) - .01;
toReturn.maxY = ((float)i/(float)stages)*data.height - .01;
toReturn.maxZ = data.width - .01;
MekanismRenderer.renderObject(toReturn);

View file

@ -1205,7 +1205,7 @@ public class Mekanism
GasRegistry.register(new Gas("lithium")).registerFluid();
FluidRegistry.registerFluid(new Fluid("heavyWater"));
FluidRegistry.registerFluid(new Fluid("steam"));
FluidRegistry.registerFluid(new Fluid("steam").setGaseous(true));
for(Resource resource : Resource.values())
{

View file

@ -74,7 +74,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
//Ensure at least one disperser exists
if(dispersers.size() == 0)
{
System.out.println("No dispersers");
return false;
}
@ -90,7 +89,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
if(!(tile instanceof TileEntityPressureDisperser))
{
System.out.println("Missing disperser");
return false;
}
@ -101,7 +99,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
//If there are more dispersers than those on the plane found, the structure is invalid
if(dispersers.size() > 0)
{
System.out.println("Bad disperser");
return false;
}
@ -118,7 +115,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
if(elements.size() > structure.superheatingElements)
{
System.out.println("Disconnected elements");
return false;
}
@ -144,7 +140,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
//Some air must exist for the structure to be valid
if(initAir == null)
{
System.out.println("No air");
return false;
}
@ -164,7 +159,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
//Make sure all air blocks are connected
if(totalAir > structure.waterVolume)
{
System.out.println("nonconnected air");
return false;
}
@ -172,7 +166,6 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
structure.steamVolume = structure.volWidth*structure.volLength*steamHeight;
structure.upperRenderLocation = new Coord4D(structure.renderLocation.xCoord, initDisperser.yCoord+1, structure.renderLocation.zCoord);
System.out.println(structure.superheatingElements + " " + structure.waterVolume + " " + structure.steamVolume);
return true;
}

View file

@ -16,7 +16,7 @@ import net.minecraftforge.fluids.FluidStack;
public class SynchronizedBoilerData extends SynchronizedData<SynchronizedBoilerData> implements IHeatTransfer
{
public static double CASING_INSULATION_COEFFICIENT = 10;
public static double CASING_INSULATION_COEFFICIENT = 1;
public static double CASING_INVERSE_CONDUCTION_COEFFICIENT = 1;
public static double BASE_BOIL_TEMP = 100-(TemperatureUnit.AMBIENT.zeroOffset-TemperatureUnit.CELSIUS.zeroOffset);

View file

@ -201,8 +201,8 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock<SynchronizedBoi
if(structure != null)
{
data.add(structure.volume*BoilerUpdateProtocol.WATER_PER_TANK);
data.add(structure.volume*BoilerUpdateProtocol.STEAM_PER_TANK);
data.add(structure.waterVolume*BoilerUpdateProtocol.WATER_PER_TANK);
data.add(structure.steamVolume*BoilerUpdateProtocol.STEAM_PER_TANK);
data.add(structure.editMode.ordinal());
data.add(structure.lastEnvironmentLoss);
data.add(structure.lastBoilRate);

View file

@ -82,7 +82,7 @@ public class RenderIndustrialTurbine extends TileEntitySpecialRenderer
DisplayInteger display = getListAndRender(data, tileEntity.getWorldObj());
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.structure.getFluidCapacity())+0.3F));
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.structure.getFluidCapacity())+MekanismRenderer.GAS_RENDER_BASE));
display.render();
MekanismRenderer.glowOff();