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.
Description
Creates a newLootContext
using a builder style pattern. Members
static copy(context as LootContext) as Builder
Parameters:
context: LootContext
Type: LootContext
Return Type:
LootContextBuilder
static create(params as LootParams) as Builder
Creates a new builder with the given level.
Returns: A new builder.
Parameters:
Return Type:
LootContextBuilder
create(key as ResourceLocation = null) as LootContext
Creates a new
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
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.
Return Type:
ServerLevel
level() as ServerLevel
Gets the level that this builder uses.
Returns: The level that this builder uses.
Return Type:
ServerLevel
withOptionalRandomSeed(seed as long = 0) as Builder
Supplies a seed to be passed into a new
Random
.Returns: This builder for chaining purposes.
Parameters:
seed: long
(optional) Type: long
- The optional seed to use, defaults to 0
.
Default Value: 0
Return Type:
LootContextBuilder