From 16e38fafbe06cc0d259cee769fd19e49671cf10e Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Fri, 18 Jul 2014 23:25:00 +0100 Subject: [PATCH 1/3] Fix things, adjust the algorithm slightly to model the differential equation better. --- .../generators/common/FusionReactor.java | 34 ++++++++++++------- .../tile/reactor/TileEntityReactorBlock.java | 1 + .../reactor/TileEntityReactorController.java | 2 ++ .../tile/reactor/TileEntityReactorPort.java | 3 ++ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/java/mekanism/generators/common/FusionReactor.java b/src/main/java/mekanism/generators/common/FusionReactor.java index b2581ee5b..8ffd9e7a8 100644 --- a/src/main/java/mekanism/generators/common/FusionReactor.java +++ b/src/main/java/mekanism/generators/common/FusionReactor.java @@ -34,21 +34,26 @@ public class FusionReactor implements IFusionReactor public Set reactorBlocks = new HashSet(); public Set neutronCaptors = new HashSet(); - //Current stores of energy + //Current stores of temperature public double plasmaTemperature; public double caseTemperature; + //Last values of temperature + public double lastPlasmaTemperature; + public double lastCaseTemperature; + //Reaction characteristics public static double burnTemperature = 1E8; public static double burnRatio = 1; - public static double tempPerFuel = 5E6; + public static double energyPerFuel = 5E6; public int injectionRate = 0; //Thermal characteristics - public static double plasmaHeatCapacity = 1; + public static double plasmaHeatCapacity = 100; public static double caseHeatCapacity = 1; public static double enthalpyOfVaporization = 10; - public static double thermocoupleEfficiency = 0.01; + public static double thermocoupleEfficiency = 0.001; + public static double steamTransferEfficiency = 0.01; //Heat transfer metrics public static double plasmaCaseConductivity = 0.2; @@ -99,6 +104,9 @@ public class FusionReactor implements IFusionReactor //Perform the heat transfer calculations transferHeat(); + lastPlasmaTemperature = plasmaTemperature; + lastCaseTemperature = caseTemperature; + if(plasmaTemperature > 1E-6 || caseTemperature > 1E-6) { Mekanism.logger.info("Reactor temperatures: Plasma: " + (int) plasmaTemperature + ", Casing: " + (int) caseTemperature); @@ -125,9 +133,9 @@ public class FusionReactor implements IFusionReactor public int burnFuel() { - int fuelBurned = (int)min(getFuelTank().getStored(), max(0, plasmaTemperature - burnTemperature)*burnRatio); + int fuelBurned = (int)min(getFuelTank().getStored(), max(0, lastPlasmaTemperature - burnTemperature)*burnRatio); getFuelTank().draw(fuelBurned, true); - plasmaTemperature += tempPerFuel * fuelBurned; + plasmaTemperature += energyPerFuel * fuelBurned / plasmaHeatCapacity; return fuelBurned; } @@ -149,29 +157,29 @@ public class FusionReactor implements IFusionReactor public void transferHeat() { //Transfer from plasma to casing - double plasmaCaseHeat = plasmaCaseConductivity * (plasmaTemperature - caseTemperature); + double plasmaCaseHeat = plasmaCaseConductivity * (lastPlasmaTemperature - lastCaseTemperature); plasmaTemperature -= plasmaCaseHeat / plasmaHeatCapacity; caseTemperature += plasmaCaseHeat / caseHeatCapacity; //Transfer from casing to water if necessary if(activelyCooled) { - double caseWaterHeat = caseWaterConductivity * caseTemperature; - int waterToVaporize = (int)(caseWaterHeat / enthalpyOfVaporization); - Mekanism.logger.info("Wanting to vaporise " + waterToVaporize + "mB of water"); + double caseWaterHeat = caseWaterConductivity * lastCaseTemperature; + int waterToVaporize = (int)(steamTransferEfficiency * caseWaterHeat / enthalpyOfVaporization); + //Mekanism.logger.info("Wanting to vaporise " + waterToVaporize + "mB of water"); waterToVaporize = min(waterToVaporize, min(getWaterTank().getFluidAmount(), getSteamTank().getCapacity() - getSteamTank().getFluidAmount())); if(waterToVaporize > 0) { - Mekanism.logger.info("Vaporising " + waterToVaporize + "mB of water"); + //Mekanism.logger.info("Vaporising " + waterToVaporize + "mB of water"); getWaterTank().drain(waterToVaporize, true); getSteamTank().fill(new FluidStack(FluidRegistry.getFluid("steam"), waterToVaporize), true); } - caseWaterHeat = waterToVaporize * enthalpyOfVaporization; + caseWaterHeat = waterToVaporize * enthalpyOfVaporization / steamTransferEfficiency; caseTemperature -= caseWaterHeat / caseHeatCapacity; } //Transfer from casing to environment - double caseAirHeat = caseAirConductivity * caseTemperature; + double caseAirHeat = caseAirConductivity * lastCaseTemperature; caseTemperature -= caseAirHeat / caseHeatCapacity; setBufferedEnergy(getBufferedEnergy() + caseAirHeat * thermocoupleEfficiency); } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java index 798ca4bd0..890c413ef 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java @@ -57,6 +57,7 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp if(changed) { worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); + changed = false; } } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java index ccbdc2116..5e17ee5a6 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java @@ -4,6 +4,7 @@ import mekanism.api.gas.GasTank; import mekanism.common.Mekanism; import mekanism.generators.common.FusionReactor; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidTank; @@ -24,6 +25,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock public TileEntityReactorController() { super("ReactorController", 1000000000); + inventory = new ItemStack[1]; } @Override diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java index ceaed6ea7..f5e0fc5cc 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java @@ -11,6 +11,7 @@ import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; import mekanism.common.util.CableUtils; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -23,7 +24,9 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl public TileEntityReactorPort() { super("name", 1); + inventory = new ItemStack[0]; } + @Override public boolean isFrame() { From 2e7d3a194571c968aa9e34cbc1dcac322b2cc9f3 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sat, 19 Jul 2014 03:23:11 +0100 Subject: [PATCH 2/3] Work on making it work Client-side. --- .../mekanism/api/reactor/IFusionReactor.java | 8 ++ .../client/render/MekanismRenderer.java | 6 +- .../client/GeneratorsClientProxy.java | 9 ++ .../client/gui/GuiNeutronCapture.java | 71 ++++++++++ .../client/gui/GuiReactorController.java | 86 ++++++++++++ .../generators/common/FusionReactor.java | 34 ++++- .../common/GeneratorsCommonProxy.java | 6 + .../generators/common/block/BlockReactor.java | 87 +++++++++++- .../container/ContainerNeutronCapture.java | 125 ++++++++++++++++++ .../container/ContainerReactorController.java | 125 ++++++++++++++++++ .../reactor/TileEntityReactorController.java | 88 +++++++++++- .../{Chlorine.png => LiquidChlorine.png} | Bin .../blocks/{Ethene.png => LiquidEthene.png} | Bin ...ene.png.mcmeta => LiquidEthene.png.mcmeta} | 0 .../{WaterVapor.png => LiquidSteam.png} | Bin ...apor.png.mcmeta => LiquidSteam.png.mcmeta} | 0 .../blocks/ReactorControllerOn.png.mcmeta | 5 + 17 files changed, 638 insertions(+), 12 deletions(-) create mode 100644 src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java create mode 100644 src/main/java/mekanism/generators/client/gui/GuiReactorController.java create mode 100644 src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java create mode 100644 src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java rename src/main/resources/assets/mekanism/textures/blocks/{Chlorine.png => LiquidChlorine.png} (100%) rename src/main/resources/assets/mekanism/textures/blocks/{Ethene.png => LiquidEthene.png} (100%) rename src/main/resources/assets/mekanism/textures/blocks/{Ethene.png.mcmeta => LiquidEthene.png.mcmeta} (100%) rename src/main/resources/assets/mekanism/textures/blocks/{WaterVapor.png => LiquidSteam.png} (100%) rename src/main/resources/assets/mekanism/textures/blocks/{WaterVapor.png.mcmeta => LiquidSteam.png.mcmeta} (100%) create mode 100644 src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png.mcmeta diff --git a/src/main/java/mekanism/api/reactor/IFusionReactor.java b/src/main/java/mekanism/api/reactor/IFusionReactor.java index 13564af55..41f91ce07 100644 --- a/src/main/java/mekanism/api/reactor/IFusionReactor.java +++ b/src/main/java/mekanism/api/reactor/IFusionReactor.java @@ -24,6 +24,14 @@ public interface IFusionReactor public void setBufferedEnergy(double energy); + public double getPlasmaTemp(); + + public void setPlasmaTemp(double temp); + + public double getCaseTemp(); + + public void setCaseTemp(double temp); + public double getBufferSize(); public void formMultiblock(); diff --git a/src/main/java/mekanism/client/render/MekanismRenderer.java b/src/main/java/mekanism/client/render/MekanismRenderer.java index c82a99d1b..db703eadc 100644 --- a/src/main/java/mekanism/client/render/MekanismRenderer.java +++ b/src/main/java/mekanism/client/render/MekanismRenderer.java @@ -73,7 +73,7 @@ public class MekanismRenderer GasRegistry.getGas("hydrogen").setIcon(event.map.registerIcon("mekanism:LiquidHydrogen")); GasRegistry.getGas("oxygen").setIcon(event.map.registerIcon("mekanism:LiquidOxygen")); - GasRegistry.getGas("water").setIcon(event.map.registerIcon("mekanism:WaterVapor")); + GasRegistry.getGas("water").setIcon(event.map.registerIcon("mekanism:LiquidSteam")); GasRegistry.getGas("chlorine").setIcon(event.map.registerIcon("mekanism:LiquidChlorine")); GasRegistry.getGas("sulfurDioxideGas").setIcon(event.map.registerIcon("mekanism:LiquidSulfurDioxide")); GasRegistry.getGas("sulfurTrioxideGas").setIcon(event.map.registerIcon("mekanism:LiquidSulfurTrioxide")); @@ -81,13 +81,13 @@ public class MekanismRenderer GasRegistry.getGas("hydrogenChloride").setIcon(event.map.registerIcon("mekanism:LiquidHydrogenChloride")); GasRegistry.getGas("liquidOsmium").setIcon(event.map.registerIcon("mekanism:LiquidOsmium")); GasRegistry.getGas("liquidStone").setIcon(event.map.registerIcon("mekanism:LiquidStone")); - GasRegistry.getGas("ethene").setIcon(event.map.registerIcon("mekanism:Ethene")); + GasRegistry.getGas("ethene").setIcon(event.map.registerIcon("mekanism:LiquidEthene")); GasRegistry.getGas("brine").setIcon(event.map.registerIcon("mekanism:LiquidBrine")); GasRegistry.getGas("sodium").setIcon(event.map.registerIcon("mekanism:LiquidSodium")); GasRegistry.getGas("deuterium").setIcon(event.map.registerIcon("mekanism:LiquidDeuterium")); GasRegistry.getGas("tritium").setIcon(event.map.registerIcon("mekanism:LiquidTritium")); GasRegistry.getGas("fusionFuelDD").setIcon(event.map.registerIcon("mekanism:LiquidDD")); - GasRegistry.getGas("fusionFuelDT").setIcon(event.map.registerIcon("mekanism:liquidDT")); + GasRegistry.getGas("fusionFuelDT").setIcon(event.map.registerIcon("mekanism:LiquidDT")); GasRegistry.getGas("steam").setIcon(event.map.registerIcon("mekanism:LiquidSteam")); for(Gas gas : GasRegistry.getRegisteredGasses()) diff --git a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java index bacdd9188..b596bbdcb 100644 --- a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java +++ b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java @@ -3,6 +3,8 @@ package mekanism.generators.client; import mekanism.generators.client.gui.GuiBioGenerator; import mekanism.generators.client.gui.GuiHeatGenerator; import mekanism.generators.client.gui.GuiGasGenerator; +import mekanism.generators.client.gui.GuiNeutronCapture; +import mekanism.generators.client.gui.GuiReactorController; import mekanism.generators.client.gui.GuiSolarGenerator; import mekanism.generators.client.gui.GuiWindTurbine; import mekanism.generators.client.render.RenderAdvancedSolarGenerator; @@ -18,6 +20,9 @@ import mekanism.generators.common.tile.TileEntityHeatGenerator; import mekanism.generators.common.tile.TileEntityGasGenerator; import mekanism.generators.common.tile.TileEntitySolarGenerator; import mekanism.generators.common.tile.TileEntityWindTurbine; +import mekanism.generators.common.tile.reactor.TileEntityReactorController; +import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; + import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -69,6 +74,10 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy return new GuiBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); case 5: return new GuiWindTurbine(player.inventory, (TileEntityWindTurbine)tileEntity); + case 10: + return new GuiReactorController(player.inventory, (TileEntityReactorController)tileEntity); + case 11: + return new GuiNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity); } return null; diff --git a/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java b/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java new file mode 100644 index 000000000..17c7e0eba --- /dev/null +++ b/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java @@ -0,0 +1,71 @@ +package mekanism.generators.client.gui; + +import java.util.List; + +import mekanism.api.ListUtils; +import mekanism.client.gui.GuiEnergyInfo; +import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; +import mekanism.client.gui.GuiMekanism; +import mekanism.client.gui.GuiPowerBar; +import mekanism.client.gui.GuiRedstoneControl; +import mekanism.client.gui.GuiSlot; +import mekanism.client.gui.GuiSlot.SlotOverlay; +import mekanism.client.gui.GuiSlot.SlotType; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.generators.common.inventory.container.ContainerNeutronCapture; +import mekanism.generators.common.inventory.container.ContainerReactorController; +import mekanism.generators.common.tile.reactor.TileEntityReactorController; +import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; + +import net.minecraft.entity.player.InventoryPlayer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiNeutronCapture extends GuiMekanism +{ + public TileEntityReactorNeutronCapture tileEntity; + + public GuiNeutronCapture(InventoryPlayer inventory, TileEntityReactorNeutronCapture tentity) + { + super(new ContainerNeutronCapture(inventory, tentity)); + tileEntity = tentity; + guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); + guiElements.add(new GuiEnergyInfo(new IInfoHandler() + { + @Override + public List getInfo() + { + return ListUtils.asList( + "Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + "Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); + } + }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); + guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15)); + guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 142, 34).with(SlotOverlay.POWER)); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + + fontRendererObj.drawString(tileEntity.getInventoryName(), 30, 6, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); + fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) + { + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.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); + } +} diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java new file mode 100644 index 000000000..1591502cc --- /dev/null +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java @@ -0,0 +1,86 @@ +package mekanism.generators.client.gui; + +import java.util.List; + +import mekanism.api.ListUtils; +import mekanism.client.gui.GuiEnergyInfo; +import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; +import mekanism.client.gui.GuiMekanism; +import mekanism.client.gui.GuiPowerBar; +import mekanism.client.gui.GuiRedstoneControl; +import mekanism.client.gui.GuiSlot; +import mekanism.client.gui.GuiSlot.SlotOverlay; +import mekanism.client.gui.GuiSlot.SlotType; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.generators.common.MekanismGenerators; +import mekanism.generators.common.inventory.container.ContainerReactorController; +import mekanism.generators.common.inventory.container.ContainerSolarGenerator; +import mekanism.generators.common.tile.TileEntitySolarGenerator; +import mekanism.generators.common.tile.reactor.TileEntityReactorController; + +import net.minecraft.entity.player.InventoryPlayer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiReactorController extends GuiMekanism +{ + public TileEntityReactorController tileEntity; + + public GuiReactorController(InventoryPlayer inventory, TileEntityReactorController tentity) + { + super(new ContainerReactorController(inventory, tentity)); + tileEntity = tentity; + guiElements.add(new GuiEnergyInfo(new IInfoHandler() + { + @Override + public List getInfo() + { + return ListUtils.asList( + "Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + "Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); + } + }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); + guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15)); + guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 142, 34)); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + + fontRendererObj.drawString(tileEntity.getInventoryName(), 30, 6, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); + fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 151, (ySize - 96) + 2, 0x00CD00); + if(tileEntity.getReactor() == null) + { + fontRendererObj.drawString(MekanismUtils.localize("container.reactor.notFormed"), 8, 16, 0x404040); + } + else + { + fontRendererObj.drawString(MekanismUtils.localize("container.reactor.formed"), 8, 16, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("plasma") + ": " + tileEntity.getReactor().getPlasmaTemp(), 8, 26, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("casing") + ": " + tileEntity.getReactor().getCaseTemp(), 8, 36, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("fuelLevel") + ": " + tileEntity.fuelTank.getStored(), 8, 46, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("deuterium") + ": " + tileEntity.deuteriumTank.getStored(), 8, 56, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("tritium") + ": " + tileEntity.tritiumTank.getStored(), 8, 66, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("water") + ": " + tileEntity.waterTank.getFluidAmount(), 8, 76, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("steam") + ": " + tileEntity.steamTank.getFluidAmount(), 8, 86, 0x404040); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) + { + mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.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); + } +} diff --git a/src/main/java/mekanism/generators/common/FusionReactor.java b/src/main/java/mekanism/generators/common/FusionReactor.java index 8ffd9e7a8..eb4ee8005 100644 --- a/src/main/java/mekanism/generators/common/FusionReactor.java +++ b/src/main/java/mekanism/generators/common/FusionReactor.java @@ -52,8 +52,8 @@ public class FusionReactor implements IFusionReactor public static double plasmaHeatCapacity = 100; public static double caseHeatCapacity = 1; public static double enthalpyOfVaporization = 10; - public static double thermocoupleEfficiency = 0.001; - public static double steamTransferEfficiency = 0.01; + public static double thermocoupleEfficiency = 0.01; + public static double steamTransferEfficiency = 0.1; //Heat transfer metrics public static double plasmaCaseConductivity = 0.2; @@ -80,6 +80,12 @@ public class FusionReactor implements IFusionReactor @Override public void simulate() { + if(controller.getWorldObj().isRemote) + { + lastPlasmaTemperature = plasmaTemperature; + lastCaseTemperature = caseTemperature; + return; + } //Only thermal transfer happens unless we're hot enough to burn. if(plasmaTemperature >= burnTemperature) { @@ -226,6 +232,30 @@ public class FusionReactor implements IFusionReactor controller.setEnergy(energy); } + @Override + public double getPlasmaTemp() + { + return lastPlasmaTemperature; + } + + @Override + public void setPlasmaTemp(double temp) + { + plasmaTemperature = temp; + } + + @Override + public double getCaseTemp() + { + return lastCaseTemperature; + } + + @Override + public void setCaseTemp(double temp) + { + caseTemperature = temp; + } + @Override public double getBufferSize() { diff --git a/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java b/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java index 26c63f7c9..2b316f330 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java +++ b/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java @@ -4,6 +4,8 @@ import mekanism.common.Mekanism; import mekanism.generators.common.inventory.container.ContainerBioGenerator; import mekanism.generators.common.inventory.container.ContainerHeatGenerator; import mekanism.generators.common.inventory.container.ContainerGasGenerator; +import mekanism.generators.common.inventory.container.ContainerNeutronCapture; +import mekanism.generators.common.inventory.container.ContainerReactorController; import mekanism.generators.common.inventory.container.ContainerSolarGenerator; import mekanism.generators.common.inventory.container.ContainerWindTurbine; import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator; @@ -119,6 +121,10 @@ public class GeneratorsCommonProxy return new ContainerBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity); case 5: return new ContainerWindTurbine(player.inventory, (TileEntityWindTurbine)tileEntity); + case 10: + return new ContainerReactorController(player.inventory, (TileEntityReactorController)tileEntity); + case 11: + return new ContainerNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity); } return null; diff --git a/src/main/java/mekanism/generators/common/block/BlockReactor.java b/src/main/java/mekanism/generators/common/block/BlockReactor.java index c8c768f65..c481e8551 100644 --- a/src/main/java/mekanism/generators/common/block/BlockReactor.java +++ b/src/main/java/mekanism/generators/common/block/BlockReactor.java @@ -132,12 +132,69 @@ public class BlockReactor extends BlockContainer @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ) { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileEntityReactorController) + if(ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem())) { - ((TileEntityReactorController)tile).formMultiblock(); + return false; } - return true; + + if(world.isRemote) + { + return true; + } + + TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getTileEntity(x, y, z); + int metadata = world.getBlockMetadata(x, y, z); + + if(entityplayer.getCurrentEquippedItem() != null) + { + if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && entityplayer.getCurrentEquippedItem().getItem() instanceof IToolWrench && !entityplayer.getCurrentEquippedItem().getUnlocalizedName().contains("omniwrench")) + { + if(entityplayer.isSneaking()) + { + dismantleBlock(world, x, y, z, false); + return true; + } + + ((IToolWrench)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z); + + int change = 0; + + switch(tileEntity.facing) + { + case 3: + change = 5; + break; + case 5: + change = 2; + break; + case 2: + change = 4; + break; + case 4: + change = 3; + break; + } + + tileEntity.setFacing((short)change); + world.notifyBlocksOfNeighborChange(x, y, z, this); + return true; + } + } + + if(tileEntity instanceof TileEntityReactorController) + { + if(!entityplayer.isSneaking()) + { + entityplayer.openGui(MekanismGenerators.instance, ReactorBlockType.getFromMetadata(metadata).guiId, world, x, y, z); + } + else + { + ((TileEntityReactorController)tileEntity).formMultiblock(); + } + return true; + } + + return false; } @Override @@ -210,7 +267,7 @@ public class BlockReactor extends BlockContainer public int guiId; public Class tileEntityClass; - private ReactorBlockType(int i, String s, int j, Class tileClass) + private ReactorBlockType(int i, String s, int j, Class tileClass) { meta = i; name = s; @@ -256,4 +313,24 @@ public class BlockReactor extends BlockContainer } } + public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) + { + ItemStack itemStack = getPickBlock(null, world, x, y, z); + + world.setBlockToAir(x, y, z); + + if(!returnBlock) + { + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack); + + world.spawnEntityInWorld(entityItem); + } + + return itemStack; + } } diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java new file mode 100644 index 000000000..eb0dff8ab --- /dev/null +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java @@ -0,0 +1,125 @@ +package mekanism.generators.common.inventory.container; + +import mekanism.common.inventory.slot.SlotEnergy.SlotCharge; +import mekanism.common.util.ChargeUtils; +import mekanism.generators.common.tile.reactor.TileEntityReactorController; +import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerNeutronCapture extends Container +{ + private TileEntityReactorNeutronCapture tileEntity; + + public ContainerNeutronCapture(InventoryPlayer inventory, TileEntityReactorNeutronCapture tentity) + { + tileEntity = tentity; + addSlotToContainer(new SlotCharge(tentity, 0, 143, 35)); + int slotX; + + for(slotX = 0; slotX < 3; ++slotX) + { + for(int slotY = 0; slotY < 9; ++slotY) + { + addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); + } + } + + for(slotX = 0; slotX < 9; ++slotX) + { + addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); + } + + tileEntity.openInventory(); + tileEntity.open(inventory.player); + } + + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + + tileEntity.closeInventory(); + tileEntity.close(entityplayer); + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) + { + return tileEntity.isUseableByPlayer(entityplayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) + { + ItemStack stack = null; + Slot currentSlot = (Slot)inventorySlots.get(slotID); + + if(currentSlot != null && currentSlot.getHasStack()) + { + ItemStack slotStack = currentSlot.getStack(); + stack = slotStack.copy(); + + if(ChargeUtils.canBeCharged(slotStack)) + { + if(slotID != 0) + { + if(!mergeItemStack(slotStack, 0, 1, false)) + { + return null; + } + } + else if(slotID == 0) + { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) + { + return null; + } + } + } + else { + if(slotID >= 1 && slotID <= 27) + { + if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) + { + return null; + } + } + else if(slotID > 27) + { + if(!mergeItemStack(slotStack, 1, 27, false)) + { + return null; + } + } + else { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) + { + return null; + } + } + } + + if(slotStack.stackSize == 0) + { + currentSlot.putStack((ItemStack)null); + } + else { + currentSlot.onSlotChanged(); + } + + if(slotStack.stackSize == stack.stackSize) + { + return null; + } + + currentSlot.onPickupFromSlot(player, slotStack); + } + + return stack; + } +} diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java new file mode 100644 index 000000000..a265ebaa6 --- /dev/null +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java @@ -0,0 +1,125 @@ +package mekanism.generators.common.inventory.container; + +import mekanism.common.inventory.slot.SlotEnergy.SlotCharge; +import mekanism.common.util.ChargeUtils; +import mekanism.generators.common.tile.TileEntitySolarGenerator; +import mekanism.generators.common.tile.reactor.TileEntityReactorController; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerReactorController extends Container +{ + private TileEntityReactorController tileEntity; + + public ContainerReactorController(InventoryPlayer inventory, TileEntityReactorController tentity) + { + tileEntity = tentity; + addSlotToContainer(new Slot(tentity, 0, 143, 35)); + int slotX; + + for(slotX = 0; slotX < 3; ++slotX) + { + for(int slotY = 0; slotY < 9; ++slotY) + { + addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); + } + } + + for(slotX = 0; slotX < 9; ++slotX) + { + addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); + } + + tileEntity.openInventory(); + tileEntity.open(inventory.player); + } + + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + + tileEntity.closeInventory(); + tileEntity.close(entityplayer); + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) + { + return tileEntity.isUseableByPlayer(entityplayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) + { + ItemStack stack = null; + Slot currentSlot = (Slot)inventorySlots.get(slotID); + + if(currentSlot != null && currentSlot.getHasStack()) + { + ItemStack slotStack = currentSlot.getStack(); + stack = slotStack.copy(); + + if(ChargeUtils.canBeCharged(slotStack)) + { + if(slotID != 0) + { + if(!mergeItemStack(slotStack, 0, 1, false)) + { + return null; + } + } + else if(slotID == 0) + { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) + { + return null; + } + } + } + else { + if(slotID >= 1 && slotID <= 27) + { + if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) + { + return null; + } + } + else if(slotID > 27) + { + if(!mergeItemStack(slotStack, 1, 27, false)) + { + return null; + } + } + else { + if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) + { + return null; + } + } + } + + if(slotStack.stackSize == 0) + { + currentSlot.putStack((ItemStack)null); + } + else { + currentSlot.onSlotChanged(); + } + + if(slotStack.stackSize == stack.stackSize) + { + return null; + } + + currentSlot.onPickupFromSlot(player, slotStack); + } + + return stack; + } +} diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java index 5e17ee5a6..5d0760fe1 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java @@ -1,14 +1,24 @@ package mekanism.generators.common.tile.reactor; +import java.util.ArrayList; + +import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; +import mekanism.common.IActiveState; import mekanism.common.Mekanism; +import mekanism.common.util.MekanismUtils; import mekanism.generators.common.FusionReactor; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -public class TileEntityReactorController extends TileEntityReactorBlock +import io.netty.buffer.ByteBuf; + +public class TileEntityReactorController extends TileEntityReactorBlock implements IActiveState { public static final int MAX_WATER = 100 * FluidContainerRegistry.BUCKET_VOLUME; @@ -52,9 +62,83 @@ public class TileEntityReactorController extends TileEntityReactorBlock { super.onUpdate(); - if(getReactor() != null && !worldObj.isRemote) + if(getReactor() != null) { getReactor().simulate(); } } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(getReactor() != null); + if(getReactor() != null) + { + data.add(getReactor().getPlasmaTemp()); + data.add(getReactor().getCaseTemp()); + data.add(fuelTank.getStored()); + data.add(deuteriumTank.getStored()); + data.add(tritiumTank.getStored()); + data.add(waterTank.getFluidAmount()); + data.add(steamTank.getFluidAmount()); + } + + return data; + } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + boolean formed = dataStream.readBoolean(); + if(formed) + { + if(getReactor() == null) + { + setReactor(new FusionReactor(this)); + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + getReactor().setPlasmaTemp(dataStream.readDouble()); + getReactor().setCaseTemp(dataStream.readDouble()); + fuelTank.setGas(new GasStack(GasRegistry.getGas("fusionFuelDT"), dataStream.readInt())); + deuteriumTank.setGas(new GasStack(GasRegistry.getGas("deuterium"), dataStream.readInt())); + tritiumTank.setGas(new GasStack(GasRegistry.getGas("tritium"), dataStream.readInt())); + waterTank.setFluid(new FluidStack(FluidRegistry.getFluid("water"), dataStream.readInt())); + steamTank.setFluid(new FluidStack(FluidRegistry.getFluid("steam"), dataStream.readInt())); + } + else if(getReactor() != null) + { + setReactor(null); + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } + + @Override + public boolean getActive() + { + return getReactor() != null; + } + + @Override + public void setActive(boolean active) + { + if(active == (getReactor() == null)) + { + setReactor(active ? new FusionReactor(this) : null); + } + } + + @Override + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() + { + return false; + } } diff --git a/src/main/resources/assets/mekanism/textures/blocks/Chlorine.png b/src/main/resources/assets/mekanism/textures/blocks/LiquidChlorine.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/Chlorine.png rename to src/main/resources/assets/mekanism/textures/blocks/LiquidChlorine.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/Ethene.png b/src/main/resources/assets/mekanism/textures/blocks/LiquidEthene.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/Ethene.png rename to src/main/resources/assets/mekanism/textures/blocks/LiquidEthene.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/Ethene.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/LiquidEthene.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/Ethene.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/LiquidEthene.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/WaterVapor.png b/src/main/resources/assets/mekanism/textures/blocks/LiquidSteam.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/WaterVapor.png rename to src/main/resources/assets/mekanism/textures/blocks/LiquidSteam.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/WaterVapor.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/LiquidSteam.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/WaterVapor.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/LiquidSteam.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png.mcmeta new file mode 100644 index 000000000..efc331201 --- /dev/null +++ b/src/main/resources/assets/mekanism/textures/blocks/ReactorControllerOn.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 10 + } +} From 7b8b75759c12f434c7d4dbbdce796cae2f601f65 Mon Sep 17 00:00:00 2001 From: Ben Spiers Date: Sat, 19 Jul 2014 04:03:32 +0100 Subject: [PATCH 3/3] More GUI Work. Nowhere near finished yet, there's a lot of information to squeeze in. --- .../client/gui/GuiReactorController.java | 61 ++++++++++++++++--- .../generators/common/FusionReactor.java | 9 +-- .../container/ContainerReactorController.java | 2 +- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java index 1591502cc..44444f695 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java @@ -3,8 +3,14 @@ package mekanism.generators.client.gui; import java.util.List; import mekanism.api.ListUtils; +import mekanism.api.gas.GasTank; import mekanism.client.gui.GuiEnergyInfo; import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; +import mekanism.client.gui.GuiFluidGauge; +import mekanism.client.gui.GuiFluidGauge.IFluidInfoHandler; +import mekanism.client.gui.GuiGasGauge; +import mekanism.client.gui.GuiGasGauge.IGasInfoHandler; +import mekanism.client.gui.GuiGauge.Type; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.GuiPowerBar; import mekanism.client.gui.GuiRedstoneControl; @@ -20,6 +26,7 @@ import mekanism.generators.common.tile.TileEntitySolarGenerator; import mekanism.generators.common.tile.reactor.TileEntityReactorController; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraftforge.fluids.FluidTank; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -29,7 +36,7 @@ public class GuiReactorController extends GuiMekanism { public TileEntityReactorController tileEntity; - public GuiReactorController(InventoryPlayer inventory, TileEntityReactorController tentity) + public GuiReactorController(InventoryPlayer inventory, final TileEntityReactorController tentity) { super(new ContainerReactorController(inventory, tentity)); tileEntity = tentity; @@ -43,8 +50,48 @@ public class GuiReactorController extends GuiMekanism "Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); + guiElements.add(new GuiGasGauge(new IGasInfoHandler() + { + @Override + public GasTank getTank() + { + return tentity.deuteriumTank; + } + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 124, 16)); + guiElements.add(new GuiGasGauge(new IGasInfoHandler() + { + @Override + public GasTank getTank() + { + return tentity.tritiumTank; + } + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 124, 46)); + guiElements.add(new GuiGasGauge(new IGasInfoHandler() + { + @Override + public GasTank getTank() + { + return tentity.fuelTank; + } + }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 144, 16)); + guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() + { + @Override + public FluidTank getTank() + { + return tentity.waterTank; + } + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 78, 46)); + guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() + { + @Override + public FluidTank getTank() + { + return tentity.steamTank; + } + }, Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 98, 46)); guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 142, 34)); + guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 98, 26)); } @Override @@ -54,7 +101,6 @@ public class GuiReactorController extends GuiMekanism fontRendererObj.drawString(tileEntity.getInventoryName(), 30, 6, 0x404040); fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 151, (ySize - 96) + 2, 0x00CD00); if(tileEntity.getReactor() == null) { fontRendererObj.drawString(MekanismUtils.localize("container.reactor.notFormed"), 8, 16, 0x404040); @@ -62,13 +108,8 @@ public class GuiReactorController extends GuiMekanism else { fontRendererObj.drawString(MekanismUtils.localize("container.reactor.formed"), 8, 16, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("plasma") + ": " + tileEntity.getReactor().getPlasmaTemp(), 8, 26, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("casing") + ": " + tileEntity.getReactor().getCaseTemp(), 8, 36, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("fuelLevel") + ": " + tileEntity.fuelTank.getStored(), 8, 46, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("deuterium") + ": " + tileEntity.deuteriumTank.getStored(), 8, 56, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("tritium") + ": " + tileEntity.tritiumTank.getStored(), 8, 66, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("water") + ": " + tileEntity.waterTank.getFluidAmount(), 8, 76, 0x404040); - fontRendererObj.drawString(MekanismUtils.localize("steam") + ": " + tileEntity.steamTank.getFluidAmount(), 8, 86, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("plasma") + ": " + (int)(tileEntity.getReactor().getPlasmaTemp()+23)+"C", 8, 26, 0x404040); + fontRendererObj.drawString(MekanismUtils.localize("casing") + ": " + (int)(tileEntity.getReactor().getCaseTemp()+23)+"C", 8, 36, 0x404040); } } diff --git a/src/main/java/mekanism/generators/common/FusionReactor.java b/src/main/java/mekanism/generators/common/FusionReactor.java index eb4ee8005..d1ab0a00b 100644 --- a/src/main/java/mekanism/generators/common/FusionReactor.java +++ b/src/main/java/mekanism/generators/common/FusionReactor.java @@ -110,13 +110,8 @@ public class FusionReactor implements IFusionReactor //Perform the heat transfer calculations transferHeat(); - lastPlasmaTemperature = plasmaTemperature; - lastCaseTemperature = caseTemperature; - - if(plasmaTemperature > 1E-6 || caseTemperature > 1E-6) - { - Mekanism.logger.info("Reactor temperatures: Plasma: " + (int) plasmaTemperature + ", Casing: " + (int) caseTemperature); - } + lastPlasmaTemperature = plasmaTemperature < 1E-1 ? 0 : plasmaTemperature; + lastCaseTemperature = caseTemperature < 1E-1 ? 0 : caseTemperature; } public void vaporiseHohlraum() diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java index a265ebaa6..8600ee349 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java @@ -18,7 +18,7 @@ public class ContainerReactorController extends Container public ContainerReactorController(InventoryPlayer inventory, TileEntityReactorController tentity) { tileEntity = tentity; - addSlotToContainer(new Slot(tentity, 0, 143, 35)); + addSlotToContainer(new Slot(tentity, 0, 99, 27)); int slotX; for(slotX = 0; slotX < 3; ++slotX)