Hi i have a problem since 1.17.1 is "new" i'm not able to find the class net.minecraft.potion.Effect. And if i can't extend that class then i can't make my potion effect. So does anyone know where that class is ? and do you guys have a tutorial on how to make a potion effect in 1.16.5 or 1.17.1 because i can't find any tutorial about it. Thank you for helping!!!
Why the fak are you to-stringing that?
if(source instanceof ImpactDamage) works just fine. You could also create single static instances of your new damage type and use things like ModDamageTypes.SLASHING and the == operator, like vanilla does. Your damage type instances have NO custom data in them at all, so you should just do that (yes I realize my own, very old, code is not following that).
This is not how localization works.
ItemStacks are never null.
The player could be, though.
Use ifPresent() instead.
You should use the logger Forge provides you instead.
When an entity is attacked it has a few ticks of damage resistance during which time no further damage can be applied.
You have to set Entity#invulnerableTime to 0 after applying the damage if you want further damage to apply on the same tick.