Skip to content

Commit dd68825

Browse files
[CHANGE] make it so return to village ai has higher priority than attacking mob ai so guards are able to return to the village more effectively
1 parent 17a1dc5 commit dd68825

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/tallestegg/guardvillagers/common/entities/Guard.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,14 @@ public boolean canUse() {
592592
this.targetSelector.addGoal(3, new HeroHurtTargetGoal(this));
593593
this.targetSelector.addGoal(5, new DefendVillageGuardGoal(this));
594594
if (GuardConfig.COMMON.AttackAllMobs.get()) {
595-
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Mob.class, 5, true, true, (mob) -> mob instanceof Enemy && !GuardConfig.COMMON.MobBlackList.get().contains(mob.getEncodeId())));
595+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Mob.class, 5, true, true, (mob) -> mob instanceof Enemy && !GuardConfig.COMMON.MobBlackList.get().contains(mob.getEncodeId())));
596596
} else {
597-
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Ravager.class, true)); // To make witches and ravagers have a priority than other mobs this has to be done
598-
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Witch.class, true));
599-
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Raider.class, true));
600-
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Zombie.class, true, (mob) -> !(mob instanceof ZombifiedPiglin)));
597+
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Ravager.class, true)); // To make witches and ravagers have a priority than other mobs this has to be done
598+
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Witch.class, true));
599+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Raider.class, true));
600+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Zombie.class, true, (mob) -> !(mob instanceof ZombifiedPiglin)));
601601
}
602-
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 5, true, true, (mob) -> GuardConfig.COMMON.MobWhiteList.get().contains(mob.getEncodeId())));
602+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 5, true, true, (mob) -> GuardConfig.COMMON.MobWhiteList.get().contains(mob.getEncodeId())));
603603
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
604604
this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false));
605605
}
@@ -1775,7 +1775,7 @@ public GuardGroundPathNavigation(Guard guard, Level level) {
17751775
super(guard, level);
17761776
this.guard = guard;
17771777
}
1778-
1778+
17791779
@Override
17801780
public boolean isDone() {
17811781
return (guard.isPatrolling() && guard.getTarget() == null && guard.blockPosition().equals(guard.getPatrolPos())) || super.isDone();

src/main/java/tallestegg/guardvillagers/configuration/GuardConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public CommonConfig(ModConfigSpec.Builder builder) {
111111
builder.pop();
112112
builder.push("guard stuff");
113113
guardSinkToFightUnderWater = builder.define("Allow guards to sink temporarily to fight mobs that are under water?", true);
114-
depthGuardHuntUnderwater = builder.comment("If a guard is fighting a mob underwater and the vertical distance between that mob and the guard is larger than this, the guard will instead float up to not take the risk of drowning").defineInRange("Depth value for guards fighting underwater mobs", 8, 0, 100000000);
114+
depthGuardHuntUnderwater = builder.comment("If a guard is fighting a mob underwater and the vertical distance between that mob and the guard is larger than this, the guard will instead float up to not take the risk of drowning").defineInRange("Depth value for guards fighting underwater mobs", 5, 0, 100000000);
115115
mobsGuardsProtectTargeted = builder.defineListAllowEmpty("Mobs that guards actively protect when they get targeted", ImmutableList.of("minecraft:villager", "guardvillagers:guard", "minecraft:iron_golem"), () -> "", obj -> true);
116116
mobsGuardsProtectHurt = builder.comment("Mobs in this list also won't get hurt by a guard's arrow if the config option to disable guard arrows hurting villagers is enabled.").defineListAllowEmpty("Mobs that guards actively protect when they get hurt", ImmutableList.of("minecraft:villager", "guardvillagers:guard", "minecraft:iron_golem"), () -> "", obj -> true);
117117
guardCrossbowAttackRadius = builder.defineInRange("Guard crossbow attack radius", 8.0F, 0.0F, 100000000.0F);

0 commit comments

Comments
 (0)