Skip to content

Commit

Permalink
fix: ensure beholder can deal damage even if owner player cannot be r…
Browse files Browse the repository at this point in the history
…etrieved

Closes #1256
  • Loading branch information
klikli-dev committed Feb 25, 2025
1 parent ee71f7b commit 97ee8f1
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.klikli_dev.occultism.util.FamiliarUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
Expand Down Expand Up @@ -266,7 +265,7 @@ public void shootRay(List<Integer> targetIds) {

private static class RayGoal extends Goal {

private static final int MAX_COOLDOWN = 20 * 1;
private static final int MAX_COOLDOWN = 20;

protected final BeholderFamiliarEntity entity;
private int cooldown = MAX_COOLDOWN;
Expand Down Expand Up @@ -323,8 +322,13 @@ protected void attack() {
if (this.entity.hasEffect(MobEffects.DAMAGE_BOOST))
damage *= this.entity.getEffect(MobEffects.DAMAGE_BOOST).getAmplifier() + 2;

if (e != null && owner instanceof Player player) {
if (e == null)
continue;

if (owner instanceof Player player) {
e.hurt(this.entity.damageSources().playerAttack(player), damage);
} else {
e.hurt(this.entity.damageSources().mobAttack(this.entity), damage);
}
}
}
Expand Down

0 comments on commit 97ee8f1

Please sign in to comment.