Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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());

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 xD

  • 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

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 xD

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.