LootContextBuilder
Link to lootcontextbuilder
Creates a new LootContext using a builder style pattern.
Importing the class
Link to 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 Copyimport crafttweaker.api.loot.LootContextBuilder;
Static Methods
Link to static-methods
Name: copy
Return Type: LootContextBuilder
ZenScript CopyLootContextBuilder.copy(context as LootContext) as LootContextBuilder
Parameter | Type |
---|---|
Parameter context | Type LootContext |
Name: create
Creates a new builder with the given level.
Returns: A new builder.
Return Type: LootContextBuilder
ZenScript CopyLootContextBuilder.create(params as LootParams) as LootContextBuilder
Parameter | Type | Description |
---|---|---|
Parameter params | Type LootParams | Description The params the loot will be rolled with. |
Methods
Link to methods
Name: create
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
Return Type: LootContext
ZenScript CopyLootContextBuilder.create(key as ResourceLocation) as LootContext
Parameter | Type | Description | Optional |
---|---|---|---|
Parameter key | Type ResourceLocation | Description An optional random key used when no seed is provided. | Optional true |
Name: getLevel
Gets the level that this builder uses.
Returns: The level that this builder uses.
Return Type: ServerLevel
ZenScript Copy// LootContextBuilder.getLevel() as ServerLevel
new LootContextBuilder(level).getLevel();
Name: withOptionalRandomSeed
Supplies a seed to be passed into a new Random.
Returns: This builder for chaining purposes.
Return Type: LootContextBuilder
ZenScript Copy// LootContextBuilder.withOptionalRandomSeed(seed as long) as LootContextBuilder
new LootContextBuilder(level).withOptionalRandomSeed(1);
Parameter | Type | Description | Optional | Default Value |
---|---|---|---|---|
Parameter seed | Type long | Description The optional seed to use, defaults to 0 . | Optional true | Default Value 0 |
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name level | Type ServerLevel | Has Getter true | Has Setter false | Description Gets the level that this builder uses. |