ValidatePlayDead .java

net.minecraft.world.entity.animal.axolotl.ValidatePlayDead (class, 27 lines): members: create. imports: BehaviorControl, BehaviorBuilder, MemoryModuleType.

net.minecraft.world.entity.animal.axolotlclass27 linescommon851 B

API Surface (1)

BehaviorControl<LivingEntity> create()

Code Graph: Dependencies (4)

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

Full Source

ValidatePlayDead.java27 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.animal.axolotl;
2
3
import net.minecraft.world.entity.LivingEntity;
4
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
5
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
6
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
7
8
public class ValidatePlayDead {
9
	public static BehaviorControl<LivingEntity> create() {
10
		return BehaviorBuilder.create(
11
			i -> i.group(i.present(MemoryModuleType.PLAY_DEAD_TICKS), i.registered(MemoryModuleType.HURT_BY_ENTITY))
12
				.apply(i, (playDeadTicks, hurtBy) -> (level, body, timestamp) -> {
13
					int ticks = i.get(playDeadTicks);
14
					if (ticks <= 0) {
15
						playDeadTicks.erase();
16
						hurtBy.erase();
17
						body.getBrain().useDefaultActivity();
18
					} else {
19
						playDeadTicks.set(ticks - 1);
20
					}
21
22
					return true;
23
				})
24
		);
25
	}
26
}
27

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