From b123987727f47de2ea00b2696f38ecf7059f4186 Mon Sep 17 00:00:00 2001 From: the_xu <448537509@qq.com> Date: Sun, 22 Sep 2024 00:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8B=E7=9C=BC=E6=B7=BB=E5=8A=A0=E9=93=81?= =?UTF-8?q?=E5=82=80=E5=84=A1=E7=9B=AE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/confluence/mod/entity/boss/TerraBossBase.java | 9 ++++++++- .../mod/entity/boss/geoEntity/CthulhuEye.java | 11 +++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/confluence/mod/entity/boss/TerraBossBase.java b/src/main/java/org/confluence/mod/entity/boss/TerraBossBase.java index 0d9ef1208..ff053ca8a 100644 --- a/src/main/java/org/confluence/mod/entity/boss/TerraBossBase.java +++ b/src/main/java/org/confluence/mod/entity/boss/TerraBossBase.java @@ -13,10 +13,12 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.animal.IronGolem; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -34,6 +36,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.function.Predicate; @SuppressWarnings("all") public abstract class TerraBossBase extends Monster implements GeoEntity { @@ -50,10 +53,14 @@ public TerraBossBase(EntityType type, Level level) { public abstract void addSkills(); // 攻击目标 + private static final Predicate LIVING_ENTITY_SELECTOR = entity -> entity instanceof Player; + protected void registerGoals() { //this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 100F)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true)); } // 技能动画 diff --git a/src/main/java/org/confluence/mod/entity/boss/geoEntity/CthulhuEye.java b/src/main/java/org/confluence/mod/entity/boss/geoEntity/CthulhuEye.java index 945c5d299..52b371260 100644 --- a/src/main/java/org/confluence/mod/entity/boss/geoEntity/CthulhuEye.java +++ b/src/main/java/org/confluence/mod/entity/boss/geoEntity/CthulhuEye.java @@ -22,6 +22,7 @@ import org.confluence.mod.entity.boss.BossSkill; import org.confluence.mod.entity.boss.TerraBossBase; import org.confluence.mod.entity.demoneye.DemonEye; +import org.confluence.mod.entity.demoneye.DemonEyeWanderGoal; import org.confluence.mod.util.DeathAnimOptions; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.animatable.SingletonGeoAnimatable; @@ -33,7 +34,6 @@ @SuppressWarnings("all") public class CthulhuEye extends TerraBossBase implements DeathAnimOptions, GeoEntity { - private static final Predicate LIVING_ENTITY_SELECTOR = entity -> entity instanceof Player; private static final float[] MAX_HEALTHS = {364f, 473f, 603f}; private static final float[] DAMAGE = {5f, 7f, 9f};//一阶段接触伤害 private static final float[] CRAZY_DAMAGE = {7f, 11f, 15f};//二阶段接触伤害 @@ -117,6 +117,7 @@ public void addSkills() { // 延迟20tick冲刺10tick this.state1_dash = new BossSkill("2", "type_1_run", 30, 20, terraBossBase -> { + cslLookAt(); }, terraBossBase -> { @@ -185,7 +186,8 @@ public void addSkills() { ); this.state2_dash = new BossSkill("5", "type_2_run", 20, 10, terraBossBase -> { - setDeltaMovement(0, 0, 0); + //setDeltaMovement(0, 0, 0); + cslLookAt(); }, terraBossBase -> { // 延迟冲刺 @@ -260,10 +262,7 @@ protected boolean shouldDropLoot() { } } - @Override - protected void registerGoals() { - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 0, false, false, LIVING_ENTITY_SELECTOR)); - } + @Override // 受伤音效 protected SoundEvent getHurtSound(DamageSource damageSource) {return SoundEvents.SLIME_HURT;}