diff --git a/CHANGELOG.md b/CHANGELOG.md index 7add72ef5..28a732e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.9 + +- Fixed Glare follow logic when tamed + ## 2.0.8 - Reworked Glare AI to use brain/tasks instead of goals diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/GlareBrain.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/GlareBrain.java index 5f8d02d40..1564392b8 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/GlareBrain.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/GlareBrain.java @@ -115,6 +115,7 @@ private static void addAvoidActivities(Brain brain) { ), ImmutableSet.of( Pair.of(MemoryModuleType.AVOID_TARGET, MemoryModuleState.VALUE_PRESENT), + Pair.of(FriendsAndFoesMemoryModuleTypes.GLARE_IS_TAMED.get(), MemoryModuleState.VALUE_ABSENT), Pair.of(FriendsAndFoesMemoryModuleTypes.GLARE_IS_IDLE.get(), MemoryModuleState.VALUE_ABSENT) ) ); @@ -172,8 +173,8 @@ public static void updateActivities(GlareEntity glare) { public static void updateMemories(GlareEntity glare) { if ( ( - glare.isBaby() - || (glare.isBaby() == false && glare.isTamed() == false) + (glare.isBaby() == false && glare.isTamed() == false) + || GlareLocateDarkSpotTask.canLocateDarkSpot(glare) == false ) && glare.getBrain().isMemoryInState(FriendsAndFoesMemoryModuleTypes.GLARE_DARK_SPOT_LOCATING_COOLDOWN.get(), MemoryModuleState.VALUE_ABSENT) ) { @@ -183,6 +184,7 @@ public static void updateMemories(GlareEntity glare) { if ( glare.isSitting() || glare.isLeashed() + || glare.hasVehicle() ) { glare.getBrain().remember(FriendsAndFoesMemoryModuleTypes.GLARE_IS_IDLE.get(), true); } else { diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/sensor/GlareSpecificSensor.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/sensor/GlareSpecificSensor.java index ce5465966..7ade032dd 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/sensor/GlareSpecificSensor.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/sensor/GlareSpecificSensor.java @@ -50,7 +50,7 @@ protected void sense(ServerWorld world, GlareEntity glare) { LivingTargetCache livingTargetCache = brain.getOptionalMemory(MemoryModuleType.VISIBLE_MOBS).orElse(LivingTargetCache.empty()); LivingEntity firstHostileEntity = livingTargetCache.findFirst(livingEntity -> livingEntity instanceof HostileEntity).orElse(null); - if (firstHostileEntity == null) { + if (firstHostileEntity == null || glare.isTamed()) { return; } diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateDarkSpotTask.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateDarkSpotTask.java index d996fb622..5a22dad77 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateDarkSpotTask.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateDarkSpotTask.java @@ -99,6 +99,7 @@ public static boolean canLocateDarkSpot(GlareEntity glare) { if ( glare.isLeashed() || glare.isSitting() + || glare.hasVehicle() || glare.isTamed() == false || glare.isBaby() || ( diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateGlowBerriesTask.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateGlowBerriesTask.java index 0141af5a5..88695fd82 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateGlowBerriesTask.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/ai/brain/task/glare/GlareLocateGlowBerriesTask.java @@ -35,6 +35,7 @@ protected boolean shouldRun(ServerWorld world, GlareEntity glare) { return FriendsAndFoes.getConfig().enableGlareGriefing != false && !glare.isLeashed() && !glare.isSitting() + && !glare.hasVehicle() && glare.getEquippedStack(EquipmentSlot.MAINHAND).isEmpty() != false; } diff --git a/gradle.properties b/gradle.properties index 4272ccd2c..41651cdf5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.configureondemand=false # Mod mod_name=Friends&Foes mod_id=friendsandfoes -mod_version=2.0.8 +mod_version=2.0.9 mod_author=Faboslav mod_description=Adds outvoted and forgotten mobs from the mob votes in a believable vanilla plus style. maven_group=com.faboslav.friendsandfoes