Custom Fuel 26.2
Learn how to create your own fuel items.
Fuels are the items that can be used in a furnace to smelt ores and cook food. Let's see how we can create our own custom fuel.
Creating the Item
Let's create a fuel item called "Quark-Gloun Plasma". We start by creating an item as usual:
java
public static final ResourceKey<Item> QUARK_GLUON_PLASMA = create("quark_gluon_plasma");1
java
public static final Item QUARK_GLUON_PLASMA = register(
ModItemIds.QUARK_GLUON_PLASMA,
Item::new,
new Item.Properties()
);1
2
3
4
5
2
3
4
5
To make it a fuel, we will use the FuelValueEvents.BUILD event from the Fabric Content Registries API:
java
// Remember, Minecraft deals with logical based-time using ticks.
// 20 ticks = 1 second.
FuelValueEvents.BUILD.register((builder, context) -> {
builder.add(ModItems.QUARK_GLUON_PLASMA, 120 * 20);
});1
2
3
4
5
2
3
4
5
As usual, don't forget to add a texture, translation, creative tab, yada yada. Here's an example texture:
Here's how it looks like when used as fuel in the furnace:



