Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2015-03-19 17:22:45 -04:00
commit 763aef4fd0
7 changed files with 36 additions and 35 deletions

View file

@ -30,9 +30,9 @@ public class UnitDisplayUtils
public static enum TemperatureUnit public static enum TemperatureUnit
{ {
KELVIN("Kelvin", "K", 0, 1), KELVIN("Kelvin", "K", 0, 1),
CELSIUS("Celsius", "C", 273.15, 1), CELSIUS("Celsius", "°C", 273.15, 1),
RANKINE("Rankine", "R", 0, 5/9), RANKINE("Rankine", "R", 0, 5/9),
FAHRENHEIT("Fahrenheit", "F", 459.67, 5/9), FAHRENHEIT("Fahrenheit", "°F", 459.67, 5/9),
AMBIENT("Ambient", "+STP", 300, 1); AMBIENT("Ambient", "+STP", 300, 1);
public String name; public String name;
@ -226,7 +226,7 @@ public class UnitDisplayUtils
if(value == 0) if(value == 0)
{ {
return value + " " + unitName; return value + (isShort ? "" : " ") + unitName;
} }
else { else {
for(int i = 0; i < MeasurementUnit.values().length; i++) for(int i = 0; i < MeasurementUnit.values().length; i++)
@ -235,24 +235,24 @@ public class UnitDisplayUtils
if(lowerMeasure.below(value) && lowerMeasure.ordinal() == 0) if(lowerMeasure.below(value) && lowerMeasure.ordinal() == 0)
{ {
return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + " " + lowerMeasure.getName(isShort) + unitName; return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + (isShort ? "" : " ") + lowerMeasure.getName(isShort) + unitName;
} }
if(lowerMeasure.ordinal() + 1 >= MeasurementUnit.values().length) if(lowerMeasure.ordinal() + 1 >= MeasurementUnit.values().length)
{ {
return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + " " + lowerMeasure.getName(isShort) + unitName; return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + (isShort ? "" : " ") + lowerMeasure.getName(isShort) + unitName;
} }
MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1]; MeasurementUnit upperMeasure = MeasurementUnit.values()[i + 1];
if((lowerMeasure.above(value) && upperMeasure.below(value)) || lowerMeasure.value == value) if((lowerMeasure.above(value) && upperMeasure.below(value)) || lowerMeasure.value == value)
{ {
return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + " " + lowerMeasure.getName(isShort) + unitName; return prefix + roundDecimals(lowerMeasure.process(value), decimalPlaces) + (isShort ? "" : " ") + lowerMeasure.getName(isShort) + unitName;
} }
} }
} }
return prefix + roundDecimals(value, decimalPlaces) + " " + unitName; return prefix + roundDecimals(value, decimalPlaces) + (isShort ? "" : " ") + unitName;
} }
public static String getDisplayShort(double value, TemperatureUnit unit) public static String getDisplayShort(double value, TemperatureUnit unit)

View file

