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 NumberProvider
s.
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.IntLimiter
private final NumberProvider
private final NumberProvider
private final IntRange.IntChecker
private static final com.mojang.serialization.Codec
<IntRange> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
IntRange
(Optional<NumberProvider> p_299273_, Optional<NumberProvider> p_298799_) private
IntRange
(NumberProvider pMin, NumberProvider pMax) -
Method Summary
Modifier and TypeMethodDescriptionint
clamp
(LootContext pLootContext, int pValue) Clamp the given value so that it falls within this IntRange.static IntRange
exact
(int p_165010_) Create an IntRange that contains only exactly the given value.Set
<LootContextParam<?>> static IntRange
lowerBound
(int pMin) Create an IntRange with the given minimum (inclusive) and no upper bound.static IntRange
range
(int pMin, int pMax) Create an IntRange that ranges frommin
tomax
, both inclusive.boolean
test
(LootContext pLootContext, int pValue) Check whether the given value falls within this IntRange.private OptionalInt
static IntRange
upperBound
(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 frommin
tomax
, 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
-