Skip to content

Commit 97ee8f1

Browse files
committed
fix: ensure beholder can deal damage even if owner player cannot be retrieved
Closes #1256
1 parent ee71f7b commit 97ee8f1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/com/klikli_dev/occultism/common/entity/familiar/BeholderFamiliarEntity.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.klikli_dev.occultism.util.FamiliarUtil;
3131
import net.minecraft.core.BlockPos;
3232
import net.minecraft.core.particles.DustParticleOptions;
33-
import net.minecraft.nbt.CompoundTag;
3433
import net.minecraft.sounds.SoundEvents;
3534
import net.minecraft.sounds.SoundSource;
3635
import net.minecraft.util.Mth;
@@ -266,7 +265,7 @@ public void shootRay(List<Integer> targetIds) {
266265

267266
private static class RayGoal extends Goal {
268267

269-
private static final int MAX_COOLDOWN = 20 * 1;
268+
private static final int MAX_COOLDOWN = 20;
270269

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

326-
if (e != null && owner instanceof Player player) {
325+
if (e == null)
326+
continue;
327+
328+
if (owner instanceof Player player) {
327329
e.hurt(this.entity.damageSources().playerAttack(player), damage);
330+
} else {
331+
e.hurt(this.entity.damageSources().mobAttack(this.entity), damage);
328332
}
329333
}
330334
}

0 commit comments

Comments
 (0)