aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java12
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java74
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java149
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java74
6 files changed, 275 insertions, 38 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
index 999d80199f..3e294a076c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java
@@ -54,6 +54,7 @@ import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler;
+import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputerCube_Setup;
import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator;
@@ -178,6 +179,7 @@ public class HANDLER_GT {
generateElementalDuplicatorRecipes();
Meta_GT_Proxy.fixIC2FluidNames();
GT_ComputercubeDescription.addStandardDescriptions();
+ GT_ComputerCube_Setup.init();
RecipeLoader_AlgaeFarm.generateRecipes();
if (LoadedMods.AdvancedSolarPanel) {
RecipeLoader_MolecularTransformer.run();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java
index 0ebfd65aeb..477bcef092 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java
@@ -8,6 +8,7 @@ import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.gui.GT_Slot_Holo;
import gregtech.api.gui.GT_Slot_Output;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
@@ -151,11 +152,11 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine {
return null;
}
Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex);
- ItemStack tStack = tSlot.getStack();
if (tSlot == null) {
Logger.INFO("Null Slot?");
}
else {
+ ItemStack tStack = tSlot.getStack();
Logger.INFO("Good Slot!");
if (aSlotIndex == 0) {
Logger.INFO("Slot is 0");
@@ -224,21 +225,29 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine {
else {
if (aShifthold == 1) {
tSlot.putStack(null);
+ ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null);
return null;
}
+
+ if (aMouseclick == 1) {
+ tSlot.putStack(null);
+ }
if (aMouseclick == 0) {
if (tStack == null) {
if (getSlot(58).getStack() != null && aSlotIndex != 58) {
tSlot.putStack(getSlot(58).getStack().copy());
+ ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, new GT_ItemStack(getSlot(58).getStack().copy()));
}
else {
tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1));
+ ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0));
}
return null;
}
for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) {
if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) {
tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0));
+ ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i));
/*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) {
tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1);
}*/
@@ -246,6 +255,7 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine {
}
}
tSlot.putStack(null);
+ ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null);
return null;
}
if (tStack == null)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java
index d226503b9c..47795f4510 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java
@@ -46,7 +46,7 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin
this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255);
this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", 7, 136, 16448255);
this.fontRendererObj.drawString("Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255);
- this.fontRendererObj.drawString("Runtime: " + ((tContainer.mEUOut > 0) ? ((tContainer.mEU / tContainer.mEUOut) / 20.0F) : 0.0F) + "secs", 7, 152, 16448255);
+ this.fontRendererObj.drawString("Runtime: " + ((tContainer.mProgress > 0) ? (/*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) : 0) + "secs", 7, 152, 16448255);
break;
case 2 :
this.fontRendererObj.drawString("Scanner", 51, 7, 16448255);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java
new file mode 100644
index 0000000000..bd2df1b8ff
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.xmod.gregtech.common.computer;
+
+import static gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube.sReactorList;
+
+import java.util.ArrayList;
+
+import Ic2ExpReactorPlanner.ComponentFactory;
+import gregtech.api.enums.ItemList;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.util.GT_ModHandler;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bartworks.BW_Utils;
+import gtPlusPlus.xmod.goodgenerator.GG_Utils;
+import net.minecraft.item.ItemStack;
+
+public class GT_ComputerCube_Setup {
+
+ public static void init() {
+ Logger.INFO("[Reactor Simulator] Added " + ComponentFactory.getComponentCount() + " components to ComponentFactory.");
+ if (sReactorList == null) {
+ sReactorList = new ArrayList<GT_ItemStack>();
+
+ String[] aIc2Items = new String[]{
+ "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple",
+ "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent",
+ "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread",
+ "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/
+ };
+
+ for (String aItem : aIc2Items) {
+ ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1);
+ if (!ItemUtils.checkForInvalidItems(aStack)) {
+ Logger.INFO("Unable to find IC2 Item: " + aItem);
+ CORE.crash("Unable to find IC2 Item: " + aItem);
+ }
+ else {
+ sReactorList.add(new GT_ItemStack(aStack.copy()));
+ }
+ }
+
+ ItemList[] aGtItems = new ItemList[]{
+ ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, /*ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4,*/
+ ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.MNqCell_1,
+ ItemList.MNqCell_2, ItemList.MNqCell_4, ItemList.Reactor_Coolant_He_1, ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1,
+ ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6, ItemList.Reactor_Coolant_Sp_1, ItemList.Reactor_Coolant_Sp_2, ItemList.Reactor_Coolant_Sp_3,
+ ItemList.Reactor_Coolant_Sp_6
+ };
+
+ for (ItemList aItem : aGtItems) {
+ sReactorList.add(new GT_ItemStack(aItem.get(1)));
+ }
+
+ if (LoadedMods.BartWorks) {
+ ArrayList<ItemStack> aBartReactorItems = BW_Utils.getAll(1);
+ for (ItemStack aReactorItem : aBartReactorItems) {
+ sReactorList.add(new GT_ItemStack(aReactorItem));
+ }
+ }
+
+ if (LoadedMods.GoodGenerator) {
+ ArrayList<ItemStack> aGlodReactorItems = GG_Utils.getAll(1);
+ for (ItemStack aReactorItem : aGlodReactorItems) {
+ sReactorList.add(new GT_ItemStack(aReactorItem));
+ }
+ }
+ Logger.INFO("[Reactor Simulator] Added " + sReactorList.size() + " components to GT_TileEntity_ComputerCube.");
+
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java
new file mode 100644
index 0000000000..e0bedb5d18
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java
@@ -0,0 +1,149 @@
+package gtPlusPlus.xmod.gregtech.common.computer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import Ic2ExpReactorPlanner.AutomationSimulator;
+import Ic2ExpReactorPlanner.Reactor;
+import Ic2ExpReactorPlanner.SimulationData;
+import Ic2ExpReactorPlanner.components.ReactorItem;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube;
+
+public class GT_Computercube_Simulator {
+
+ private static final HashMap<Integer, Pair<Integer, Integer>> sSlotPositions = new HashMap<Integer, Pair<Integer, Integer>>();
+
+ static {
+ int aSlot = 4;
+ for (int column = 0; column < 6; column++) {
+ for (int row = 0; row < 9; row++) {
+ sSlotPositions.put(aSlot++, new Pair<Integer, Integer>(row, column));
+ }
+ }
+ }
+
+ private final Reactor reactor = new Reactor();
+
+ public AutomationSimulator simulator = null;
+ /**
+ * The reactor that was last simulated.
+ */
+ public Reactor simulatedReactor = null;
+
+ private String currentReactorCode = null;
+
+ private String currentReactorOldCode = null;
+
+ private ArrayList<String> output = new ArrayList<String>();
+
+ private final GT_TileEntity_ComputerCube mTile;
+
+ public GT_Computercube_Simulator(GT_TileEntity_ComputerCube aTile) {
+ mTile = aTile;
+ }
+
+ public void slotClick(int aSlot, GT_ItemStack aStack) {
+
+ /*if (selection != null) {
+ componentToPlace = ComponentFactory.createComponent(selection.getActionCommand());
+ if (componentToPlace != null) {
+ componentToPlace.setInitialHeat(((Number)componentHeatSpinner.getValue()).intValue());
+ componentToPlace.setAutomationThreshold(((Number)placingThresholdSpinner.getValue()).intValue());
+ componentToPlace.setReactorPause(((Number)placingReactorPauseSpinner.getValue()).intValue());
+ }
+ }*/
+ if (aSlot >= 4 && aSlot < 58) {
+ Pair<Integer, Integer> aSpot = sSlotPositions.get(aSlot);
+ ReactorItem aItem;
+ if (aStack == null) {
+ aItem = null;
+ }
+ else {
+
+ Logger.INFO("Using lookup key: "+ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData);
+ aItem = ReactorItem.sComponentMap.get(ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData);
+
+ }
+ int aRow = aSpot.getKey();
+ int aColumn = aSpot.getValue();
+ Logger.INFO("Putting "+(aItem == null ? "null" : aItem.name)+" at x:"+aRow+", y:"+aColumn);
+ reactor.setComponentAt(aColumn, aRow, aItem);
+ currentReactorCode = reactor.getCode();
+ currentReactorOldCode = reactor.getOldCode();
+ Logger.INFO("Code: "+currentReactorCode);
+ }
+ //maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat()));
+ //heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1);
+ //heatSpinnerModel.setValue(Math.min(((Number)heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1));
+ //temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int) (reactor.getMaxHeat() * 0.4), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0)));
+ }
+
+ public void simulate() {
+ /*if (Utils.isClient()) {
+ return;
+ }*/
+ if (simulator != null && simulator.isRunning()) {
+ Logger.INFO("Simulator Running, Stopping.");
+ simulator.cancel();
+ }
+ Logger.INFO("Starting Simulator.");
+ mTile.mHeat = 0;
+ mTile.mEU = 0;
+ currentReactorCode = reactor.getCode();
+ currentReactorOldCode = reactor.getOldCode();
+ output.clear();
+ simulatedReactor = new Reactor();
+ simulatedReactor.setCode(reactor.getCode());
+ Logger.INFO("Making new AutomationSimulator.");
+ simulator = new AutomationSimulator(simulatedReactor, output, mTile);
+ Logger.INFO("Starting AutomationSimulator.process().");
+ simulator.process();
+ Logger.INFO("Done.");
+
+ SimulationData aData = simulator.getData();
+ if (aData != null && aData.totalReactorTicks > 0) {
+ mTile.mEU = aData.avgEUoutput * aData.totalReactorTicks;
+ mTile.mEUOut = aData.avgEUoutput;
+ mTile.mHeat = aData.avgHUoutput;
+ mTile.mMaxHeat = aData.maxHUoutput;
+ mTile.mExplosionStrength = aData.explosionPower;
+ mTile.mHEM = (float) aData.hullHeating;
+ mTile.mProgress = aData.totalReactorTicks;
+ }
+
+ for (String s : output) {
+ Logger.INFO(" "+s);
+ }
+ }
+
+ public ArrayList<String> getOutputData() {
+ return output;
+ }
+
+ private void clearGrid() {
+ reactor.clearGrid();
+ /*for (int i = 0; i < reactorButtons.length; i++) {
+ for (int j = 0; j < reactorButtons[i].length; j++) {
+ reactorButtons[i][j].setIcon(null);
+ reactorButtons[i][j].setToolTipText(null);
+ reactorButtonPanels[i][j].setBackground(Color.LIGHT_GRAY);
+ }
+ }*/
+ output.clear();
+ /*materialsArea.setText(reactor.getMaterials().toString());
+ componentListArea.setText(reactor.getComponentList().toString());
+ maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat()));
+ heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1);
+ heatSpinnerModel.setValue(Math.min(((Number) heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1));
+ temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0)));
+ lockCode = true;
+ codeField.setText(null);
+ lockCode = false;*/
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java
index dd8c79a855..11d5068374 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java
@@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.misc;
import java.util.ArrayList;
import java.util.Collections;
+import Ic2ExpReactorPlanner.SimulationData;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.interfaces.ITexture;
@@ -17,12 +18,16 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bartworks.BW_Utils;
+import gtPlusPlus.xmod.goodgenerator.GG_Utils;
import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_ComputerCube;
import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_ComputerCube;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription;
+import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Simulator;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorComponent;
import ic2.core.Ic2Items;
@@ -72,6 +77,8 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
public float mHEM = 1.0F, mExplosionStrength = 0.0F;
private boolean mNeedsUpdate;
+
+ private GT_Computercube_Simulator mSimulator;
public GT_TileEntity_ComputerCube(final int aID, final String aDescription) {
super(aID, "computer.cube", "Computer Cube", 5, 114, aDescription);
@@ -128,6 +135,14 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
return true;
}
+ public final GT_Computercube_Simulator getSimulator() {
+ return this.mSimulator;
+ }
+
+ public final void setSimulator(GT_Computercube_Simulator mSimulator) {
+ this.mSimulator = mSimulator;
+ }
+
@Override
public boolean isSimpleMachine() {
return true;
@@ -160,7 +175,7 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
@Override
public boolean ownerControl() {
- return true;
+ return false;
}
@Override
@@ -576,10 +591,12 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
this.mStarted = true;
this.mHeat = 0;
this.mEU = 0;
+ mSimulator.simulate();
}
public void stopNuclearReactor() {
this.mStarted = false;
+ mSimulator.simulate();
}
public void storeAdditionalData(NBTTagCompound aNBT) {
@@ -612,44 +629,14 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
@Override
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
super.onFirstTick(aBaseMetaTileEntity);
- if (sReactorList == null) {
- sReactorList = new ArrayList<GT_ItemStack>();
-
- String[] aIc2Items = new String[]{
- "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple",
- "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent",
- "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread",
- "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/
- };
-
- for (String aItem : aIc2Items) {
- ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1);
- if (!ItemUtils.checkForInvalidItems(aStack)) {
- Logger.INFO("Unable to find IC2 Item: " + aItem);
- CORE.crash("Unable to find IC2 Item: " + aItem);
- }
- else {
- sReactorList.add(new GT_ItemStack(aStack.copy()));
- }
- }
-
- ItemList[] aGtItems = new ItemList[]{
- ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4,
- ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.Reactor_Coolant_He_1,
- ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1, ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6,
- };
-
- for (ItemList aItem : aGtItems) {
- sReactorList.add(new GT_ItemStack(aItem.get(1)));
- }
-
- }
-
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (mSimulator == null) {
+ mSimulator = new GT_Computercube_Simulator(this);
+ }
if(this.getBaseMetaTileEntity().isClientSide()) {
this.getWorld().markBlockForUpdate(this.getXCoord(), this.getYCoord(), this.getZCoord());
this.mNeedsUpdate = false;
@@ -694,7 +681,22 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
}
}
}
- if (this.mMode == 1 && mReactorplanner && this.mStarted && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(32, false))
+
+ if (this.mMode == 1 && mReactorplanner && this.mSimulator != null && this.mSimulator.simulator != null && this.mSimulator.simulatedReactor != null) {
+ SimulationData aData = this.mSimulator.simulator.getData();
+ if (aData != null && aData.totalReactorTicks > 0 && this.mProgress != aData.totalReactorTicks) {
+ Logger.INFO("Updating Variables");
+ this.mEU = aData.avgEUoutput;
+ this.mEUOut = (aData.totalEUoutput / aData.totalReactorTicks);
+ this.mHeat = aData.avgHUoutput;
+ this.mMaxHeat = aData.maxHUoutput;
+ this.mExplosionStrength = aData.explosionPower;
+ this.mHEM = (float) aData.hullHeating;
+ this.mProgress = aData.totalReactorTicks;
+ }
+ }
+
+ /*if (this.mMode == 1 && mReactorplanner && this.mStarted && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(32, false))
for (int i = 0; i < 25 && this.mStarted; i++) {
this.mEUOut = 0;
this.mMaxHeat = 10000;
@@ -737,7 +739,7 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl
this.mEULast3 = this.mEULast4;
this.mEULast4 = this.mEUOut;
this.mEUOut = (this.mEUOut + this.mEULast1 + this.mEULast2 + this.mEULast3 + tEU) / 5;
- }
+ }*/
if (aTick % 20L == 0L) {
//this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 10, this.mMode);
//this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat);