程序包 org.bukkit.loot

# 类 LootContext.Builder

java.lang.Object
org.bukkit.loot.LootContext.Builder

封闭类:
  LootContext

public static class LootContext.Builder extends Object
Utility class to make building `LootContext` easier. The only required argument is `Location` with a valid (non-null) `World`.

- ## 构造器概要

  构造器
  构造器
  说明
  `Builder(@NotNull Location location)`
  Creates a new LootContext.Builder instance to facilitate easy creation of `LootContext`s.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@NotNull LootContext`
  `build()`
  Create a new `LootContext` instance using the supplied parameters.
  `@NotNull LootContext.Builder`
  `killer(@Nullable HumanEntity killer)`
  Set the `HumanEntity` that killed `LootContext.getLootedEntity()`.
  `@NotNull LootContext.Builder`
  `lootedEntity(@Nullable Entity lootedEntity)`
  The entity that was killed.
  `@NotNull LootContext.Builder`
  `lootingModifier(int modifier)`
  已过时。
  no longer functional
  `@NotNull LootContext.Builder`
  `luck(float luck)`
  Set how much luck to have when generating loot.

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### Builder

    public Builder(@NotNull @NotNull Location location)
    Creates a new LootContext.Builder instance to facilitate easy creation of `LootContext`s.
    参数:
      `location` - the location the LootContext should use

- ## 方法详细资料

  - ### luck

    @NotNull public @NotNull LootContext.Builder luck(float luck)
    Set how much luck to have when generating loot.
    参数:
      `luck` - the luck level
    返回:
      the Builder

  - ### lootingModifier

    @NotNull @Deprecated public @NotNull LootContext.Builder lootingModifier(int modifier)
    已过时。
    no longer functional
    Set the `Enchantment.LOOTING` level equivalent to use when generating loot. Values less than or equal to 0 will force the `LootTable` to only return a single `ItemStack` per pool.
    参数:
      `modifier` - the looting level modifier
    返回:
      the Builder

  - ### lootedEntity

    @NotNull public @NotNull LootContext.Builder lootedEntity(@Nullable @Nullable Entity lootedEntity)
    The entity that was killed.
    参数:
      `lootedEntity` - the looted entity
    返回:
      the Builder

  - ### killer

    @NotNull public @NotNull LootContext.Builder killer(@Nullable @Nullable HumanEntity killer)
    Set the `HumanEntity` that killed `LootContext.getLootedEntity()`. This entity will be used to get the looting level if `lootingModifier(int)` is not set.
    参数:
      `killer` - the killer entity
    返回:
      the Builder

  - ### build

    @NotNull public @NotNull LootContext build()
    Create a new `LootContext` instance using the supplied parameters.
    返回:
      a new `LootContext` instance