Stop simulation when goal reached

This commit is contained in:
Brady 2023-06-26 18:37:06 -05:00
parent 04a5a1a620
commit 02fc62f1c4
No known key found for this signature in database
GPG Key ID: 73A788379A197567
1 changed files with 4 additions and 1 deletions

View File

@ -854,7 +854,7 @@ public final class ElytraBehavior extends Behavior implements IElytraBehavior, H
}
private List<Vec3d> simulate(final ITickableAimProcessor aimProcessor, final Vec3d goalDelta, final float pitch,
final int ticks, int ticksBoosted, final boolean ignoreLava) {
final int ticks, int ticksBoosted, final boolean ignoreLava) {
Vec3d delta = goalDelta;
Vec3d motion = ctx.playerMotion();
AxisAlignedBB hitbox = ctx.player().getEntityBoundingBox();
@ -865,6 +865,9 @@ public final class ElytraBehavior extends Behavior implements IElytraBehavior, H
if (MC_1_12_Collision_Fix.bonk(ctx, hitbox)) {
return null;
}
if (delta.lengthSquared() < 1) {
break;
}
final Rotation rotation = aimProcessor.nextRotation(
RotationUtils.calcRotationFromVec3d(Vec3d.ZERO, delta, ctx.playerRotations()).withPitch(pitch)
);