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> p_299273_, Optional<NumberProvider> p_298799_) privateIntRange(NumberProvider pMin, NumberProvider pMax) -
Method Summary
Modifier and TypeMethodDescriptionintclamp(LootContext pLootContext, int pValue) Clamp the given value so that it falls within this IntRange.static IntRangeexact(int p_165010_) Create an IntRange that contains only exactly the given value.Set<LootContextParam<?>> static IntRangelowerBound(int pMin) Create an IntRange with the given minimum (inclusive) and no upper bound.static IntRangerange(int pMin, int pMax) Create an IntRange that ranges frommintomax, both inclusive.booleantest(LootContext pLootContext, int pValue) Check whether the given value falls within this IntRange.private OptionalIntstatic IntRangeupperBound(int pMax) 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
-