Interface IntProvider
- All Known Implementing Classes:
IntProvider.BiasedToBottom, IntProvider.Clamped, IntProvider.ClampedNormal, IntProvider.Constant, IntProvider.Uniform, IntProvider.WeightedList
public sealed interface IntProvider
permits IntProvider.Constant, IntProvider.Uniform, IntProvider.BiasedToBottom, IntProvider.Clamped, IntProvider.ClampedNormal, IntProvider.WeightedList
A value, or a random distribution of values, used by
DimensionTypeDefinition.monsterSpawnLightLevel().- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic IntProviderbiasedToBottom(int minInclusive, int maxInclusive) Returns a provider within[minInclusive, maxInclusive], weighted towards the bottom.static IntProviderclamped(int minInclusive, int maxInclusive, IntProvider source) Returnssource, clamped to[minInclusive, maxInclusive].static IntProviderclampedNormal(float mean, float deviation, int minInclusive, int maxInclusive) Returns a provider following a normal distribution, clamped to[minInclusive, maxInclusive].static IntProviderconstant(int value) Returns a provider always yieldingvalue.static IntProvideruniform(int minInclusive, int maxInclusive) Returns a provider picking uniformly within[minInclusive, maxInclusive].static IntProviderweightedList(List<IntProvider.WeightedList.Entry> distribution) Returns a provider picking randomly amongdistribution, honoring each entry's weight.
-
Method Details
-
constant
Returns a provider always yieldingvalue.- Parameters:
value- the constant value- Returns:
- a provider always yielding
value
-
uniform
@Contract(value="_, _ -> new", pure=true) static IntProvider uniform(int minInclusive, int maxInclusive) Returns a provider picking uniformly within[minInclusive, maxInclusive].- Parameters:
minInclusive- the minimum possible valuemaxInclusive- the maximum possible value- Returns:
- a provider picking uniformly within
[minInclusive, maxInclusive]
-
biasedToBottom
@Contract(value="_, _ -> new", pure=true) static IntProvider biasedToBottom(int minInclusive, int maxInclusive) Returns a provider within[minInclusive, maxInclusive], weighted towards the bottom.- Parameters:
minInclusive- the minimum possible valuemaxInclusive- the maximum possible value- Returns:
- a provider within
[minInclusive, maxInclusive], weighted towards the bottom
-
clamped
@Contract(value="_, _, _ -> new", pure=true) static IntProvider clamped(int minInclusive, int maxInclusive, IntProvider source) Returnssource, clamped to[minInclusive, maxInclusive].- Parameters:
minInclusive- the minimum allowed valuemaxInclusive- the maximum allowed valuesource- the provider being clamped- Returns:
source, clamped to[minInclusive, maxInclusive]
-
clampedNormal
@Contract(value="_, _, _, _ -> new", pure=true) static IntProvider clampedNormal(float mean, float deviation, int minInclusive, int maxInclusive) Returns a provider following a normal distribution, clamped to[minInclusive, maxInclusive].- Parameters:
mean- the mean of the normal distributiondeviation- the deviation of the normal distributionminInclusive- the minimum allowed valuemaxInclusive- the maximum allowed value- Returns:
- a provider following a normal distribution, clamped to
[minInclusive, maxInclusive]
-
weightedList
@Contract(value="_ -> new", pure=true) static IntProvider weightedList(List<IntProvider.WeightedList.Entry> distribution) Returns a provider picking randomly amongdistribution, honoring each entry's weight.- Parameters:
distribution- the pool to pick from, never empty- Returns:
- a provider picking randomly among
distribution, honoring each entry's weight
-