Package net.minecraft.loot
Class LootContext
- java.lang.Object
-
- net.minecraft.loot.LootContext
-
public class LootContext extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LootContext.Builder
static class
LootContext.EntityTarget
static interface
LootContext.IDynamicDropProvider
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Function<ResourceLocation,ILootCondition>
conditions
private java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider>
dynamicDrops
private ServerWorld
level
private java.util.function.Function<ResourceLocation,LootTable>
lootTables
private float
luck
private java.util.Map<LootParameter<?>,java.lang.Object>
params
private ResourceLocation
queriedLootTableId
private java.util.Random
random
private java.util.Set<ILootCondition>
visitedConditions
private java.util.Set<LootTable>
visitedTables
-
Constructor Summary
Constructors Modifier Constructor Description private
LootContext(java.util.Random p_i225885_1_, float p_i225885_2_, ServerWorld p_i225885_3_, java.util.function.Function<ResourceLocation,LootTable> p_i225885_4_, java.util.function.Function<ResourceLocation,ILootCondition> p_i225885_5_, java.util.Map<LootParameter<?>,java.lang.Object> p_i225885_6_, java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider> p_i225885_7_)
private
LootContext(java.util.Random rand, float luckIn, ServerWorld worldIn, java.util.function.Function<ResourceLocation,LootTable> lootTableManagerIn, java.util.function.Function<ResourceLocation,ILootCondition> p_i225885_5_, java.util.Map<LootParameter<?>,java.lang.Object> parametersIn, java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider> conditionsIn, ResourceLocation queriedLootTableId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDynamicDrops(ResourceLocation p_216034_1_, java.util.function.Consumer<ItemStack> p_216034_2_)
boolean
addVisitedCondition(ILootCondition p_227501_1_)
boolean
addVisitedTable(LootTable p_186496_1_)
ILootCondition
getCondition(ResourceLocation p_227504_1_)
ServerWorld
getLevel()
int
getLootingModifier()
LootTable
getLootTable(ResourceLocation p_227502_1_)
float
getLuck()
<T> T
getParamOrNull(LootParameter<T> p_216031_1_)
ResourceLocation
getQueriedLootTableId()
java.util.Random
getRandom()
boolean
hasParam(LootParameter<?> p_216033_1_)
void
removeVisitedCondition(ILootCondition p_227503_1_)
void
removeVisitedTable(LootTable p_186490_1_)
void
setQueriedLootTableId(ResourceLocation queriedLootTableId)
-
-
-
Field Detail
-
random
private final java.util.Random random
-
luck
private final float luck
-
level
private final ServerWorld level
-
lootTables
private final java.util.function.Function<ResourceLocation,LootTable> lootTables
-
visitedTables
private final java.util.Set<LootTable> visitedTables
-
conditions
private final java.util.function.Function<ResourceLocation,ILootCondition> conditions
-
visitedConditions
private final java.util.Set<ILootCondition> visitedConditions
-
params
private final java.util.Map<LootParameter<?>,java.lang.Object> params
-
dynamicDrops
private final java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider> dynamicDrops
-
queriedLootTableId
private ResourceLocation queriedLootTableId
-
-
Constructor Detail
-
LootContext
private LootContext(java.util.Random p_i225885_1_, float p_i225885_2_, ServerWorld p_i225885_3_, java.util.function.Function<ResourceLocation,LootTable> p_i225885_4_, java.util.function.Function<ResourceLocation,ILootCondition> p_i225885_5_, java.util.Map<LootParameter<?>,java.lang.Object> p_i225885_6_, java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider> p_i225885_7_)
-
LootContext
private LootContext(java.util.Random rand, float luckIn, ServerWorld worldIn, java.util.function.Function<ResourceLocation,LootTable> lootTableManagerIn, java.util.function.Function<ResourceLocation,ILootCondition> p_i225885_5_, java.util.Map<LootParameter<?>,java.lang.Object> parametersIn, java.util.Map<ResourceLocation,LootContext.IDynamicDropProvider> conditionsIn, ResourceLocation queriedLootTableId)
-
-
Method Detail
-
hasParam
public boolean hasParam(LootParameter<?> p_216033_1_)
-
addDynamicDrops
public void addDynamicDrops(ResourceLocation p_216034_1_, java.util.function.Consumer<ItemStack> p_216034_2_)
-
getParamOrNull
@Nullable public <T> T getParamOrNull(LootParameter<T> p_216031_1_)
-
addVisitedTable
public boolean addVisitedTable(LootTable p_186496_1_)
-
removeVisitedTable
public void removeVisitedTable(LootTable p_186490_1_)
-
addVisitedCondition
public boolean addVisitedCondition(ILootCondition p_227501_1_)
-
removeVisitedCondition
public void removeVisitedCondition(ILootCondition p_227503_1_)
-
getLootTable
public LootTable getLootTable(ResourceLocation p_227502_1_)
-
getCondition
public ILootCondition getCondition(ResourceLocation p_227504_1_)
-
getRandom
public java.util.Random getRandom()
-
getLuck
public float getLuck()
-
getLevel
public ServerWorld getLevel()
-
getLootingModifier
public int getLootingModifier()
-
setQueriedLootTableId
public void setQueriedLootTableId(ResourceLocation queriedLootTableId)
-
getQueriedLootTableId
public ResourceLocation getQueriedLootTableId()
-
-