Class IntRange
java.lang.Object
net.minecraft.world.level.storage.loot.IntRange
A possibly unbounded range of integers based on
LootContext. Minimum and maximum are given in the form of NumberProviders.
Minimum and maximum are both optional. If given, they are both inclusive.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<IntRange> private final IntRange.IntLimiterprivate final NumberProviderprivate final NumberProviderprivate final IntRange.IntCheckerprivate static final com.mojang.serialization.Codec<IntRange> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIntRange(Optional<NumberProvider> min, Optional<NumberProvider> max) privateIntRange(NumberProvider min, NumberProvider max) -
Method Summary
Modifier and TypeMethodDescriptionintclamp(LootContext lootContext, int value) Clamp the given value so that it falls within this IntRange.static IntRangeexact(int exactValue) Create an IntRange that contains only exactly the given value.Set<LootContextParam<?>> static IntRangelowerBound(int min) Create an IntRange with the given minimum (inclusive) and no upper bound.static IntRangerange(int min, int max) Create an IntRange that ranges frommintomax, both inclusive.booleantest(LootContext lootContext, int value) Check whether the given value falls within this IntRange.private OptionalIntstatic IntRangeupperBound(int max) Create an IntRange with the given maximum (inclusive) and no lower bound.
-
Field Details
-
RECORD_CODEC
-
CODEC
-
min
-
max
-
limiter
-
predicate
-
-
Constructor Details
-
IntRange
-
IntRange
-
-
Method Details
-
getReferencedContextParams
-
exact
Create an IntRange that contains only exactly the given value. -
range
Create an IntRange that ranges frommintomax, both inclusive. -
lowerBound
Create an IntRange with the given minimum (inclusive) and no upper bound. -
upperBound
Create an IntRange with the given maximum (inclusive) and no lower bound. -
clamp
Clamp the given value so that it falls within this IntRange. -
test
Check whether the given value falls within this IntRange. -
unpackExact
-