NearestHealableRaiderTargetGoal .java

net.minecraft.world.entity.ai.goal.target.NearestHealableRaiderTargetGoal (class): members: decrementCooldown, DEFAULT_COOLDOWN, getCooldown, cooldown.

net.minecraft.world.entity.ai.goal.targetclass46 linescommonextends LivingEntity>1.1 KB

API Surface (4)

int getCooldown()
void decrementCooldown()
boolean canUse()
void start()

Fields & Constants (3)

DEFAULT_COOLDOWN
cooldown
mustSee

Full Source

NearestHealableRaiderTargetGoal.java46 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.goal.target;
2
3
import net.minecraft.world.entity.LivingEntity;
4
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
5
import net.minecraft.world.entity.raid.Raider;
6
import org.jspecify.annotations.Nullable;
7
8
public class NearestHealableRaiderTargetGoal<T extends LivingEntity> extends NearestAttackableTargetGoal<T> {
9
	private static final int DEFAULT_COOLDOWN = 200;
10
	private int cooldown = 0;
11
12
	public NearestHealableRaiderTargetGoal(
13
		final Raider raider, final Class<T> targetType, final boolean mustSee, final TargetingConditions.@Nullable Selector subselector
14
	) {
15
		super(raider, targetType, 500, mustSee, false, subselector);
16
	}
17
18
	public int getCooldown() {
19
		return this.cooldown;
20
	}
21
22
	public void decrementCooldown() {
23
		this.cooldown--;
24
	}
25
26
	@Override
27
	public boolean canUse() {
28
		if (this.cooldown > 0 || !this.mob.getRandom().nextBoolean()) {
29
			return false;
30
		}
31
32
		if (!((Raider)this.mob).hasActiveRaid()) {
33
			return false;
34
		}
35
36
		this.findTarget();
37
		return this.target != null;
38
	}
39
40
	@Override
41
	public void start() {
42
		this.cooldown = reducedTickDelay(200);
43
		super.start();
44
	}
45
}
46

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