BecomePassiveIfMemoryPresent .java

net.minecraft.world.entity.ai.behavior.BecomePassiveIfMemoryPresent (class, 19 lines): members: create. strings: "[BecomePassive if ", " present]".

net.minecraft.world.entity.ai.behaviorclass19 linescommon827 B

API Surface (1)

BehaviorControl<LivingEntity> create(final MemoryModuleType<?> pacifyingMemory, final int pacifyDuration)

String literals (2)

"[BecomePassive if "
" present]"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BecomePassiveIfMemoryPresent.java19 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.behavior;
2
3
import net.minecraft.world.entity.LivingEntity;
4
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
5
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
6
7
public class BecomePassiveIfMemoryPresent {
8
	public static BehaviorControl<LivingEntity> create(final MemoryModuleType<?> pacifyingMemory, final int pacifyDuration) {
9
		return BehaviorBuilder.create(
10
			i -> i.group(i.registered(MemoryModuleType.ATTACK_TARGET), i.absent(MemoryModuleType.PACIFIED), i.present(pacifyingMemory))
11
				.apply(i, i.point(() -> "[BecomePassive if " + pacifyingMemory + " present]", (attackTarget, pacified, pacifying) -> (level, body, timestamp) -> {
12
					pacified.setWithExpiry(true, pacifyDuration);
13
					attackTarget.erase();
14
					return true;
15
				}))
16
		);
17
	}
18
}
19

Decompiled Minecraft 26.3 source of BecomePassiveIfMemoryPresent (net/minecraft/world/entity/ai/behavior/BecomePassiveIfMemoryPresent.java) with Mojang official mappings, stored verbatim on the site.