Setup - Crystal-Nest/soul-fire-d GitHub Wiki

Before jumping to using the API a few basic steps are required to make it work properly.

Adding Soul Fire'd as a dependency

Soul Fire'd mod files are hosted by CurseForge, so to add it as a dependency you can follow the tutorial on CurseMaven.
In short, here's an example of the code to put in your build.gradle file:

/*
 * Other stuff
 */
repositories {
  /* 
   * Other repositories
   */
  maven {
    url "https://cursemaven.com"
    content {
      includeGroup "curse.maven"
    }
  }
}
dependencies {
  /* 
   * Other dependencies
   */
  // Soul Fire'd dependency for different loaders, replace "xxxxxxx" with the file ID of the version you need.
  // Use this on Forge:
  implementation fg.deobf("curse.maven:soulfired-662413:xxxxxxx") 
  // Use this on Fabric:
  modImplementation "curse.maven:soulfired-662413:xxxxxxx"
  // Use this on NeoForge:
  api "curse.maven:soulfired-662413:xxxxxxx"
}

Finally, if you're on Forge/NeoForge remember to add the following to your mods.toml:

[dependencies.modid](/Crystal-Nest/soul-fire-d/wiki/dependencies.modid)
    modId="soulfired"
    mandatory=true # Set it to false if Soul Fire'd should be an optional dependency
    versionRange="[3.2.1.0,)" # As the time of writing, 3.2.1.0 is the latest version
    ordering="NONE"
    side="BOTH"

If you're on Fabric, add instead the following to your fabric.mod.json:

  "depends": {
    // Other properties
    "soulfired": "^3.2.1.0"
  }

Alternatively, if Soul Fire'd should be an optional dependency, add:

  "depends": {
    // Other properties
  },
  "suggests": {
    "soulfired": "^3.2.1.0"
  }

Fire Type

A Fire Type is an identifier used to uniquely identify any modded Fire within the API.
It consists of two parts: a Mod Id and a Fire Id.
The Mod Id should be the id of the mod owning the registered fire, while the Fire Id can be chosen freely.
Keep in mind that the class used to represent a Fire Type is Minecraft's ResourceLocation (on Forge, Identifier on Fabric), so both the Mod Id and the Fire Id need to comply to the rules of that class.

There are only 2 reserved Fire Types: the ones for Minecraft Vanilla fire, DEFAULT_FIRE_TYPE, and Soul Fire, SOUL_FIRE_TYPE.

Of course there can't be any two fires sharing the same Fire Type, as only the first one associated with that Fire Type would be registered, while the next one(s) would log and error instead.

Assets and project structure

Vanilla fires, aka normal fire and soul fire, use 2 different sprite animations to render.
We will call them sprite0 and sprite1. They are both used to render the fire you see on entities, but sprite1 is the only one used to render the player's screen overlay.
So first thing you need is your own pair of fire animated sprites. They need to be animated PNGs with a .mcmeta file describing the order of each frame.
It's required to follow this format when naming your fire sprites:
fire_id_fire_0.png
fire_id_fire_0.png.mcmeta
fire_id_fire_1.png
fire_id_fire_1.png.mcmeta
(you should put your own custom Fire Id in the place of fire_id)
The following are the sprites used for soul fire, which set the example you should follow: soul_fire_sprites.zip

Once you have your own sprites, you need to put them under assets/modid/textures/block/ (modid should be your own Mod Id).

Registering your block

This section assumes you already know how to register a custom block.

Minecraft only loads textures that are actually used, so other than adding your fire sprites as explained above, you need your fire block to make use of them.
To do so you need, under assets/modid/models/block/ in your fire model JSONs, to describe how to apply the textures to your fire block.
For example here's how Minecraft does it for soul fire: soul_fire_models.zip
After this you need, under assets/modid/blockstates/ in your fire blockstate JSON, to reference those models.
For example here's how Minecraft does it for soul fire: soul_fire_blockstate.zip

Enchantments localization

The API, by default, automatically adds Fire Aspect and Flame enchantments for each custom fire registered.
Although both registering your fire and tweaking/disabling enchantments is covered in other sections, if you wish to make use of the automatically generated enchantments another step needs to be done: adding translations for them.
Luckily this is very simple, just put under assets/modid/lang/ a JSON file named us_us.json with the following entries:

{
  "enchantment.modid.fire_id_fire_aspect": "",
  "enchantment.modid.fire_id_flame": "",
  "enchantment.modid.fire_id_fire_aspect.desc": "",
  "enchantment.modid.fire_id_flame.desc": ""
}

and fill them with the name you wish the enchantments to display and a brief description of what the enchantment does.
Of course remember to change modid with your Mod Id and fire_id with your Fire Id.

The entries that end with desc are technically optional, but adding them is a good practice for compatibility with Enchantment Descriptions and JEI Enchantment Info.
If you wish to add more languages other than English, you can find a list of other language tags here.

For example, here's how I did for soul fire: soulfired/lang