Changes since 1.19.4 - Nyphet/soul-fire-d GitHub Wiki
DamageSource
Minecraft Since Minecraft 1.19.4 the DamageSource
class has changed drastically. It went from having hardcoded static references to all damage sources to being more data driven allowing for damage type tags.
With this change the previously used static damage sources, for example DamageSource#IN_FIRE
and DamageSource#ON_FIRE
, have been removed.
To access the damage sources available it's now needed to use either a Level
/World
or an Entity
and call damageSources()
/getDamageSources()
(Forge/Fabric).
Code like (Fabric used as an example) entity.damage(DamageSource.ON_FIRE, 2.0F);
becomes now entity.damage(entity.getDamageSources().onFire(), 4.0F);
.
Considered this, it is not possible anymore to save a static reference to the damage sources for each registered fire.
Furthermore the hurt sound has been included into the DamageSource
via DamageEffects
and is configurable via datapacks.
In Fire, On Fire and Hurt Sound
For the reasons stated above, the classes Fire
and FireBuilder
had to change.
First, the hurtSound
property has been removed altogether.
Second, the damage sources associated with Fire
have been replaced with a getter (Function<Entity, DamageSource>
) that takes as input an Entity
and must return a DamageSource
.
About the second change, the methods FireBuilder#setInFire()
and FireBuilder#setOnFire()
changed respectively to FireBuilder#setInFire(Function<Entity, DamageSource>)
and FireBuilder#setOnFire(Function<Entity, DamageSource>)
.
The default value for those getters is FireBuilder#DEFAULT_IN_FIRE_GETTER
(entity -> entity.damageSources().inFire()
) and FireBuilder#DEFAULT_ON_FIRE_GETTER
(entity -> entity.damageSources().onFire()
).
FireManager
To reflect the changes made to Fire
and FireBuilder
, some FireManager
methods have either changed or been removed:
getHurtSound(String, String)
and its overload have been removed.isFireDamageSource(DamageSource)
has been removed.getInFireDamageSource(String, String)
and its overload have been renamed togetInFireDamageSourceFor
and now take anEntity
as their first parameter.getOnFireDamageSource(String, String)
and its overload have been renamed togetOnFireDamageSourceFor
and now take anEntity
as their first parameter.
It goes without saying that the Entity
passed as parameter should be the entity that is going to interact by the fire.