package net.minecraft.world.entity.ai.goal.target; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.raid.Raider; import org.jetbrains.annotations.Nullable; public class NearestHealableRaiderTargetGoal extends NearestAttackableTargetGoal { private static final int DEFAULT_COOLDOWN = 200; private int cooldown = 0; public NearestHealableRaiderTargetGoal(Raider raider, Class targetType, boolean mustSee, @Nullable TargetingConditions.Selector selector) { super(raider, targetType, 500, mustSee, false, selector); } public int getCooldown() { return this.cooldown; } public void decrementCooldown() { this.cooldown--; } @Override public boolean canUse() { if (this.cooldown > 0 || !this.mob.getRandom().nextBoolean()) { return false; } else if (!((Raider)this.mob).hasActiveRaid()) { return false; } else { this.findTarget(); return this.target != null; } } @Override public void start() { this.cooldown = reducedTickDelay(200); super.start(); } }