Data Driven Fires - Crystal-Nest/soul-fire-d GitHub Wiki

What are they

Data Driven Fires, or for short DDFires, are Fires that are registered via a datapack rather than a mod.
It goes without saying that Soul Fire'd mod must be installed.
DDFires can be useful because it's easier, faster and could be more user-friendly to create a datapack rather than a mod just to register a Fire of another mod. Furthermore, it's easier to plug into a world, new or existing, a datapack rather than a mod, and just be reloading the datapack or joining the world the DDFires will be synced across all players!
However, they also come with their drawbacks: they can be used only to register Fires of another mod and they cannot have enchantments or custom damage sources.

Datapack structure

For a detailed guide on how to create a datapack, follow this guide.
Specifically for a DDFires datapack, it must be located under the datapacks/ folder of the world and must have the following structure:

datapacks >
  yourdatapackname >
    pack.mcmeta
    data >
      soulfired >
        fires >
          JSON files...

To know more about the pack.mcmeta file, check out this section of the datapack creation guide.
Make sure to change yourdatapackname to your actual datapack name and to leave all other names unchanged!

JSON files

The JSON files are content of a DDFires datapack. There can be more than 1, but each one can register Fires for only 1 mod. A JSON file structure is the following:

{
  "mod": "modid",
  "fires": [
    // List of Fires of the "modid" mod to register
  ]
}

As anticipated, a DDFires datapack can only register Fires of another mod.
For example, if you wanted to register a BYG fire, you would put "byg" in the place of "modid".
Note also that Fires registered via mods take priority over DDFires.

DDFires

A single actual DDFire is a JSON object, structured as follows:

{
  "fire": "fireid", // The only required field, must correspond to the actual name of the fire as named within the mod's code
  "damage": 1.0, // Optional. Must be a float, if omitted defaults to 1.0
  "invertHealAndHarm": false, // Optional. Must be a boolean, if omitted defaults to false
  "source": null, // Optional. Must be a string or null. If a string, it must be a valid identifier of a block, if null the fire won't have any source block related. Defaults to "modid:fireid_fire"
  "campfire": , // Optional. Must be a string or null. If a string, it must be a valid identifier of a block, if null the fire won't have any campfire related. Defaults to "modid:fireid_campfire"
}

Check the Building a Fire section of this Wiki for a more detailed description of these 4 properties.
As anticipated, due to technical limitations, DDFires cannot register custom enchantments or custom damage sources.

To given an example, to register Cryptic Fire from BYG the DDFire would be as follows:

{
  "fire": "cryptic",
  "damage": 3.5 // Damage of Cryptic Fire
  // Source and campfire are omitted and will thus take their default value: respectively, "byg:cryptic_fire" and "byg:cryptic_campfire"
}

And to register Boric Fire it would be:

{
  "fire": "boric",
  "damage": 3.5 // Damage of Boric Fire
  // Source and campfire are omitted and will thus take their default value: respectively, "byg:boric_fire" and "byg:boric_campfire"
}

The complete JSON file to register both BYG fires would look like this:

{
  "mod": "byg",
  "fires": [
    {
      "fire": "cryptic",
      "damage": 3.5
    },
    {
      "fire": "boric",
      "damage": 3.5
    }
  ]
}

(Fabric 1.16.5 only) Datapack sync event

Regardless of the mod loader, there is an event triggered on datapack syncing, giving access to the player to whom the datapacks are being synced.
This is true for all supported game versions, apart for Fabric 1.16.5 where the Fabric API does not include this event.
To overcome this, only for 1.16.5, the Soul Fire'd API provides that same event: crystalspider.soulfired.api.events.ServerLifecycleEvents#SYNC_DATA_PACK_CONTENTS.
It's exactly the same as net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents#SYNC_DATA_PACK_CONTENTS, but ported to 1.16.5.