Update WeaponMagicScalingEvents with Projectile import and direct entity check

This commit is contained in:
2026-01-08 17:46:42 +01:00
parent 8695fc320d
commit f12eb41ea4
@@ -7,6 +7,7 @@ import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.entity.projectile.ThrownTrident; import net.minecraft.world.entity.projectile.ThrownTrident;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent;
@@ -77,7 +78,7 @@ public class WeaponMagicScalingEvents {
} }
private static boolean isRangedDamage(DamageSource source) { private static boolean isRangedDamage(DamageSource source) {
return source.isProjectile() return source.getDirectEntity() instanceof Projectile
|| source.getDirectEntity() instanceof AbstractArrow || source.getDirectEntity() instanceof AbstractArrow
|| source.getDirectEntity() instanceof ThrownTrident || source.getDirectEntity() instanceof ThrownTrident
|| source.getDirectEntity() instanceof FireworkRocketEntity; || source.getDirectEntity() instanceof FireworkRocketEntity;