Record Class ClampedInt
java.lang.Object
java.lang.Record
net.minecraft.util.valueproviders.ClampedInt
- All Implemented Interfaces:
IntProvider
public record ClampedInt(IntProvider source, int minInclusive, int maxInclusive)
extends Record
implements IntProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MapCodec<ClampedInt> private final intThe field for themaxInclusiverecord component.private final intThe field for theminInclusiverecord component.private final IntProviderThe field for thesourcerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionClampedInt(IntProvider source, int minInclusive, int maxInclusive) Creates an instance of aClampedIntrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxInclusiverecord component.intReturns the value of theminInclusiverecord component.static ClampedIntof(IntProvider source, int minInclusive, int maxInclusive) intsample(RandomSource random) source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
source
The field for thesourcerecord component. -
minInclusive
private final int minInclusiveThe field for theminInclusiverecord component. -
maxInclusive
private final int maxInclusiveThe field for themaxInclusiverecord component. -
MAP_CODEC
-
-
Constructor Details
-
ClampedInt
Creates an instance of aClampedIntrecord class.- Parameters:
source- the value for thesourcerecord componentminInclusive- the value for theminInclusiverecord componentmaxInclusive- the value for themaxInclusiverecord component
-
-
Method Details
-
of
-
sample
- Specified by:
samplein interfaceIntProvider
-
minInclusive
public int minInclusive()Returns the value of theminInclusiverecord component.- Specified by:
minInclusivein interfaceIntProvider- Returns:
- the value of the
minInclusiverecord component
-
maxInclusive
public int maxInclusive()Returns the value of themaxInclusiverecord component.- Specified by:
maxInclusivein interfaceIntProvider- Returns:
- the value of the
maxInclusiverecord component
-
codec
- Specified by:
codecin interfaceIntProvider
-
toString
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-