Add tamable entity's owner check in effect behavior.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -47,10 +47,17 @@ public class SupportEffectBehavior extends Behavior<EntityMaid> {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user