Skip to content

Using the API

Crystal Spider edited this page Oct 9, 2022 · 6 revisions

Fire Manager

FireManager is a utility class with many methods to retrieve data from all registered Fires.
Each method comes with a Javadoc explaining its use, most are getters, here some important/useful methods are seen in more depth:

  • createCampfireBlock(String, Properties) (in Fabric it's Settings instead of Properties)
    Utility to create a CampfireBlock with the correct Fire Id.
  • isValidFireId(String)
    Checks if the given String is a valid Fire Id.
    Does not check if there's a Fire registered with it.
  • isFireId(String)
    Checks if the given String is a valid Fire Id and if there's a Fire registered with it.
  • sanitizeFireId(String)
    Returns a valid Fire Id from the given String.
    This does not ensure that a Fire is registered with it.
  • ensureFireId(String)
    Returns a valid and registered Fire Id from the given String.

Set on fire

All base cases are handled by this mod once a Fire is registered, for example you don't have to worry about setting an entity on fire when it goes into your fire source block.
However you may wish to set on a specific Fire a certain entity in a different situation from the base ones, for example with Torch hit! torch hits represent a new use case where handling setting on fire is needed.
To set on fire an entity while keeping this mod features you just need to call FireManager.setOnFire(Entity, int, String) passing it the entity you wish to set on fire, the amount of seconds the fire should last for and the Fire Id of the Fire.

Clear fire

Removing any fire from any entity is as easy as using base Minecraft method Entity.clearFire() (Entity.extinguish() on Fabric).

Hurting and healing

TODO

Clone this wiki locally