@ -1,6 +1,7 @@
package mekanism.client.gui; package mekanism.client.gui;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer;
import mekanism.common.inventory.container.ContainerSolarEvaporationController; import mekanism.common.inventory.container.ContainerSolarEvaporationController;
import mekanism.common.tile.TileEntitySolarEvaporationController; import mekanism.common.tile.TileEntitySolarEvaporationController;
@ -77,16 +78,16 @@ public class GuiSolarEvaporationController extends GuiMekanism
private String getTemp() private String getTemp()
{ {
float temp = (float)Math.round((tileEntity.getTemperature()*200)*10)/10F; float temp = tileEntity.getTemperature()*200;
return temp + " F"; return MekanismUtils.getTemperatureDisplay(temp, TemperatureUnit.AMBIENT);
} }
private String getMaxTemp() private String getMaxTemp()
{ {
float temp = (float)Math.round((tileEntity.getMaxTemperature()*200)*10)/10F; float temp = tileEntity.getMaxTemperature()*200;
return temp + " F"; return MekanismUtils.getTemperatureDisplay(temp, TemperatureUnit.AMBIENT);
} }
private String getTempMult() private String getTempMult()
@ -107,9 +108,6 @@ public class GuiSolarEvaporationController extends GuiMekanism
int guiHeight = (height - ySize) / 2; int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
int displayInt; int displayInt;
if(tileEntity.getScaledInputLevel(58) > 0) if(tileEntity.getScaledInputLevel(58) > 0)
@ -140,7 +138,7 @@ public class GuiSolarEvaporationController extends GuiMekanism
while(true) while(true)
{ {
int renderRemaining = 0; int renderRemaining;
if(scale > 16) if(scale > 16)
{ {

View file

@ -60,7 +60,6 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.src.FMLRenderAccessLibrary;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
@ -173,7 +172,7 @@ public class ItemRenderingHandler implements IItemRenderer
} }
else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock && item.getItemDamage() == 6) else if(Block.getBlockFromItem(item.getItem()) == MekanismBlocks.BasicBlock && item.getItemDamage() == 6)
{ {
FMLRenderAccessLibrary.renderInventoryBlock((RenderBlocks)data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID); RenderingRegistry.instance().renderInventoryBlock((RenderBlocks)data[0], MekanismBlocks.BasicBlock, item.getItemDamage(), ClientProxy.BASIC_RENDER_ID);
if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null) if(binRenderer == null || binRenderer.func_147498_b()/*getFontRenderer()*/ == null)
{ {

View file

@ -1145,20 +1145,21 @@ public final class MekanismUtils
* @param T - temperature to display * @param T - temperature to display
* @return rounded energy display * @return rounded energy display
*/ */
public static String getTemperatureDisplay(double T) public static String getTemperatureDisplay(double T, TemperatureUnit unit)
{ {
double TK = unit.convertToK(T);
switch(general.tempUnit) switch(general.tempUnit)
{ {
case K: case K:
return UnitDisplayUtils.getDisplayShort(T, TemperatureUnit.KELVIN); return UnitDisplayUtils.getDisplayShort(TK, TemperatureUnit.KELVIN);
case C: case C:
return UnitDisplayUtils.getDisplayShort(T, TemperatureUnit.CELSIUS); return UnitDisplayUtils.getDisplayShort(TK, TemperatureUnit.CELSIUS);
case R: case R:
return UnitDisplayUtils.getDisplayShort(T, TemperatureUnit.RANKINE); return UnitDisplayUtils.getDisplayShort(TK, TemperatureUnit.RANKINE);
case F: case F:
return UnitDisplayUtils.getDisplayShort(T, TemperatureUnit.FAHRENHEIT); return UnitDisplayUtils.getDisplayShort(TK, TemperatureUnit.FAHRENHEIT);
case STP: case STP:
return UnitDisplayUtils.getDisplayShort(T, TemperatureUnit.AMBIENT); return UnitDisplayUtils.getDisplayShort(TK, TemperatureUnit.AMBIENT);
} }
return "error"; return "error";

View file

@ -6,6 +6,7 @@ import java.util.List;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.energy.IStrictEnergyStorage; import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.api.util.ListUtils; import mekanism.api.util.ListUtils;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.GuiMekanism;
import mekanism.client.gui.element.GuiEnergyGauge; import mekanism.client.gui.element.GuiEnergyGauge;
import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiEnergyInfo;
@ -65,7 +66,7 @@ public class GuiReactorHeat extends GuiMekanism
@Override @Override
public double getLevel() public double getLevel()
{ {
return tileEntity.getPlasmaTemp(); return TemperatureUnit.AMBIENT.convertToK(tileEntity.getPlasmaTemp());
} }
@Override @Override
@ -77,7 +78,7 @@ public class GuiReactorHeat extends GuiMekanism
@Override @Override
public String getText(double level) public String getText(double level)
{ {
return "Plasma: " + MekanismUtils.getTemperatureDisplay(level); return "Plasma: " + MekanismUtils.getTemperatureDisplay(level, TemperatureUnit.KELVIN);
} }
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 7, 50)); }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 7, 50));
guiElements.add(new GuiProgress(new IProgressInfoHandler() guiElements.add(new GuiProgress(new IProgressInfoHandler()
@ -99,7 +100,7 @@ public class GuiReactorHeat extends GuiMekanism
@Override @Override
public double getLevel() public double getLevel()
{ {
return tileEntity.getCaseTemp(); return TemperatureUnit.AMBIENT.convertToK(tileEntity.getCaseTemp());
} }
@Override @Override
@ -111,7 +112,7 @@ public class GuiReactorHeat extends GuiMekanism
@Override @Override
public String getText(double level) public String getText(double level)
{ {
return "Case: " + MekanismUtils.getTemperatureDisplay(level); return "Case: " + MekanismUtils.getTemperatureDisplay(level, TemperatureUnit.KELVIN);
} }
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 61, 50)); }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"), 61, 50));
guiElements.add(new GuiProgress(new IProgressInfoHandler() guiElements.add(new GuiProgress(new IProgressInfoHandler()

View file

@ -7,6 +7,7 @@ import java.util.List;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.api.util.ListUtils; import mekanism.api.util.ListUtils;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.GuiMekanism;
@ -56,16 +57,16 @@ public class GuiReactorStats extends GuiMekanism
{ {
fontRendererObj.drawString(EnumColor.DARK_GREEN + MekanismUtils.localize("gui.passive"), 6, 26, 0x404040); fontRendererObj.drawString(EnumColor.DARK_GREEN + MekanismUtils.localize("gui.passive"), 6, 26, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(false)), 16, 36, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(false)), 16, 36, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getIgnitionTemperature(false))), 16, 46, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getIgnitionTemperature(false), TemperatureUnit.AMBIENT)), 16, 46, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxPlasmaTemperature(false))), 16, 56, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxPlasmaTemperature(false), TemperatureUnit.AMBIENT)), 16, 56, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxCasingTemperature(false))), 16, 66, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxCasingTemperature(false), TemperatureUnit.AMBIENT)), 16, 66, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, false))+"/t", 16, 76, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, false))+"/t", 16, 76, 0x404040);
fontRendererObj.drawString(EnumColor.DARK_BLUE + MekanismUtils.localize("gui.active"), 6, 92, 0x404040); fontRendererObj.drawString(EnumColor.DARK_BLUE + MekanismUtils.localize("gui.active"), 6, 92, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(true)), 16, 102, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(true)), 16, 102, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getIgnitionTemperature(true))), 16, 112, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getIgnitionTemperature(true), TemperatureUnit.AMBIENT)), 16, 112, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxPlasmaTemperature(true))), 16, 122, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxPlasmaTemperature(true), TemperatureUnit.AMBIENT)), 16, 122, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxCasingTemperature(true))), 16, 132, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay(tileEntity.getReactor().getMaxCasingTemperature(true), TemperatureUnit.AMBIENT)), 16, 132, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(true, false))+"/t", 16, 142, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(true, false))+"/t", 16, 142, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("gui.steamProduction") + ": " + nf.format(tileEntity.getReactor().getSteamPerTick(false)) + "mB/t", 16, 152, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("gui.steamProduction") + ": " + nf.format(tileEntity.getReactor().getSteamPerTick(false)) + "mB/t", 16, 152, 0x404040);
} }

