Class ExpandLootContextBuilder

java.lang.Object
com.blamejared.crafttweaker.natives.loot.ExpandLootContextBuilder

@ZenRegister public final class ExpandLootContextBuilder extends Object
Creates a new LootContext using a builder style pattern.
DocParam:
this new LootContextBuilder(level)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.level.storage.loot.LootContext.Builder
    copy(net.minecraft.world.level.storage.loot.LootContext context)
     
    static net.minecraft.world.level.storage.loot.LootContext.Builder
    create(net.minecraft.server.level.ServerLevel level)
    Creates a new builder with the given level.
    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 new LootContext with the given LootContextParamSet.
    static net.minecraft.server.level.ServerLevel
    getLevel(net.minecraft.world.level.storage.loot.LootContext.Builder internal)
    Gets the level that this builder uses.
    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.
    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.
    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.
    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.
    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 new Random.
    static net.minecraft.world.level.storage.loot.LootContext.Builder
    withOptionalRandomSeed(net.minecraft.world.level.storage.loot.LootContext.Builder internal, long seed, Random random)
    Supplies either a seed to be passed into a new Random or if the seed is 0 use the given Random
    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.
    static net.minecraft.world.level.storage.loot.LootContext.Builder
    withRandom(net.minecraft.world.level.storage.loot.LootContext.Builder internal, Random random)
    Supplies a Random source to the built context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 a Random source 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 new Random.
      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)
      Supplies either a seed to be passed into a new Random or if the seed is 0 use the given 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 the LootContextParam uses
      Parameters:
      contextParam - The LootContextParam to 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 the LootContextParam uses
      Parameters:
      contextParam - The LootContextParam to 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 new LootContext with the given LootContextParamSet.

      The given LootContextParamSet is used to determine what values are required for the context to be used.

      Parameters:
      contextParamSet - The LootContextParamSet to use.
      Returns:
      a new LootContext
      DocParam:
      contextParamSet LootContextParamSets.gift()