Record Class Range
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.Range
- All Implemented Interfaces:
net.minecraft.util.valueproviders.SampledFloat
public record Range(float min, float max)
extends Record
implements net.minecraft.util.valueproviders.SampledFloat
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloataverage()floatclamp(float value) floatdelta(float value) final booleanIndicates whether some other object is "equal to" this one.floatget(float delta) final inthashCode()Returns a hash code value for this object.booleanisSame()booleanisZero()floatmax()Returns the value of themaxrecord component.floatmin()Returns the value of theminrecord component.static Rangeof(float value) static Rangeof(float min, float max) static @Nullable RangeofTag(net.minecraft.nbt.Tag nbt) floatsample(net.minecraft.util.RandomSource random) toString()Returns a string representation of this record class.net.minecraft.nbt.TagtoTag()
-
Field Details
-
ZERO
-
ONE
-
FULL
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Range> STREAM_CODEC -
DATA_TYPE
-
-
Constructor Details
-
Range
public Range(float min, float max) Creates an instance of aRangerecord class.- Parameters:
min- the value for theminrecord componentmax- the value for themaxrecord component
-
-
Method Details
-
of
-
of
-
ofTag
-
toTag
public net.minecraft.nbt.Tag toTag() -
get
public float get(float delta) -
sample
public float sample(net.minecraft.util.RandomSource random) - Specified by:
samplein interfacenet.minecraft.util.valueproviders.SampledFloat
-
delta
public float delta(float value) -
average
public float average() -
toString
-
clamp
public float clamp(float value) -
isZero
public boolean isZero() -
isSame
public boolean isSame() -
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
min
public float min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
public float max()Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-