aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Ic2ExpReactorPlanner
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-16 12:33:46 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-16 12:33:46 +0000
commit9985554d6516d437d8f2cb6f675105141df755b3 (patch)
tree29282efb6d6b5632c8d9c26c3d85d19493ed6a37 /src/main/java/Ic2ExpReactorPlanner
parent7fac6b4f75e640844fe07fc340851a94f335fcac (diff)
downloadGT5-Unofficial-9985554d6516d437d8f2cb6f675105141df755b3.tar.gz
GT5-Unofficial-9985554d6516d437d8f2cb6f675105141df755b3.tar.bz2
GT5-Unofficial-9985554d6516d437d8f2cb6f675105141df755b3.zip
Add Average I/O stats to PSS.
Fixed PSS GUI suffering integer overflows. Improve PSS GUI. Fix Reactor Planner handling components.
Diffstat (limited to 'src/main/java/Ic2ExpReactorPlanner')
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java15
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/Reactor.java6
2 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
index dc27a6a730..c613f27a32 100644
--- a/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
+++ b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
@@ -22,6 +22,7 @@ import Ic2ExpReactorPlanner.components.Vent;
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.LoadedMods;
import gtPlusPlus.xmod.bartworks.BW_Utils;
import gtPlusPlus.xmod.bartworks.BW_Utils.NonMeta_MaterialItem;
@@ -33,6 +34,8 @@ import gtPlusPlus.xmod.goodgenerator.GG_Utils.GG_Fuel_Rod;
* @author Brian McCloud
*/
public class ComponentFactory {
+
+ public static int MAX_COMPONENT_ID = 64;
static ItemList[] aGtItems = new ItemList[]{
ItemList.Neutron_Reflector,
@@ -171,9 +174,11 @@ public class ComponentFactory {
* @return the component with the specified id, or null if the id is out of range.
*/
public static ReactorItem getDefaultComponent(int id) {
- if (id >= 0 && id < ITEM_LIST.size()) {
- return ITEM_LIST.get(id);
+ ReactorItem aItem = ITEM_LIST.get(id);
+ if (aItem != null) {
+ return aItem;
}
+ Logger.INFO("Tried to get default component with ID "+id+". This is invalid.");
return null;
}
@@ -195,9 +200,11 @@ public class ComponentFactory {
* @return a new instance of the specified component, or null if the id is out of range.
*/
public static ReactorItem createComponent(int id) {
- if (id >= 0 && id < ITEM_LIST.size()) {
- return copy(ITEM_LIST.get(id));
+ ReactorItem aItem = ITEM_LIST.get(id);
+ if (aItem != null) {
+ return copy(aItem);
}
+ Logger.INFO("Tried to create component with ID "+id+". This is invalid.");
return null;
}
diff --git a/src/main/java/Ic2ExpReactorPlanner/Reactor.java b/src/main/java/Ic2ExpReactorPlanner/Reactor.java
index e611189317..6febc91b90 100644
--- a/src/main/java/Ic2ExpReactorPlanner/Reactor.java
+++ b/src/main/java/Ic2ExpReactorPlanner/Reactor.java
@@ -524,7 +524,7 @@ public class Reactor {
} else if (codeRevision == 2) {
componentId = storage.extract(44);
} else {
- componentId = storage.extract(58);
+ componentId = storage.extract(ComponentFactory.MAX_COMPONENT_ID);
}
if (componentId != 0) {
ReactorItem component = ComponentFactory.createComponent(componentId);
@@ -590,9 +590,9 @@ public class Reactor {
} else {
storage.store(0, 1);
}
- storage.store(id, 58);
+ storage.store(id, ComponentFactory.MAX_COMPONENT_ID);
} else {
- storage.store(0, 58);
+ storage.store(0, ComponentFactory.MAX_COMPONENT_ID);
}
}
}