Skip to content

Commit 1cef012

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 64057c6 commit 1cef012

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public CommonConfig(ForgeConfigSpec.Builder builder) {
192192
builder.push("guard stuff");
193193
guardSpawnInVillage = builder.defineInRange("How many guards should spawn in a village?", 6, 0, 100000000);
194194
guardSinkToFightUnderWater = builder.define("Allow guards to sink temporarily to fight mobs that are under water?", true);
195-
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);
195+
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);
196196
mobsGuardsProtectTargeted = builder.defineListAllowEmpty("Mobs that guards actively protect when they get targeted", Lists.newArrayList("minecraft:villager", "guardvillagers:guard", "minecraft:iron_golem"), obj -> true);
197197
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", Lists.newArrayList("minecraft:villager", "guardvillagers:guard", "minecraft:iron_golem"), obj -> true);
198198
structuresThatSpawnGuards = builder.comment("Guards are placed in the middle, thus more advanced placement should be done via datapacks").define("Structure pieces that spawn guards", Lists.newArrayList("minecraft:village/common/iron_golem"), obj -> true);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,12 @@ public boolean canUse() {
646646
this.targetSelector.addGoal(3, new HeroHurtTargetGoal(this));
647647
this.targetSelector.addGoal(5, new Guard.DefendVillageGuardGoal(this));
648648
if (GuardConfig.AttackAllMobs) {
649-
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Mob.class, 5, true, true, (mob) -> mob instanceof Enemy && !GuardConfig.MobBlackList.contains(mob.getEncodeId())));
649+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Mob.class, 5, true, true, (mob) -> mob instanceof Enemy && !GuardConfig.COMMON.MobBlackList.get().contains(mob.getEncodeId())));
650650
} else {
651-
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
652-
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Witch.class, true));
653-
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Raider.class, true));
654-
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Zombie.class, true, (mob) -> !(mob instanceof NeutralMob)));
651+
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
652+
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Witch.class, true));
653+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Raider.class, true));
654+
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Zombie.class, true, (mob) -> !(mob instanceof ZombifiedPiglin)));
655655
}
656656
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Mob.class, 5, true, true, (mob) -> GuardConfig.COMMON.MobWhiteList.get().contains(mob.getEncodeId())));
657657
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));

0 commit comments

Comments
 (0)