package net.minecraft.util; public class SmoothDouble { private double targetValue; private double remainingValue; private double lastAmount; public double getNewDeltaValue(double input, double multiplier) { this.targetValue += input; double d = this.targetValue - this.remainingValue; double e = Mth.lerp(0.5, this.lastAmount, d); double f = Math.signum(d); if (f * d > f * this.lastAmount) { d = e; } this.lastAmount = e; this.remainingValue += d * multiplier; return d * multiplier; } public void reset() { this.targetValue = 0.0; this.remainingValue = 0.0; this.lastAmount = 0.0; } }