/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.DataResult */ package net.minecraft.world.attribute; import com.mojang.serialization.DataResult; import net.minecraft.util.Mth; public interface AttributeRange { public static final AttributeRange UNIT_FLOAT = AttributeRange.ofFloat(0.0f, 1.0f); public static final AttributeRange NON_NEGATIVE_FLOAT = AttributeRange.ofFloat(0.0f, Float.POSITIVE_INFINITY); public static AttributeRange any() { return new AttributeRange(){ @Override public DataResult validate(Value value) { return DataResult.success(value); } @Override public Value sanitize(Value value) { return value; } }; } public static AttributeRange ofFloat(final float minValue, final float maxValue) { return new AttributeRange(){ @Override public DataResult validate(Float value) { if (value.floatValue() >= minValue && value.floatValue() <= maxValue) { return DataResult.success((Object)value); } return DataResult.error(() -> value + " is not in range [" + minValue + "; " + maxValue + "]"); } @Override public Float sanitize(Float value) { if (value.floatValue() >= minValue && value.floatValue() <= maxValue) { return value; } return Float.valueOf(Mth.clamp(value.floatValue(), minValue, maxValue)); } }; } public DataResult validate(Value var1); public Value sanitize(Value var1); }