From b7c300bddfe423c6f84ab4a068e088645e92b032 Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 28 Jun 2022 16:56:29 +0200 Subject: [PATCH] Remove the unneccessary fallDistance field --- .../sound/generator/TerrestrialStepSoundGenerator.java | 9 ++------- .../sound/generator/WingedStepSoundGenerator.java | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/generator/TerrestrialStepSoundGenerator.java b/src/main/java/eu/ha3/presencefootsteps/sound/generator/TerrestrialStepSoundGenerator.java index 5cc3b2d3..6427b625 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/generator/TerrestrialStepSoundGenerator.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/generator/TerrestrialStepSoundGenerator.java @@ -31,7 +31,6 @@ class TerrestrialStepSoundGenerator implements StepSoundGenerator { // Airborne protected boolean isAirborne; - protected float fallDistance; protected float lastReference; protected boolean isImmobile; @@ -165,7 +164,6 @@ protected void simulateFootsteps(LivingEntity ply) { } dwmYChange = distanceReference; - } else { distance = variator.DISTANCE_HUMAN; } @@ -189,7 +187,7 @@ protected void simulateFootsteps(LivingEntity ply) { } } - public final void produceStep(LivingEntity ply, State event) { + public final void produceStep(LivingEntity ply, @Nullable State event) { produceStep(ply, event, 0d); } @@ -224,9 +222,6 @@ protected void simulateAirborne(LivingEntity ply) { isAirborne = !isAirborne; simulateJumpingLanding(ply); } - if (isAirborne) { - fallDistance = ply.fallDistance; - } } protected boolean isJumping(LivingEntity ply) { @@ -268,7 +263,7 @@ protected void simulateJumping(LivingEntity ply) { } protected void simulateLanding(LivingEntity ply) { - if (fallDistance > variator.LAND_HARD_DISTANCE_MIN) { + if (ply.fallDistance > variator.LAND_HARD_DISTANCE_MIN) { playMultifoot(ply, getOffsetMinus(ply), State.LAND); // Always assume the player lands on their two feet // Do not toggle foot: diff --git a/src/main/java/eu/ha3/presencefootsteps/sound/generator/WingedStepSoundGenerator.java b/src/main/java/eu/ha3/presencefootsteps/sound/generator/WingedStepSoundGenerator.java index a7151286..6b9d6087 100644 --- a/src/main/java/eu/ha3/presencefootsteps/sound/generator/WingedStepSoundGenerator.java +++ b/src/main/java/eu/ha3/presencefootsteps/sound/generator/WingedStepSoundGenerator.java @@ -88,13 +88,13 @@ protected void simulateJumpingLanding(LivingEntity ply) { nextFlapTime = now + variator.WING_JUMPING_REST_TIME; } - boolean hugeLanding = !isAirborne && fallDistance > variator.HUGEFALL_LANDING_DISTANCE_MIN; + boolean hugeLanding = !isAirborne && ply.fallDistance > variator.HUGEFALL_LANDING_DISTANCE_MIN; boolean speedingJumpStateChange = speed > variator.MIN_MOTION_HOR; if (hugeLanding || speedingJumpStateChange) { if (!isAirborne) { float volume = speedingJumpStateChange ? 2 - : MathUtil.scalex(fallDistance, variator.HUGEFALL_LANDING_DISTANCE_MIN, variator.HUGEFALL_LANDING_DISTANCE_MAX); + : MathUtil.scalex(ply.fallDistance, variator.HUGEFALL_LANDING_DISTANCE_MIN, variator.HUGEFALL_LANDING_DISTANCE_MAX); acoustics.playAcoustic(ply, "_SWIFT", State.LAND, Options.singular("gliding_volume", volume)); } else { acoustics.playAcoustic(ply, "_SWIFT", State.JUMP, Options.EMPTY);