Class DropRateModifier

java.lang.Object
com.github.crashdemons.miningtrophies.modifiers.DropRateModifier

public class DropRateModifier extends Object
A modifier for the droprate including type and value information
Since:
5.2.16-SNAPSHOT
Author:
crashdemons (crashenator at gmail.com)
  • Constructor Details

    • DropRateModifier

      public DropRateModifier(DropRateModifierType type, double value, int level)
      Constructs a modifier with a value that is multiplied by a level of effectiveness
      Parameters:
      type - the type of modifier
      value - the base value of the modifier
      level - the level to be multiplied against the modifier
    • DropRateModifier

      public DropRateModifier(DropRateModifierType type, double value)
      Constructs a modifier of a given type and value
      Parameters:
      type - the type of modifier
      value - the value of the modifier
  • Method Details

    • getLevel

      public int getLevel()
      Gets the effectiveness level of the modifier. Note: this only provides a useful result with modifiers of type ADD_MULTIPLE_PER_LEVEL, otherwise it will return 1.
      Returns:
      the effectiveness level of the modifier, or 1.
    • getType

      public DropRateModifierType getType()
      Gets the type of modifier
      Returns:
      the type of modifier
    • getValue

      public double getValue()
      Returns the value or rate applied by the modifier
      Returns:
      the value or rate applied by the modifier
    • getAdditiveMultiplierValue

      public Double getAdditiveMultiplierValue()
      Converts the modifier into an equivalent add-multiple value where droprate*(1+newvalue) is equivalent to the current modifier effect. Note: only other multipliers can be converted.
      Returns:
      the equivalent additive multiplier value, or null.
    • getMultiplierValue

      public Double getMultiplierValue()
      Converts the modifier value to a multiplier (1.0=no effect) if possible. Note: only additive multipliers can be converted to multipliers.
      Returns:
      the equivalent multiplier value, or null.
    • apply

      public double apply(double droprate)
      Apply the droprate modifier to the droprate value
      Parameters:
      droprate - a droprate between 0 (0% chance) and 1.0 (100% chance). Higher values also indicate 100% chance.
      Returns:
      the effective droprate after modification