Home Commands Examples Getting Started With Scripts Global Keywords

LootParams

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.

script.zs
import crafttweaker.api.loot.LootParams;

Methods

script.zs
LootParams.addDynamicDrops(key as ResourceLocation, drop as Consumer<ItemStack>)
ParameterType
Parameter
key
Type
ResourceLocation
Parameter
drop
Type
Consumer<ItemStack>

Return Type: @org.openzen.zencode.java.ZenCodeType.Nullable T

script.zs
LootParams.getOptionalParameter<T : Object>(param as LootContextParam<T>) as @org.openzen.zencode.java.ZenCodeType.Nullable T
ParameterType
Parameter
param
Type
LootContextParam<T>
Parameter
T
Type
Object

Return Type: @org.openzen.zencode.java.ZenCodeType.Nullable T

script.zs
LootParams.getParamOrNull<T : Object>(param as LootContextParam<T>) as @org.openzen.zencode.java.ZenCodeType.Nullable T
ParameterType
Parameter
param
Type
LootContextParam<T>
Parameter
T
Type
Object

Return Type: T

script.zs
LootParams.getParameter<T : Object>(param as LootContextParam<T>) as T
ParameterType
Parameter
param
Type
LootContextParam<T>
Parameter
T
Type
Object

Return Type: boolean

script.zs
LootParams.hasParam<T : Object>($$0 as LootContextParam<T>) as boolean
ParameterType
Parameter
$$0
Type
LootContextParam<T>
Parameter
T
Type
Object

Properties

NameTypeHas GetterHas Setter
Name
level
Type
ServerLevel
Has Getter
true
Has Setter
false
Name
luck
Type
float
Has Getter
true
Has Setter
false