LootContextBuilder
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.
import crafttweaker.api.loot.LootContextBuilder;Description
Creates a newLootContext using a builder style pattern. Members
static copy(context as LootContext) as Builder
LootContextBuilder.copy(myLootContext);Parameters:
context: LootContext Type: LootContext
Return Type:
LootContextBuilder
static create(params as LootParams) as Builder
Creates a new builder with the given level.script.zs
Returns: A new builder.
LootContextBuilder.create(myLootParams);Parameters:
Return Type:
LootContextBuilder
create(key as ResourceLocation = null) as LootContext
Creates a new
script.zs
LootContext with the given LootContextParamSet. The given LootContextParamSet is used to determine what values are required for the context to be used.
Returns: a new LootContext
new LootContextBuilder(level).create(myResourceLocation);Parameters:
key: ResourceLocation (optional) Type: ResourceLocation
- An optional random key used when no seed is provided.
Default Value: null
Return Type:
LootContext
Getter
Gets the level that this builder uses.script.zs
// Builder.level as ServerLevelnew LootContextBuilder(level).level
Return Type:
ServerLevel
level() as ServerLevel
Gets the level that this builder uses.script.zs
Returns: The level that this builder uses.
new LootContextBuilder(level).level();
Return Type:
ServerLevel
withOptionalRandomSeed(seed as long = 0) as Builder
Supplies a seed to be passed into a new script.zs
Random.Returns: This builder for chaining purposes.
new LootContextBuilder(level).withOptionalRandomSeed(1);Parameters:
seed: long (optional) Type: long
- The optional seed to use, defaults to 0.
Default Value: 0
Return Type:
LootContextBuilder