#[1.21] Entity Damage Sources Error

4 messages · Page 1 of 1 (latest)

spice locust
#

I have a mod where getting hit by a minecart damages the player but when porting from 1.19.3 to 1.21 theres no Entity Damage Sources class
My code

    public static DamageSource minecart(Entity entity) {
        return new EntityDamageSource(MOD_ID + ".minecart", entity);
    }

can someone help?

kindred crescent
#

Damage types

With the addition of /damage, damage related code has been refactored.

Damage types can now be defined using a dynamic registry, with data packs. This also removed the constant DamageSources. The DamageSources class holds several methods to get instances of DamageSource with or without an attacker:

#

seems like the place to start