Class ExpandLootContextBuilder
java.lang.Object
com.blamejared.crafttweaker.natives.loot.ExpandLootContextBuilder
Creates a new
LootContext using a builder style pattern.- DocParam:
- this new LootContextBuilder(level)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.level.storage.loot.LootContext.Buildercopy(net.minecraft.world.level.storage.loot.LootContext context) static net.minecraft.world.level.storage.loot.LootContext.Buildercreate(net.minecraft.server.level.ServerLevel level) Creates a new builder with the given level.static net.minecraft.world.level.storage.loot.LootContextcreate(net.minecraft.world.level.storage.loot.LootContext.Builder internal, net.minecraft.world.level.storage.loot.parameters.LootContextParamSet contextParamSet) Creates a newLootContextwith the givenLootContextParamSet.static net.minecraft.server.level.ServerLevelgetLevel(net.minecraft.world.level.storage.loot.LootContext.Builder internal) Gets the level that this builder uses.static <T> TgetOptionalParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam) Gets the provided value of the optional parameter.static <T> TgetParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam) Gets the provided value of the parameter.static net.minecraft.world.level.storage.loot.LootContext.BuilderwithLuck(net.minecraft.world.level.storage.loot.LootContext.Builder internal, float luck) Provides the given luck value to the context.static <T> net.minecraft.world.level.storage.loot.LootContext.BuilderwithOptionalParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam, T actor) Provides an optional parameter to this builder.static net.minecraft.world.level.storage.loot.LootContext.BuilderwithOptionalRandomSeed(net.minecraft.world.level.storage.loot.LootContext.Builder internal, long seed) Supplies a seed to be passed into a newRandom.static net.minecraft.world.level.storage.loot.LootContext.BuilderwithOptionalRandomSeed(net.minecraft.world.level.storage.loot.LootContext.Builder internal, long seed, Random random) static <T> net.minecraft.world.level.storage.loot.LootContext.BuilderwithParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam, T actor) Provides a parameter to this builder.static net.minecraft.world.level.storage.loot.LootContext.BuilderwithRandom(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Random random) Supplies aRandomsource to the built context.
-
Constructor Details
-
ExpandLootContextBuilder
public ExpandLootContextBuilder()
-
-
Method Details
-
create
public static net.minecraft.world.level.storage.loot.LootContext.Builder create(net.minecraft.server.level.ServerLevel level) Creates a new builder with the given level.- Parameters:
level- The level the loot will be rolled in.- Returns:
- A new builder.
-
copy
public static net.minecraft.world.level.storage.loot.LootContext.Builder copy(net.minecraft.world.level.storage.loot.LootContext context) -
withRandom
public static net.minecraft.world.level.storage.loot.LootContext.Builder withRandom(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Random random) Supplies aRandomsource to the built context.- Parameters:
random- The random source to provide.- Returns:
- This builder for chaining purposes.
- DocParam:
- random level.random
-
withOptionalRandomSeed
public static net.minecraft.world.level.storage.loot.LootContext.Builder withOptionalRandomSeed(net.minecraft.world.level.storage.loot.LootContext.Builder internal, long seed) Supplies a seed to be passed into a newRandom.- Parameters:
seed- The seed to use.- Returns:
- This builder for chaining purposes.
- DocParam:
- seed 0
-
withOptionalRandomSeed
public static net.minecraft.world.level.storage.loot.LootContext.Builder withOptionalRandomSeed(net.minecraft.world.level.storage.loot.LootContext.Builder internal, long seed, Random random) - Parameters:
seed- The seed to use.random- The random source to provide.- Returns:
- This builder for chaining purposes.
- DocParam:
- seed 1, random level.random
-
withLuck
public static net.minecraft.world.level.storage.loot.LootContext.Builder withLuck(net.minecraft.world.level.storage.loot.LootContext.Builder internal, float luck) Provides the given luck value to the context.- Parameters:
luck- The luck value to use.- Returns:
- This builder for chaining purposes.
- DocParam:
- luck 0.5
-
withParameter
public static <T> net.minecraft.world.level.storage.loot.LootContext.Builder withParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam, T actor) Provides a parameter to this builder.- Type Parameters:
T- The type of actor that the param uses.- Parameters:
contextParam- The param to add.actor- The actor used by the param.- Returns:
- This builder for chaining purposes.
- DocParam:
- contextParam LootContextParams.origin(), actor new Vec3(1, 2, 3);
-
withOptionalParameter
public static <T> net.minecraft.world.level.storage.loot.LootContext.Builder withOptionalParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam, T actor) Provides an optional parameter to this builder.- Type Parameters:
T- The type of actor that the param uses.- Parameters:
contextParam- The param to add.actor- The optional actor used by the param.- Returns:
- This builder for chaining purposes.
- DocParam:
- contextParam LootContextParams.origin(), actor new Vec3(1, 2, 3);
-
getLevel
public static net.minecraft.server.level.ServerLevel getLevel(net.minecraft.world.level.storage.loot.LootContext.Builder internal) Gets the level that this builder uses.- Returns:
- The level that this builder uses.
-
getParameter
public static <T> T getParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam) Gets the provided value of the parameter.- Type Parameters:
T- The type that theLootContextParamuses- Parameters:
contextParam- TheLootContextParamto get the value of.- Returns:
- The found value.
- DocParam:
- contextParam LootContextParams.origin()
-
getOptionalParameter
public static <T> T getOptionalParameter(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Class<T> tClass, net.minecraft.world.level.storage.loot.parameters.LootContextParam<T> contextParam) Gets the provided value of the optional parameter.- Type Parameters:
T- The type that theLootContextParamuses- Parameters:
contextParam- TheLootContextParamto get the value of.- Returns:
- The value if found, null otherwise.
- DocParam:
- contextParam LootContextParams.origin()
-
create
public static net.minecraft.world.level.storage.loot.LootContext create(net.minecraft.world.level.storage.loot.LootContext.Builder internal, net.minecraft.world.level.storage.loot.parameters.LootContextParamSet contextParamSet) Creates a newLootContextwith the givenLootContextParamSet.The given
LootContextParamSetis used to determine what values are required for the context to be used.- Parameters:
contextParamSet- TheLootContextParamSetto use.- Returns:
- a new
LootContext - DocParam:
- contextParamSet LootContextParamSets.gift()
-