Croak .java

net.minecraft.world.entity.ai.behavior.Croak (class): members: croakCounter, CROAK_TICKS, TIME_OUT_DURATION, checkExtraStartConditions, canStillUse, stop.

net.minecraft.world.entity.ai.behaviorclass42 linescommonextends Behavior<Frog>1.3 KB

API Surface (5)

boolean checkExtraStartConditions(final ServerLevel level, final Frog body)
boolean canStillUse(final ServerLevel level, final Frog body, final long timestamp)
void start(final ServerLevel level, final Frog body, final long timestamp)
void stop(final ServerLevel level, final Frog body, final long timestamp)
void tick(final ServerLevel level, final Frog body, final long timestamp)

Fields & Constants (3)

CROAK_TICKS
TIME_OUT_DURATION
croakCounter

Code Graph: Dependencies (6)

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

Full Source

Croak.java42 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.behavior;
2
3
import com.google.common.collect.ImmutableMap;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.world.entity.Pose;
6
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
7
import net.minecraft.world.entity.ai.memory.MemoryStatus;
8
import net.minecraft.world.entity.animal.frog.Frog;
9
10
public class Croak extends Behavior<Frog> {
11
	private static final int CROAK_TICKS = 60;
12
	private static final int TIME_OUT_DURATION = 100;
13
	private int croakCounter;
14
15
	public Croak() {
16
		super(ImmutableMap.of(MemoryModuleType.WALK_TARGET, MemoryStatus.VALUE_ABSENT), 100);
17
	}
18
19
	protected boolean checkExtraStartConditions(final ServerLevel level, final Frog body) {
20
		return body.getPose() == Pose.STANDING;
21
	}
22
23
	protected boolean canStillUse(final ServerLevel level, final Frog body, final long timestamp) {
24
		return this.croakCounter < 60;
25
	}
26
27
	protected void start(final ServerLevel level, final Frog body, final long timestamp) {
28
		if (!body.isInLiquid()) {
29
			body.setPose(Pose.CROAKING);
30
			this.croakCounter = 0;
31
		}
32
	}
33
34
	protected void stop(final ServerLevel level, final Frog body, final long timestamp) {
35
		body.setPose(Pose.STANDING);
36
	}
37
38
	protected void tick(final ServerLevel level, final Frog body, final long timestamp) {
39
		this.croakCounter++;
40
	}
41
}
42

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