Interface IntProvider
- All Superinterfaces:
Comparable<ValueProvider>, ValueProvider, Wrapper
- All Known Subinterfaces:
BiasedToBottomInt, ClampedInt, ClampedNormalInt, ConstantInt, TrapezoidInt, UniformInt, WeightedListInt
A provider of an integer value.
- Since:
- 2.3.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classIntProvider.IntProviderBuilder<T extends IntProvider, S extends IntProvider.IntProviderBuilder<T,S>> Common abstract builder for most int providers. -
Method Summary
Modifier and TypeMethodDescriptionstatic BiasedToBottomInt.BuilderCreates a new biased-to-bottom int builder.static BiasedToBottomIntbiasedToBottom(int min, int max) Creates a biased-to-bottom int provider.default ClampedIntclamp(int min, int max) Clamps the value to the given range.static ClampedInt.Builderclamped()Creates a new clamped int builder.static ClampedIntclamped(IntProvider source, int min, int max) Creates a clamped int provider.static ClampedNormalInt.BuilderCreates a new clamped normal int builder.static ClampedNormalIntclampedNormal(int min, int max, float mean, float deviation) Creates a new clamped normal int.static ConstantIntconstant(int value) Creates a constant int provider.static IntProviderReads a Minecraft int provider into a wrapper.default doublemax()The largest value this provider can yield, as a double.intThe largest value this provider can yield.default doublemin()The smallest value this provider can yield, as a double.intThe smallest value this provider can yield.static TrapezoidInt.BuilderCreates a new trapezoid int builder.static TrapezoidInttrapezoid(int min, int max, int plateau) Creates a trapezoidal int provider.static TrapezoidInttriangle(int range) A symmetric triangular distribution over [-minInclusive(),maxInclusive()].static UniformInt.Builderuniform()Creates a new uniform int builder.static UniformIntuniform(int min, int max) Creates a uniform int provider.static WeightedListInt.BuilderCreates a new weighted list int builder.static WeightedListIntweightedList(WeightedList<IntProvider> distribution) Creates a weighted list int provider.static ConstantIntzero()A constant int provider that always returns 0.Methods inherited from interface ValueProvider
compareToMethods inherited from interface Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
minInclusive
The smallest value this provider can yield.- Returns:
- the smallest value this provider can yield.
- Since:
- 2.3.0
-
maxInclusive
The largest value this provider can yield.- Returns:
- the largest value this provider can yield.
- Since:
- 2.3.0
-
clamp
Clamps the value to the given range.- Parameters:
min- the minimum valuemax- the maximum value- Returns:
- a clamped int provider
- Since:
- 3.0.0
-
constant
Creates a constant int provider.- Parameters:
value- the value to return- Returns:
- a constant int provider
- Since:
- 2.3.0
-
min
default double min()Description copied from interface:ValueProviderThe smallest value this provider can yield, as a double.- Specified by:
minin interfaceValueProvider- Returns:
- the smallest value this provider can yield
-
max
default double max()Description copied from interface:ValueProviderThe largest value this provider can yield, as a double.- Specified by:
maxin interfaceValueProvider- Returns:
- the largest value this provider can yield
-
uniform
Creates a uniform int provider.- Parameters:
min- min inclusivemax- max inclusive- Returns:
- a uniform int provider
- Since:
- 2.3.0
-
uniform
Creates a new uniform int builder.- Returns:
- a new uniform int builder
- Since:
- 3.0.0
-
biasedToBottom
Creates a biased-to-bottom int provider.- Parameters:
min- min inclusivemax- max inclusive- Returns:
- a biased-to-bottom int provider
- Since:
- 2.3.0
-
biasedToBottom
Creates a new biased-to-bottom int builder.- Returns:
- a new biased-to-bottom int builder
- Since:
- 3.0.0
-
clampedNormal
Creates a new clamped normal int.- Parameters:
min- min inclusivemax- max inclusivemean- mean of the normal distributiondeviation- deviation of the normal distribution- Returns:
- a new clamped normal int
- Since:
- 2.3.0
-
clampedNormal
Creates a new clamped normal int builder.- Returns:
- a new clamped normal int builder
- Since:
- 3.0.0
-
trapezoid
Creates a trapezoidal int provider.- Parameters:
min- min inclusivemax- max inclusiveplateau- the length of the range in the middle that has a uniform distribution- Returns:
- the trapezoid int provider
- Since:
- 2.3.0
-
triangle
A symmetric triangular distribution over [-minInclusive(),maxInclusive()].- Parameters:
range- the range of the triangular distribution- Returns:
- the trapezoid int provider
- Since:
- 2.3.0
-
trapezoid
Creates a new trapezoid int builder.- Returns:
- a new trapezoid int builder
- Since:
- 3.0.0
-
clamped
Creates a clamped int provider.- Parameters:
source- the source provider to clampmin- the minimum allowed valuemax- the maximum allowed value- Returns:
- a clamped int provider
- Since:
- 2.3.0
-
clamped
Creates a new clamped int builder.- Returns:
- a new clamped int builder
- Since:
- 3.0.0
-
weightedList
Creates a weighted list int provider.- Parameters:
distribution- the weighted pool of providers, which must not be empty- Returns:
- a weighted list int provider
- Since:
- 2.3.0
-
weightedList
Creates a new weighted list int builder.- Returns:
- a new weighted list int builder
- Since:
- 3.0.0
-
zero
A constant int provider that always returns 0.- Returns:
- a constant int provider that always returns 0
- Since:
- 3.0.0
-
decode
Reads a Minecraft int provider into a wrapper.- Parameters:
minecraftIntProvider- the int provider to read- Returns:
- the wrapper for it
- Since:
- 3.3.0
-