Good day. MC 1.21
I'm trying to make custom effect to increase incoming damage to Warden if player(or attacker) has effect, but when I try to get effect using Java StatusEffectInstance effect = attacker.getStatusEffect(WardenToolsEffects.WARDEN_SLAYER_EFFECT); it's null
Mixin code:
@Inject(method = "damage", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/entity/mob/HostileEntity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z"))
private void applyExtraDamage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir,@Local(ordinal = 0) boolean bl) {
if (bl) {
System.out.println("1");
if (source.getAttacker() instanceof LivingEntity attacker) {
System.out.println("2 " + attacker);
StatusEffectInstance effect = attacker.getStatusEffect(WardenToolsEffects.WARDEN_SLAYER_EFFECT);
System.out.println(effect);
if (effect != null) {
System.out.println("3");
this.timeUntilRegen = 0;
super.damage(source, amount * 2);
}
}
}
}
(System outs are for debugging)