Posted June 5, 201312 yr Anyone know if their was a a way to add a new fuel? (Similar to the new Coal Block) I have searched many sites and I haven't found anything that works in 1.5.2 Any help would be appreciated
June 5, 201312 yr package chibill.AdditionalCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.IFuelHandler; public class FuelHandler implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { int var1 = fuel.itemID; if(var1 == Item.book.itemID){ return 300; }else if(var1 == Base.NetherStone.itemID){ return 40000; }else return 0; } } In its own class then in base class GameRegistry.registerFuelHandler(new FuelHandler());
June 5, 201312 yr I believe that "Base" is something like, YourModBase... So as a rewrite... : public class FuelHandler implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { int var1 = fuel.itemID; if(var1 == Item.book.itemID){ return 300; }else if(var1 == YourModBase.itemYouWantAsFuel.itemID){ return 40000; }else return 0; } } in "YourModBase": GameRegistry.registerFuelHandler(new FuelHandler()); I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
June 5, 201312 yr Author By the way, would it be possible to make a block a fuel (like the Coal Block in 1.6), because i keep getting a cannot make a static reference to a non-static object error
June 5, 201312 yr By the way, would it be possible to make a block a fuel (like the Coal Block in 1.6), because i keep getting a cannot make a static reference to a non-static object error That would be a problem with the way you have registered the block then. And it would be something like this: [EDIT] public class FuelHandler implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { int var1 = fuel.itemID; if(var1 == Item.book.itemID){ return 300; }else if(var1 == YourModBase.itemYouWantAsFuel.itemID){ return 40000; } else if(var1 == YourModBase.blockYouWantAsFuel.blockID){ return 12345; } else return 0; } } I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.