PlayDead .java

net.minecraft.world.entity.animal.axolotl.PlayDead (class): members: checkExtraStartConditions, canStillUse, start. imports: Behavior, Brain, MemoryStatus.

net.minecraft.world.entity.animal.axolotlclass32 linescommonextends Behavior<Axolotl>1.3 KB

API Surface (3)

boolean checkExtraStartConditions(final ServerLevel level, final Axolotl body)
boolean canStillUse(final ServerLevel level, final Axolotl body, final long timestamp)
void start(final ServerLevel level, final Axolotl body, final long timestamp)

Code Graph: Dependencies (8)

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

Full Source

PlayDead.java32 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.animal.axolotl;
2
3
import com.google.common.collect.ImmutableMap;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.world.effect.MobEffectInstance;
6
import net.minecraft.world.effect.MobEffects;
7
import net.minecraft.world.entity.ai.Brain;
8
import net.minecraft.world.entity.ai.behavior.Behavior;
9
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
10
import net.minecraft.world.entity.ai.memory.MemoryStatus;
11
12
public class PlayDead extends Behavior<Axolotl> {
13
	public PlayDead() {
14
		super(ImmutableMap.of(MemoryModuleType.PLAY_DEAD_TICKS, MemoryStatus.VALUE_PRESENT, MemoryModuleType.HURT_BY_ENTITY, MemoryStatus.VALUE_PRESENT), 200);
15
	}
16
17
	protected boolean checkExtraStartConditions(final ServerLevel level, final Axolotl body) {
18
		return body.isInWater();
19
	}
20
21
	protected boolean canStillUse(final ServerLevel level, final Axolotl body, final long timestamp) {
22
		return body.isInWater() && body.getBrain().hasMemoryValue(MemoryModuleType.PLAY_DEAD_TICKS);
23
	}
24
25
	protected void start(final ServerLevel level, final Axolotl body, final long timestamp) {
26
		Brain<Axolotl> brain = body.getBrain();
27
		brain.eraseMemory(MemoryModuleType.WALK_TARGET);
28
		brain.eraseMemory(MemoryModuleType.LOOK_TARGET);
29
		body.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200, 0));
30
	}
31
}
32

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