CommonLootModifiers

Holds a set of implementations of ILootModifier of common usage.

These can be used freely instead of rewriting the same code more than once. They are also guaranteed to behave correctly.

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.loot.modifiers.CommonLootModifiers;

Methods

add

Adds the given IItemStack to the drops.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.add(stack as IItemStack) as ILootModifier
ParameterTypeDescription
stackIItemStackThe stack to add

addAll

Adds all the given IItemStack to the drops.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.addAll(stacks as IItemStack[]) as ILootModifier
ParameterTypeDescription
stacksIItemStack[]The stacks to add

clearLoot

Clears the entire drop list.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.clearLoot() as ILootModifier
CommonLootModifiers.clearLoot();

remove

Removes every instance of the targeted IIngredient from the drops.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.remove(target as IIngredient) as ILootModifier
ParameterTypeDescription
targetIIngredientThe IIngredient to remove.

removeAll

Removes every instance of all the targeted IIngredients from the drops.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.removeAll(targets as IIngredient[]) as ILootModifier
ParameterTypeDescription
targetsIIngredient[]The IIngredients to remove.

replaceAllWith

Replaces every instance of the targeted IIngredients with their corresponding replacement IItemStack.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.replaceAllWith(replacementMap as IItemStack[IIngredient]) as ILootModifier
ParameterTypeDescription
replacementMapIItemStack[IIngredient]A map of key-value pairs dictating the target to replace along with their replacement.

replaceWith

Replaces every instance of the targeted IIngredient with the replacement IItemStack.

Returns: An ILootModifier that carries out the operation. Return Type: ILootModifier

ZenScript
Copy
CommonLootModifiers.replaceWith(target as IIngredient, replacement as IItemStack) as ILootModifier
ParameterTypeDescription
targetIIngredientThe target to replace.
replacementIItemStackThe replacement to use.