mrkirby153

Untitled

Jun 13th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.25 KB | None | 0 0
  1. Fuel Handler
  2. package mrkirby153.MscHouses.core.handlers;
  3.  
  4. import java.util.ArrayList;
  5. import java.util.logging.Level;
  6.  
  7. import mrkirby153.MscHouses.core.helpers.LogHelper;
  8. import net.minecraft.item.Item;
  9.  
  10. public class FuelHandler {
  11.  
  12.     public static ArrayList<Item> validFuels = new ArrayList<Item>();
  13.    
  14.     public static void addFuel(Item fuel){
  15.         FuelHandler.validFuels.add(fuel);
  16.         LogHelper.log(Level.ALL, "Successfully registered fuel: " + fuel);
  17.     }
  18.    
  19.     public static ArrayList<Item> getValidFuelsAsArrayList(){
  20.         return validFuels;
  21.     }
  22.    
  23.     public static Item[] getValidFulesAsList(){
  24.         Item[] fuels = new Item[validFuels.size()];
  25.         fuels = validFuels.toArray(fuels);
  26.         return fuels;
  27.     }
  28. }
  29. ---------------------------------
  30. Fuel Helper
  31.  
  32. package mrkirby153.MscHouses.core.helpers;
  33.  
  34. import java.util.ArrayList;
  35. import java.util.logging.Level;
  36.  
  37. import mrkirby153.MscHouses.core.handlers.FuelHandler;
  38. import net.minecraft.item.Item;
  39.  
  40. public class FuelHelper {
  41.  
  42.     public static void registerFuels(){
  43.         //Adds fuels
  44.         //Default fuels
  45.         FuelHandler.addFuel(Item.coal);
  46.         FuelHandler.addFuel(Item.bucketLava);
  47.         FuelHandler.addFuel(Item.netherStar);
  48.         //Gets and prints the arraylist as an ArrayList
  49.         ArrayList<Item> fuels_arrayList = FuelHandler.getValidFuelsAsArrayList();
  50.         LogHelper.log(Level.SEVERE, fuels_arrayList.toString());
  51.         //gets and prints the arraylist as a Array;
  52.         Item[] fuels_List = FuelHandler.getValidFulesAsList();
  53.         for(int i = 1; i < fuels_List.length; i++){
  54.             LogHelper.log(Level.SEVERE, fuels_List[i].toString());
  55.         }
  56.     }
  57.    
  58. }
  59.  
  60. ----------------------
  61. Error Log
  62.  
  63. 2013-06-13 15:19:16 [INFO] [STDERR] java.lang.NullPointerException
  64. 2013-06-13 15:19:16 [INFO] [STDERR]     at mrkirby153.MscHouses.core.handlers.FuelHandler.addFuel(FuelHandler.java:14)
  65. 2013-06-13 15:19:16 [INFO] [STDERR]     at mrkirby153.MscHouses.core.helpers.FuelHelper.registerFuels(FuelHelper.java:15)
  66. 2013-06-13 15:19:16 [INFO] [STDERR]     at mrkirby153.MscHouses.core.MscHouses.preInit(MscHouses.java:78)
  67. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  68. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  69. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  70. 2013-06-13 15:19:16 [INFO] [STDERR]     at java.lang.reflect.Method.invoke(Unknown Source)
  71. 2013-06-13 15:19:16 [INFO] [STDERR]     at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
  72. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  73. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  74. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  75. 2013-06-13 15:19:16 [INFO] [STDERR]     at java.lang.reflect.Method.invoke(Unknown Source)
  76. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
  77. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
  78. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
  79. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
  80. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.post(EventBus.java:267)
  81. 2013-06-13 15:19:16 [INFO] [STDERR]     at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
  82. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  83. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  84. 2013-06-13 15:19:16 [INFO] [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  85. 2013-06-13 15:19:16 [INFO] [STDERR]     at java.lang.reflect.Method.invoke(Unknown Source)
  86. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
  87. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
  88. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
  89. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
  90. 2013-06-13 15:19:16 [INFO] [STDERR]     at com.google.common.eventbus.EventBus.post(EventBus.java:267)
  91. 2013-06-13 15:19:16 [INFO] [STDERR]     at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
  92. 2013-06-13 15:19:16 [INFO] [STDERR]     at cpw.mods.fml.common.Loader.loadMods(Loader.java:514)
  93. 2013-06-13 15:19:16 [INFO] [STDERR]     at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:160)
  94. 2013-06-13 15:19:16 [INFO] [STDERR]     at net.minecraft.client.Minecraft.startGame(Minecraft.java:411)
  95. 2013-06-13 15:19:16 [INFO] [STDERR]     at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
  96. 2013-06-13 15:19:16 [INFO] [STDERR]     at net.minecraft.client.Minecraft.run(Minecraft.java:733)
  97. 2013-06-13 15:19:16 [INFO] [STDERR]     at java.lang.Thread.run(Unknown Source)
Advertisement
Add Comment
Please, Sign In to add comment