From b3d6464dc78afde9873144afcce2cf00c4fb384b Mon Sep 17 00:00:00 2001 From: xypp <2952795729@qq.com> Date: Tue, 27 May 2025 00:48:36 +0800 Subject: [PATCH] Add tamable entity's owner check in effect behavior. --- gradle.properties | 2 +- .../behavior/SupportEffectBehavior.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index ae69f8d..a3c589e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=maid useful task # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.3.3_a +mod_version=1.3.3_a_1 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/studio/fantasyit/maid_useful_task/behavior/SupportEffectBehavior.java b/src/main/java/studio/fantasyit/maid_useful_task/behavior/SupportEffectBehavior.java index 5e4b9f7..8de044c 100644 --- a/src/main/java/studio/fantasyit/maid_useful_task/behavior/SupportEffectBehavior.java +++ b/src/main/java/studio/fantasyit/maid_useful_task/behavior/SupportEffectBehavior.java @@ -47,10 +47,17 @@ public class SupportEffectBehavior extends Behavior { return memory.map(list -> list .find(entity -> entity instanceof Monster) .map(monster -> (Monster) monster) - .anyMatch(monster -> { - if (monster.getTarget() != null && monster.getTarget().equals(player)) { + .map(Mob::getTarget) + .anyMatch(target -> { + if (target == null) + return false; + if (target.equals(player)) { return true; } + if (target instanceof TamableAnimal tamed) { + if (tamed.getOwner() != null && tamed.getOwner().equals(player)) + return true; + } return false; }) ).orElse(false);