2025-11-24 22:52:51 +03:00

39 lines
1000 B
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.world.attribute;
import net.minecraft.util.ARGB;
import net.minecraft.util.Mth;
public interface LerpFunction<T> {
public static LerpFunction<Float> ofFloat() {
return Mth::lerp;
}
public static LerpFunction<Float> ofDegrees(float maxDelta) {
return (alpha, from, to) -> {
float delta = Mth.wrapDegrees(to.floatValue() - from.floatValue());
if (Math.abs(delta) >= maxDelta) {
return to;
}
return Float.valueOf(from.floatValue() + alpha * delta);
};
}
public static <T> LerpFunction<T> ofConstant() {
return (alpha, from, to) -> from;
}
public static <T> LerpFunction<T> ofStep(float threshold) {
return (alpha, from, to) -> alpha >= threshold ? to : from;
}
public static LerpFunction<Integer> ofColor() {
return ARGB::srgbLerp;
}
public T apply(float var1, T var2, T var3);
}