Skip to content

Commit

Permalink
克眼添加铁傀儡目标
Browse files Browse the repository at this point in the history
  • Loading branch information
EDGtheXu committed Sep 21, 2024
1 parent 94f7d09 commit b123987
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -50,10 +53,14 @@ public TerraBossBase(EntityType<? extends Monster> type, Level level) {
public abstract void addSkills();

// 攻击目标
private static final Predicate<LivingEntity> 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));
}

// 技能动画
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,7 +34,6 @@

@SuppressWarnings("all")
public class CthulhuEye extends TerraBossBase implements DeathAnimOptions, GeoEntity {
private static final Predicate<LivingEntity> 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};//二阶段接触伤害
Expand Down Expand Up @@ -117,6 +117,7 @@ public void addSkills() {
// 延迟20tick冲刺10tick
this.state1_dash = new BossSkill("2", "type_1_run", 30, 20,
terraBossBase -> {
cslLookAt();
},
terraBossBase -> {

Expand Down Expand Up @@ -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 -> {
// 延迟冲刺
Expand Down Expand Up @@ -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;}
Expand Down

0 comments on commit b123987

Please sign in to comment.