From 802a38e251f591e84eb3099da5a110d765bfd8ab Mon Sep 17 00:00:00 2001 From: William Date: Sat, 7 Dec 2024 22:59:45 +0100 Subject: [PATCH] Fix homing arrow not targeting some hostiles Now targets: Ender Dragon Ghast Magma Cube Phantom Shulker Slime Hoglin Also targets angry neutral mobs: Bee Iron Golem Polar Bear Wolf Ender Man (not that this one makes sense to fire at, but it's part of the neutral interface). Zombified Piglin --- .../common/entities/JustDireArrow.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/direwolf20/justdirethings/common/entities/JustDireArrow.java b/src/main/java/com/direwolf20/justdirethings/common/entities/JustDireArrow.java index 9d98c768..3a6d3a29 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/entities/JustDireArrow.java +++ b/src/main/java/com/direwolf20/justdirethings/common/entities/JustDireArrow.java @@ -15,11 +15,9 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.*; import net.minecraft.world.entity.animal.axolotl.Axolotl; +import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.ZombifiedPiglin; import net.minecraft.world.entity.player.Player; @@ -170,11 +168,11 @@ protected void defineSynchedData(SynchedEntityData.Builder p_326324_) { } public static boolean isHostileEntity(LivingEntity entity) { - if (entity instanceof Monster) { - return true; + if (entity instanceof NeutralMob) { + return ((NeutralMob) entity).isAngry(); } - if (entity instanceof ZombifiedPiglin) { - return ((ZombifiedPiglin) entity).isAngry(); + if (entity instanceof Enemy) { + return true; } return false; }