Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fuel Handler
- package mrkirby153.MscHouses.core.handlers;
- import java.util.ArrayList;
- import java.util.logging.Level;
- import mrkirby153.MscHouses.core.helpers.LogHelper;
- import net.minecraft.item.Item;
- public class FuelHandler {
- public static ArrayList<Item> validFuels = new ArrayList<Item>();
- public static void addFuel(Item fuel){
- FuelHandler.validFuels.add(fuel);
- LogHelper.log(Level.ALL, "Successfully registered fuel: " + fuel);
- }
- public static ArrayList<Item> getValidFuelsAsArrayList(){
- return validFuels;
- }
- public static Item[] getValidFulesAsList(){
- Item[] fuels = new Item[validFuels.size()];
- fuels = validFuels.toArray(fuels);
- return fuels;
- }
- }
- ---------------------------------
- Fuel Helper
- package mrkirby153.MscHouses.core.helpers;
- import java.util.ArrayList;
- import java.util.logging.Level;
- import mrkirby153.MscHouses.core.handlers.FuelHandler;
- import net.minecraft.item.Item;
- public class FuelHelper {
- public static void registerFuels(){
- //Adds fuels
- //Default fuels
- FuelHandler.addFuel(Item.coal);
- FuelHandler.addFuel(Item.bucketLava);
- FuelHandler.addFuel(Item.netherStar);
- //Gets and prints the arraylist as an ArrayList
- ArrayList<Item> fuels_arrayList = FuelHandler.getValidFuelsAsArrayList();
- LogHelper.log(Level.SEVERE, fuels_arrayList.toString());
- //gets and prints the arraylist as a Array;
- Item[] fuels_List = FuelHandler.getValidFulesAsList();
- for(int i = 1; i < fuels_List.length; i++){
- LogHelper.log(Level.SEVERE, fuels_List[i].toString());
- }
- }
- }
- ----------------------
- Error Log
- 2013-06-13 15:19:16 [INFO] [STDERR] java.lang.NullPointerException
- 2013-06-13 15:19:16 [INFO] [STDERR] at mrkirby153.MscHouses.core.handlers.FuelHandler.addFuel(FuelHandler.java:14)
- 2013-06-13 15:19:16 [INFO] [STDERR] at mrkirby153.MscHouses.core.helpers.FuelHelper.registerFuels(FuelHelper.java:15)
- 2013-06-13 15:19:16 [INFO] [STDERR] at mrkirby153.MscHouses.core.MscHouses.preInit(MscHouses.java:78)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)
- 2013-06-13 15:19:16 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
- 2013-06-13 15:19:16 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)
- 2013-06-13 15:19:16 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
- 2013-06-13 15:19:16 [INFO] [STDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:514)
- 2013-06-13 15:19:16 [INFO] [STDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:160)
- 2013-06-13 15:19:16 [INFO] [STDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:411)
- 2013-06-13 15:19:16 [INFO] [STDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
- 2013-06-13 15:19:16 [INFO] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:733)
- 2013-06-13 15:19:16 [INFO] [STDERR] at java.lang.Thread.run(Unknown Source)
Advertisement
Add Comment
Please, Sign In to add comment