use of net.minecraft.entity.EntityDimensions in project lithium-fabric by CaffeineMC.
the class FleeEntityGoalMixin method init.
@Inject(method = "<init>(Lnet/minecraft/entity/mob/PathAwareEntity;Ljava/lang/Class;Ljava/util/function/Predicate;FDDLjava/util/function/Predicate;)V", at = @At("RETURN"))
private void init(PathAwareEntity mob, Class<T> fleeFromType, Predicate<LivingEntity> predicate, float distance, double slowSpeed, double fastSpeed, Predicate<LivingEntity> predicate2, CallbackInfo ci) {
EntityDimensions dimensions = this.mob.getType().getDimensions();
double adjustedRange = dimensions.width * 0.5D + this.fleeDistance + 2D;
int horizontalRange = MathHelper.ceil(adjustedRange);
this.tracker = new NearbyEntityTracker<>(fleeFromType, mob, new Vec3i(horizontalRange, MathHelper.ceil(dimensions.height + 3 + 2), horizontalRange));
((NearbyEntityListenerProvider) mob).addListener(this.tracker);
}
use of net.minecraft.entity.EntityDimensions in project lithium-fabric by CaffeineMC.
the class LookAtEntityGoalMixin method init.
@Inject(method = "<init>(Lnet/minecraft/entity/mob/MobEntity;Ljava/lang/Class;FFZ)V", at = @At("RETURN"))
private void init(MobEntity mob, Class<? extends LivingEntity> targetType, float range, float chance, boolean b, CallbackInfo ci) {
EntityDimensions dimensions = this.mob.getType().getDimensions();
double adjustedRange = dimensions.width * 0.5D + this.range + 2D;
int horizontalRange = MathHelper.ceil(adjustedRange);
this.tracker = new NearbyEntityTracker<>(targetType, mob, new Vec3i(horizontalRange, MathHelper.ceil(dimensions.height + 3 + 2), horizontalRange));
((NearbyEntityListenerProvider) mob).addListener(this.tracker);
}
Aggregations