diff options
Diffstat (limited to 'src/main/java/Ic2ExpReactorPlanner')
-rw-r--r-- | src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java | 15 | ||||
-rw-r--r-- | src/main/java/Ic2ExpReactorPlanner/Reactor.java | 6 |
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); } } } |