|
8 | 8 | package micdoodle8.mods.galacticraft.api;
|
9 | 9 |
|
10 | 10 | import com.google.common.collect.Lists;
|
11 |
| -import java.lang.reflect.Method; |
12 | 11 | import java.util.ArrayList;
|
13 | 12 | import java.util.HashMap;
|
14 | 13 | import java.util.LinkedList;
|
|
35 | 34 | public class GalacticraftRegistry
|
36 | 35 | {
|
37 | 36 |
|
38 |
| - private static Map<Class<? extends WorldProvider>, ITeleportType> teleportTypeMap = new HashMap<Class<? extends WorldProvider>, ITeleportType>(); |
39 |
| - private static List<SpaceStationType> spaceStations = new ArrayList<SpaceStationType>(); |
40 |
| - private static List<INasaWorkbenchRecipe> rocketBenchT1Recipes = new ArrayList<INasaWorkbenchRecipe>(); |
41 |
| - private static List<INasaWorkbenchRecipe> buggyBenchRecipes = new ArrayList<INasaWorkbenchRecipe>(); |
42 |
| - private static List<INasaWorkbenchRecipe> rocketBenchT2Recipes = new ArrayList<INasaWorkbenchRecipe>(); |
43 |
| - private static List<INasaWorkbenchRecipe> cargoRocketRecipes = new ArrayList<INasaWorkbenchRecipe>(); |
44 |
| - private static List<INasaWorkbenchRecipe> rocketBenchT3Recipes = new ArrayList<INasaWorkbenchRecipe>(); |
45 |
| - private static List<INasaWorkbenchRecipe> astroMinerRecipes = new ArrayList<INasaWorkbenchRecipe>(); |
46 |
| - private static Map<Class<? extends WorldProvider>, ResourceLocation> rocketGuiMap = new HashMap<Class<? extends WorldProvider>, ResourceLocation>(); |
47 |
| - private static Map<Integer, List<ItemStack>> dungeonLootMap = new HashMap<Integer, List<ItemStack>>(); |
48 |
| - private static List<Integer> dimensionTypeIDs = new ArrayList<Integer>(); |
49 |
| - private static List<IGameScreen> gameScreens = new ArrayList<IGameScreen>(); |
| 37 | + private static Map<Class<? extends WorldProvider>, ITeleportType> teleportTypeMap = new HashMap<>(); |
| 38 | + private static List<SpaceStationType> spaceStations = new ArrayList<>(); |
| 39 | + private static List<INasaWorkbenchRecipe> rocketBenchT1Recipes = new ArrayList<>(); |
| 40 | + private static List<INasaWorkbenchRecipe> buggyBenchRecipes = new ArrayList<>(); |
| 41 | + private static List<INasaWorkbenchRecipe> rocketBenchT2Recipes = new ArrayList<>(); |
| 42 | + private static List<INasaWorkbenchRecipe> cargoRocketRecipes = new ArrayList<>(); |
| 43 | + private static List<INasaWorkbenchRecipe> rocketBenchT3Recipes = new ArrayList<>(); |
| 44 | + private static List<INasaWorkbenchRecipe> astroMinerRecipes = new ArrayList<>(); |
| 45 | + private static Map<Class<? extends WorldProvider>, ResourceLocation> rocketGuiMap = new HashMap<>(); |
| 46 | + private static Map<Integer, List<ItemStack>> dungeonLootMap = new HashMap<>(); |
| 47 | + private static List<Integer> dimensionTypeIDs = new ArrayList<>(); |
| 48 | + private static List<IGameScreen> gameScreens = new ArrayList<>(); |
50 | 49 | private static int maxScreenTypes;
|
51 | 50 | private static Map<Integer, List<Object>> gearMap = new HashMap<>();
|
52 | 51 | private static Map<Integer, List<EnumExtendedInventorySlot>> gearSlotMap = new HashMap<>();
|
53 |
| - private static Method gratingRegister = null; |
54 | 52 |
|
55 | 53 | /**
|
56 | 54 | * Register a new Teleport type for the world provider passed
|
@@ -101,7 +99,7 @@ public static void addDungeonLoot(int tier, ItemStack loot)
|
101 | 99 | dungeonStacks.add(loot);
|
102 | 100 | } else
|
103 | 101 | {
|
104 |
| - dungeonStacks = new ArrayList<ItemStack>(); |
| 102 | + dungeonStacks = new ArrayList<>(); |
105 | 103 | dungeonStacks.add(loot);
|
106 | 104 | }
|
107 | 105 |
|
@@ -311,7 +309,16 @@ public static DimensionType registerDimension(String name, String suffix, int id
|
311 | 309 |
|
312 | 310 | public static int getDimensionTypeID(int index)
|
313 | 311 | {
|
314 |
| - return GalacticraftRegistry.dimensionTypeIDs.get(index); |
| 312 | + // Not the best solution but is better than the very unuseful IndexOutOfBoundsException message |
| 313 | + try |
| 314 | + { |
| 315 | + return GalacticraftRegistry.dimensionTypeIDs.get(index); |
| 316 | + } catch (IndexOutOfBoundsException e) |
| 317 | + { |
| 318 | + GalacticraftCore.logger.error("Attempted to get index[%d] while 'dimensionTypeIDs' size was %d", index, GalacticraftRegistry.dimensionTypeIDs.size()); |
| 319 | + return 0; |
| 320 | + } |
| 321 | + |
315 | 322 | }
|
316 | 323 |
|
317 | 324 | public static boolean isDimensionTypeIDRegistered(int typeId)
|
|
0 commit comments