CommonLootModifiers
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
Description
Holds a set of implementations ofILootModifier
of common usage.These can be used freely instead of rewriting the same code more than once. They are also guaranteed to behave correctly.
Members
IItemStack
to the drops.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
to the drops.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
s to the drops, modifying their count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #addAll(IItemStack...)
.
The fortune modifier is applied separately for each IItemStack
.
The formula used is based on the binomial_with_bonus_count
formula used by vanilla. In this case, the value of extra
is added to the current tool's enchantment level; that determines the amount of times the randomness will roll. Every roll that is higher than p
will add one element to the stack. This is the formula used by potatoes and carrots to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
extra: int
Type: int
- An extra value that will be added to the tool's enchantment level. p: float
Type: float
- The probability of the binomial distribution, between 0.0 and 1.0 (both exclusive).
Return Type:
ILootModifier
Percentaged
s to the drops, according to the specified chances.The chance will be computed on each modifier roll, and independently for each of the given stacks.
Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
s to the drops, modifying their count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #addAll(IItemStack...)
.
The fortune modifier is applied separately for each IItemStack
.
The formula used is based on the ore_drops
formula used by vanilla, which multiplies the stack's original count by a random number between 1 and the tool's enchantment level + 1. This is the formula used by all vanilla ores to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
s to the drops, modifying their count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #addAll(IItemStack...)
.
The fortune modifier is applied separately for each IItemStack
.
The formula used is based on the uniform_bonus_count
formula used by vanilla. In this case, the enchantment level is multiplied by multiplier
and a random number is extracted between 0 and the result. This number is then added to the original's stack count. This is the formula used by redstone ore and glowstone to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
multiplier: int
Type: int
- A multiplier that will be used in conjunction with the enchantment's level.
Return Type:
ILootModifier
IItemStack
to the drops, modifying its count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #add(IItemStack)
.
The formula used is based on the binomial_with_bonus_count
formula used by vanilla. In this case, the value of extra
is added to the current tool's enchantment level; that determines the amount of times the randomness will roll. Every roll that is higher than p
will add one element to the stack. This is the formula used by potatoes and carrots to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
extra: int
Type: int
- An extra value that will be added to the tool's enchantment level. p: float
Type: float
- The probability of the binomial distribution, between 0.0 and 1.0 (both exclusive).
Return Type:
ILootModifier
Percentaged
to the drops, according to the specified chances.The chance will be computed on each modifier roll.
Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
to the drops, modifying its count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #add(IItemStack)
.
The formula used is based on the ore_drops
formula used by vanilla, which multiplies the stack's original count by a random number between 1 and the tool's enchantment level + 1. This is the formula used by all vanilla ores to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IItemStack
to the drops, with an amount chosen randomly between the given bounds.Any original stack size given to this method is ignored; if an addition behavior is desired (as in random chance on top of the original stack size), a combining loot modifier should be used instead.
Returns: An ILootModifier
that carries out the operation.
Parameters:
min: int
Type: int
- The minimum amount that this stack can be. max: int
Type: int
- The maximum amount that this stack can be.
Return Type:
ILootModifier
IItemStack
to the drops, modifying its count based on the level of the given Enchantment
on the tool used, if available. In case no tool is used to obtain the stack, then this loot modifier behaves exactly like #add(IItemStack)
.
The formula used is based on the uniform_bonus_count
formula used by vanilla. In this case, the enchantment level is multiplied by multiplier
and a random number is extracted between 0 and the result. This number is then added to the original's stack count. This is the formula used by redstone ore and glowstone to determine their drop count.
Returns: An ILootModifier
that carries out the operation.
Parameters:
multiplier: int
Type: int
- A multiplier that will be used in conjunction with the enchantment's level.
Return Type:
ILootModifier
ILootModifier
s to be executed one after the other.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
ILootModifier
s together after having cleaned the original loot.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
Returns: An ILootModifier
that carries out the operation.
Return Type:
ILootModifier
IIngredient
from the drops.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IIngredient
s from the drops.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IIngredient
from the drops, until the maximum amount of removals is reached.For example, assume the loot drops 2 carrots, 3 potatoes, and 1 iron ingot and that this loot modifier has been asked to remove 4 edible items. The result of applying the loot modifier will be to remove the 2 carrots and 2 out of the 3 potatoes, resulting in a final drop list of 1 iron ingot and 1 potato.
Returns: An ILootModifier
that carries out the operation.
Parameters:
target: IIngredientWithAmount
Type: IIngredientWithAmount
- The IIngredient
to remove along with its quantity.
Return Type:
ILootModifier
IIngredient
s from the drops, until the maximum amount of removals is reached.For example, assume the loot drops 2 carrots, 3 potatoes, and 1 iron ingot and that this loot modifier has been asked to remove 4 edible items. The result of applying the loot modifier will be to remove the 2 carrots and 2 out of the 3 potatoes, resulting in a final drop list of 1 iron ingot and 1 potato.
Returns: An ILootModifier
that carries out the operation.
Parameters:
targets: IIngredientWithAmount[]
Type: IIngredientWithAmount[]
- The IIngredient
s to remove along with their quantity.
Return Type:
ILootModifier
IItemStack
s with the replacement IItemStack
s, proportionally.As an example, if the loot drops 5 carrots and this loot modifier runs with 2 carrots as the key of a pair and 1 potato as the corresponding value, the loot will be modified to 2 potatoes and 1 carrot. This happens because every 2-carrot stack will be actively replaced by a 1-potato stack, without exceptions.
This loot modifier acts differently than
#replaceAllWith(Map)
, where a simpler approach is used.Returns: An ILootModifier
that carries out the operation.
Parameters:
replacementMap: IItemStack[IIngredientWithAmount]
Type: IItemStack[IIngredientWithAmount]
- A map of key-value pairs dictating the target to replace along with their replacement.
Return Type:
ILootModifier
IIngredient
s with their corresponding replacement IItemStack
.In this case, a simple matching procedure is used, where every stack that matches the key of the pair is replaced by the corresponding value, without considering stack size. If stack size is to be preserved, refer to
#replaceAllStacksWith(Map)
.Returns: An ILootModifier
that carries out the operation.
Parameters:
replacementMap: IItemStack[IIngredient]
Type: IItemStack[IIngredient]
- A map of key-value pairs dictating the target to replace along with their replacement.
Return Type:
ILootModifier
IIngredientWithAmount
with the replacement IItemStack
, proportionally.As an example, if the loot drops 5 carrots and this loot modifier runs with 2 carrots as the
target
and 1 potato as the
replacement
, the loot will be modified to 2 potatoes and 1 carrot. This happens because every 2-carrot stack will be actively replaced by a 1-potato stack, without exceptions.This loot modifier acts differently than
IItemStack)
, where a simpler approach is used.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier
IIngredient
with the replacement IItemStack
.In this case, a simple matching procedure is used, where every stack that matches the given
target
is replaced by the
replacement
without considering stack size. If stack size is to be preserved, refer to IItemStack)
.Returns: An ILootModifier
that carries out the operation.
Parameters:
Return Type:
ILootModifier