Hiya,
Today I bring you a very nice fuel handling system I made that is extremely light weight(compared to what people normally do).
And going on a stretch I say this should be implemented to forge just to make everything so much simpler. @GregoriousT (screw the spelling) helped me out a bit to make it more efficient but other than that it is all mine.
So In order for this to work you need the handler (feel free to suggest things to make it more efficient or to ask questions)
Now you can directly input items to be made fuels into this but I for blocks I had to make a method, and to make the code look clean I made a method for items too.
and all you have to do now is register the fuel handler in preInit
Today I bring you a very nice fuel handling system I made that is extremely light weight(compared to what people normally do).
And going on a stretch I say this should be implemented to forge just to make everything so much simpler. @GregoriousT (screw the spelling) helped me out a bit to make it more efficient but other than that it is all mine.
So In order for this to work you need the handler (feel free to suggest things to make it more efficient or to ask questions)
Code:
public class VinillaFurnaceFuelHandler implements IFuelHandler{
public static HashMap<Item, Integer> FurnaceFuel = new HashMap<Item, Integer>();
public static void RegisterFurnaceFuel(Item fuel, Integer burnTime){
FurnaceFuel.put(fuel, burnTime);
}
@Override
public int getBurnTime(ItemStack fuel) {
Item ItemInFuelSlot = fuel.getItem();
Integer BurnTime = FurnaceFuel.get(ItemInFuelSlot);
if (BurnTime == null) return 0; else return BurnTime;
}
}
Now you can directly input items to be made fuels into this but I for blocks I had to make a method, and to make the code look clean I made a method for items too.
Code:
public static void addItemFurnaceFuel(Item fuel, Integer burnTime){
VinillaFurnaceFuelHandler.RegisterFurnaceFuel(fuel, burnTime);
}
public static void addBlockFurnaceFuel (Block fuel, Integer burnTime){
VinillaFurnaceFuelHandler.RegisterFurnaceFuel(Item.getItemFromBlock(fuel), burnTime);
}
and all you have to do now is register the fuel handler in preInit
Code:
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
GameRegistry.registerFuelHandler(new VinillaFurnaceFuelHandler());
}