Using my own DamageSource and few questions

What is a correct way to pass my own damagesource into entitydamageevent.

public interface ISkillDamageSource extends DamageSource {
    ISkill getSkill();
    IActiveCharacter getCaster();
    • calling method Entity.damage(double,Cause)
ISkillDamageSource source = ....;
Cause cause = Cause.of(source);
Entity e = ...;
  1. Using sponge event factory to create a new event with my damagesource as a cause

    Cause cause = Cause.of(source);
    SourcePlayer event = SpongeEventFactory.createDamageEntityEventSourcePlayer(damage,cause,);
    if (!event.isCancelled())

  2. Something else

Also how can i override(disable) vanilla damagemodifiers such as enchantments (eg sharpness/protections) and stuff like vanilla critical hits or armor damage reduction? I would like to replace some of vanilla calculations with my owns.

Maybe this can help you:

Currently, you can’t use your own damage sources, awaiting on some transformer code from @Aaron1011. However, you should be able to make a vanilla DamageSource and associate the skill within the cause.

1 Like