25 lines
980 B
Java
25 lines
980 B
Java
|
package net.minecraft.world.entity.ai.goal.target;
|
||
|
|
||
|
import javax.annotation.Nullable;
|
||
|
import net.minecraft.world.entity.LivingEntity;
|
||
|
import net.minecraft.world.entity.TamableAnimal;
|
||
|
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||
|
|
||
|
public class NonTameRandomTargetGoal<T extends LivingEntity> extends NearestAttackableTargetGoal<T> {
|
||
|
private final TamableAnimal tamableMob;
|
||
|
|
||
|
public NonTameRandomTargetGoal(TamableAnimal p_26097_, Class<T> p_26098_, boolean p_26099_, @Nullable TargetingConditions.Selector p_361608_) {
|
||
|
super(p_26097_, p_26098_, 10, p_26099_, false, p_361608_);
|
||
|
this.tamableMob = p_26097_;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean canUse() {
|
||
|
return !this.tamableMob.isTame() && super.canUse();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean canContinueToUse() {
|
||
|
return this.targetConditions != null ? this.targetConditions.test(getServerLevel(this.mob), this.mob, this.target) : super.canContinueToUse();
|
||
|
}
|
||
|
}
|