Class DropRateModifier
java.lang.Object
com.github.crashdemons.miningtrophies.modifiers.DropRateModifier
A modifier for the droprate including type and value information
- Since:
- 5.2.16-SNAPSHOT
- Author:
- crashdemons (crashenator at gmail.com)
-
Constructor Summary
ConstructorDescriptionDropRateModifier
(DropRateModifierType type, double value) Constructs a modifier of a given type and valueDropRateModifier
(DropRateModifierType type, double value, int level) Constructs a modifier with a value that is multiplied by a level of effectiveness -
Method Summary
Modifier and TypeMethodDescriptiondouble
apply
(double droprate) Apply the droprate modifier to the droprate valueConverts the modifier into an equivalent add-multiple value where droprate*(1+newvalue) is equivalent to the current modifier effect.int
getLevel()
Gets the effectiveness level of the modifier.Converts the modifier value to a multiplier (1.0=no effect) if possible.getType()
Gets the type of modifierdouble
getValue()
Returns the value or rate applied by the modifier
-
Constructor Details
-
DropRateModifier
Constructs a modifier with a value that is multiplied by a level of effectiveness- Parameters:
type
- the type of modifiervalue
- the base value of the modifierlevel
- the level to be multiplied against the modifier
-
DropRateModifier
Constructs a modifier of a given type and value- Parameters:
type
- the type of modifiervalue
- 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
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
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
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
-