View file

@ -18,6 +18,7 @@ import mekanism.api.lasers.ILaserReceptor;
import mekanism.api.reactor.IFusionReactor; import mekanism.api.reactor.IFusionReactor;
import mekanism.api.reactor.INeutronCapture; import mekanism.api.reactor.INeutronCapture;
import mekanism.api.reactor.IReactorBlock; import mekanism.api.reactor.IReactorBlock;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.generators.common.item.ItemHohlraum; import mekanism.generators.common.item.ItemHohlraum;
@ -41,7 +42,7 @@ public class FusionReactor implements IFusionReactor
public Set<INeutronCapture> neutronCaptors = new HashSet<INeutronCapture>(); public Set<INeutronCapture> neutronCaptors = new HashSet<INeutronCapture>();
public Set<IHeatTransfer> heatTransfers = new HashSet<IHeatTransfer>(); public Set<IHeatTransfer> heatTransfers = new HashSet<IHeatTransfer>();
//Current stores of temperature //Current stores of temperature - internally uses ambient-relative kelvin units
public double plasmaTemperature; public double plasmaTemperature;
public double caseTemperature; public double caseTemperature;
@ -52,7 +53,7 @@ public class FusionReactor implements IFusionReactor
public double heatToAbsorb = 0; public double heatToAbsorb = 0;
//Reaction characteristics //Reaction characteristics
public static double burnTemperature = 1E8; public static double burnTemperature = TemperatureUnit.AMBIENT.convertFromK(1E8);
public static double burnRatio = 1; public static double burnRatio = 1;
public static double energyPerFuel = 5E6; public static double energyPerFuel = 5E6;
public int injectionRate = 0; public int injectionRate = 0;