Interface IntProvider
- All Known Implementing Classes:
IntProvider.BiasedToBottom, IntProvider.Clamped, IntProvider.ClampedNormal, IntProvider.Constant, IntProvider.Trapezoid, IntProvider.Uniform, IntProvider.VeryBiasedToBottom, IntProvider.WeightedList
@MinecraftData
public sealed interface IntProvider
permits IntProvider.Constant, IntProvider.Uniform, IntProvider.BiasedToBottom, IntProvider.VeryBiasedToBottom, IntProvider.Trapezoid, 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 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 IntProvidertrapezoid(int min, int max, int plateau) Returns a provider within[min, max], the most likely around the middle.static IntProvideruniform(int minInclusive, int maxInclusive) Returns a provider picking uniformly within[minInclusive, maxInclusive].static IntProviderveryBiasedToBottom(int minInclusive, int maxInclusive) Returns a provider within[minInclusive, maxInclusive], weighted further towards the bottom thanbiasedToBottom(int, int).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
-
veryBiasedToBottom
@Contract(value="_, _ -> new", pure=true) static IntProvider veryBiasedToBottom(int minInclusive, int maxInclusive) Returns a provider within[minInclusive, maxInclusive], weighted further towards the bottom thanbiasedToBottom(int, int).- Parameters:
minInclusive- the minimum possible valuemaxInclusive- the maximum possible value- Returns:
- a provider within
[minInclusive, maxInclusive], weighted further towards the bottom thanbiasedToBottom(int, int)
-
trapezoid
@Contract(value="_, _, _ -> new", pure=true) static IntProvider trapezoid(int min, int max, int plateau) Returns a provider within[min, max], the most likely around the middle.- Parameters:
min- the minimum possible valuemax- the maximum possible valueplateau- the width of the middle range where every value is equally likely- Returns:
- a provider within
[min, max], the most likely around the middle
-
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, with a positive total weight- Returns:
- a provider picking randomly among
distribution, honoring each entry's weight
-