minecraft_25w45a_unobfuscated/net/minecraft/util/BoundedFloatFunction.java
2025-11-24 22:52:51 +03:00

63 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* it.unimi.dsi.fastutil.floats.Float2FloatFunction
*/
package net.minecraft.util;
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
import java.util.function.Function;
public interface BoundedFloatFunction<C> {
public static final BoundedFloatFunction<Float> IDENTITY = BoundedFloatFunction.createUnlimited(input -> input);
public float apply(C var1);
public float minValue();
public float maxValue();
public static BoundedFloatFunction<Float> createUnlimited(final Float2FloatFunction function) {
return new BoundedFloatFunction<Float>(){
@Override
public float apply(Float aFloat) {
return ((Float)function.apply((Object)aFloat)).floatValue();
}
@Override
public float minValue() {
return Float.NEGATIVE_INFINITY;
}
@Override
public float maxValue() {
return Float.POSITIVE_INFINITY;
}
};
}
default public <C2> BoundedFloatFunction<C2> comap(final Function<C2, C> function) {
final BoundedFloatFunction outer = this;
return new BoundedFloatFunction<C2>(this){
@Override
public float apply(C2 c2) {
return outer.apply(function.apply(c2));
}
@Override
public float minValue() {
return outer.minValue();
}
@Override
public float maxValue() {
return outer.maxValue();
}
};
}
}