Package org.bukkit.loot

# Class LootContext.Builder

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

Enclosing class:
  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`.

## Constructor Summary

Constructors
Constructor
Description
`Builder(@NotNull Location location)`
Creates a new LootContext.Builder instance to facilitate easy creation of `LootContext`s.

## Method Summary

Modifier and Type
Method
Description
`@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)`
Set the `Enchantment.LOOT_BONUS_MOBS` level equivalent to use when generating loot.
`@NotNull LootContext.Builder`
`luck(float luck)`
Set how much luck to have when generating loot.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### Builder

public Builder(@NotNull @NotNull Location location)
Creates a new LootContext.Builder instance to facilitate easy creation of `LootContext`s.

Parameters:
  `location` - the location the LootContext should use

## Method Details

### luck

@NotNull public @NotNull LootContext.Builder luck(float luck)
Set how much luck to have when generating loot.

Parameters:
  `luck` - the luck level
Returns:
  the Builder

### lootingModifier

@NotNull public @NotNull LootContext.Builder lootingModifier(int modifier)
Set the `Enchantment.LOOT_BONUS_MOBS` 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.

Parameters:
  `modifier` - the looting level modifier
Returns:
  the Builder

### lootedEntity

@NotNull public @NotNull LootContext.Builder lootedEntity(@Nullable @Nullable Entity lootedEntity)
The entity that was killed.

Parameters:
  `lootedEntity` - the looted entity
Returns:
  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.

Parameters:
  `killer` - the killer entity
Returns:
  the Builder

### build

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

Returns:
  a new `LootContext` instance