API Surface (1) BehaviorControl<LivingEntity> create()
Code Graph: Dependencies (7) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
SetWardenLookTarget.java 33 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.world.entity.ai.behavior.warden;
2
3 import java.util.Optional;
4 import net.minecraft.core.BlockPos;
5 import net.minecraft.world.entity.Entity;
6 import net.minecraft.world.entity.LivingEntity;
7 import net.minecraft.world.entity.ai.behavior.BehaviorControl;
8 import net.minecraft.world.entity.ai.behavior.BlockPosTracker;
9 import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
10 import net.minecraft.world.entity.ai.memory.MemoryModuleType;
11
12 public class SetWardenLookTarget {
13 public static BehaviorControl<LivingEntity> create() {
14 return BehaviorBuilder.create(
15 i -> i.group(
16 i.registered(MemoryModuleType.LOOK_TARGET),
17 i.registered(MemoryModuleType.DISTURBANCE_LOCATION),
18 i.registered(MemoryModuleType.ROAR_TARGET),
19 i.absent(MemoryModuleType.ATTACK_TARGET)
20 )
21 .apply(i, (lookTarget, disturbance, roarTarget, attackTarget) -> (level, body, timestamp) -> {
22 Optional<BlockPos> target = i.<LivingEntity>tryGet(roarTarget).map(Entity::blockPosition).or(() -> i.tryGet(disturbance));
23 if (target.isEmpty()) {
24 return false;
25 }
26
27 lookTarget.set(new BlockPosTracker(target.get()));
28 return true;
29 })
30 );
31 }
32 }
33
Decompiled Minecraft 26.3 source of SetWardenLookTarget (net/minecraft/world/entity/ai/behavior/warden/SetWardenLookTarget.java) with Mojang official mappings, stored verbatim on the site.