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(Location location)
Creates a new LootContext.Builder instance to facilitate easy creation ofLootContext
s. -
Method Summary
Modifier and Type Method Description LootContext
build()
Create a newLootContext
instance using the supplied parameters.LootContext.Builder
killer(HumanEntity killer)
Set theHumanEntity
that killedLootContext.getLootedEntity()
.LootContext.Builder
lootedEntity(Entity lootedEntity)
The entity that was killed.LootContext.Builder
lootingModifier(int modifier)
Set theEnchantment.LOOT_BONUS_MOBS
level equivalent to use when generating loot.LootContext.Builder
luck(float luck)
Set how much luck to have when generating loot.
-
Constructor Details
-
Builder
Creates a new LootContext.Builder instance to facilitate easy creation ofLootContext
s.- Parameters:
location
- the location the LootContext should use
-
-
Method Details
-
luck
Set how much luck to have when generating loot.- Parameters:
luck
- the luck level- Returns:
- the Builder
-
lootingModifier
Set theEnchantment.LOOT_BONUS_MOBS
level equivalent to use when generating loot. Values less than or equal to 0 will force theLootTable
to only return a singleItemStack
per pool.- Parameters:
modifier
- the looting level modifier- Returns:
- the Builder
-
lootedEntity
The entity that was killed.- Parameters:
lootedEntity
- the looted entity- Returns:
- the Builder
-
killer
Set theHumanEntity
that killedLootContext.getLootedEntity()
. This entity will be used to get the looting level iflootingModifier(int)
is not set.- Parameters:
killer
- the killer entity- Returns:
- the Builder
-
build
Create a newLootContext
instance using the supplied parameters.- Returns:
- a new
LootContext
instance
-