Repository navigation
Flammables
Foundation has a small API for making your blocks burnable by fire, the same way vanilla planks, wool or leaves are. You register your blocks once and Foundation applies them to FireBlock during common setup on Fabric and NeoForge.
Register your blocks in your mod's common init. You can do this before the blocks themselves are registered, because blocks are passed as Suppliers and only resolved later.
import net.satisfy.foundation.flammable.FoundationFlammables;
public static void init() {
FoundationFlammables.wood(ModBlocks.OAK_TABLE, ModBlocks.OAK_CHAIR);
FoundationFlammables.wool(ModBlocks.RED_CUSHION);
FoundationFlammables.hay(ModBlocks.STRAW_BALE);
FoundationFlammables.plant(ModBlocks.WILD_HERB);
}ModBlocks.X can be any Supplier<? extends Block>, for example an Architectury RegistrySupplier.
| Method | Ignite odds | Burn odds | Vanilla equivalent |
|---|---|---|---|
wood() |
5 | 20 | Planks, fences, stairs |
wool() |
30 | 60 | Wool, carpets |
hay() |
60 | 20 | Hay bale |
plant() |
60 | 100 | Grass, flowers, vines |
- Ignite odds: how likely the block catches fire from nearby fire. Higher means it catches faster.
- Burn odds: how likely the block is destroyed once it is burning. Higher means it burns away faster.
If none of the presets fit, set the values yourself:
// one block
FoundationFlammables.register(15, 40, ModBlocks.BOOKSHELF_CABINET);
// several blocks
FoundationFlammables.register(15, 40, ModBlocks.SHELF_A, ModBlocks.SHELF_B);The signature is register(int igniteOdds, int burnOdds, Supplier<? extends Block>... blocks).
You don't call apply() yourself. Foundation runs it automatically:
-
Fabric: on Architectury's
LifecycleEvent.SETUP -
NeoForge: on
FMLCommonSetupEvent, insideenqueueWork
All registrations must therefore happen before common setup, so in your mod constructor or initializer. Anything registered later is not applied.
- Available since Foundation 1.0.3.
- Registering the same block twice is allowed. The last registration wins.
- To make a block non-flammable again, register it with
0, 0.