Class LootContext
java.lang.Object
net.minecraft.world.level.storage.loot.LootContext
LootContext stores various context information for loot generation.
This includes the Level as well as any known
s.
invalid reference
LootContextParam
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic enumRepresents a type of entity that can be looked up in aLootContextusing a.invalid reference
LootContextParamstatic enumstatic final recordLootContext.VisitedEntry<T extends Validatable> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HolderGetter.Providerprivate final LootParamsprivate @Nullable Identifierprivate final RandomSourceprivate final Set<LootContext.VisitedEntry<?>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLootContext(LootParams params, RandomSource random, HolderGetter.Provider lootDataResolver) privateLootContext(LootParams params, RandomSource random, HolderGetter.Provider p_287619_, Identifier queriedLootTableId) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDynamicDrops(Identifier location, Consumer<ItemStack> output) Add the dynamic drops for the given dynamic drops name to the given consumer.static LootContext.VisitedEntry<LootTable> createVisitedEntry(LootTable table) getLevel()floatgetLuck()<T> @Nullable TgetOptionalParameter(ContextKey<T> key) <T> TgetParameter(ContextKey<T> key) booleanhasParameter(ContextKey<?> key) booleanhasVisitedElement(LootContext.VisitedEntry<?> element) voidpopVisitedElement(LootContext.VisitedEntry<?> element) booleanpushVisitedElement(LootContext.VisitedEntry<?> element) voidsetQueriedLootTableId(@Nullable Identifier queriedLootTableId)
-
Field Details
-
params
-
random
-
lootDataResolver
-
visitedElements
-
queriedLootTableId
-
-
Constructor Details
-
LootContext
-
LootContext
private LootContext(LootParams params, RandomSource random, HolderGetter.Provider p_287619_, Identifier queriedLootTableId)
-
-
Method Details
-
hasParameter
-
getParameter
-
getOptionalParameter
-
addDynamicDrops
Add the dynamic drops for the given dynamic drops name to the given consumer. If no dynamic drops provider for the given name has been registered to this LootContext, nothing is generated.- See Also:
-
hasVisitedElement
-
pushVisitedElement
-
popVisitedElement
-
getResolver
-
getRandom
-
getLuck
public float getLuck() -
getLevel
-
createVisitedEntry
-
createVisitedEntry
public static LootContext.VisitedEntry<LootItemCondition> createVisitedEntry(LootItemCondition table) -
createVisitedEntry
-
setQueriedLootTableId
-
getQueriedLootTableId
-