Interface IntProvider

All Known Implementing Classes:
IntProvider.BiasedToBottom, IntProvider.Clamped, IntProvider.ClampedNormal, IntProvider.Constant, IntProvider.Uniform, IntProvider.WeightedList

A value, or a random distribution of values, used by DimensionTypeDefinition.monsterSpawnLightLevel().
Since:
0.1.0
  • Method Details

    • constant

      @Contract(value="_ -> new", pure=true) static IntProvider constant(int value)
      Returns a provider always yielding value.
      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 value
      maxInclusive - 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 value
      maxInclusive - 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)
      Returns source, clamped to [minInclusive, maxInclusive].
      Parameters:
      minInclusive - the minimum allowed value
      maxInclusive - the maximum allowed value
      source - 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 distribution
      deviation - the deviation of the normal distribution
      minInclusive - the minimum allowed value
      maxInclusive - 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 among distribution, 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