Class SetLoreFunction
java.lang.Object
net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
net.minecraft.world.level.storage.loot.functions.SetLoreFunction
- All Implemented Interfaces:
BiFunction<ItemStack, LootContext, ItemStack>, LootItemFunction, LootContextUser, Validatable
LootItemFunction that sets a stack's lore tag, optionally replacing any previously present lore.
The Components for the lore tag are optionally resolved relative to a given
LootContext.EntityTarget for entity-sensitive component data such as scoreboard scores.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SetLoreFunction> private final ListOperationprivate final Optional<LootContext.EntityTarget> Fields inherited from class LootItemConditionalFunction
predicates -
Constructor Summary
ConstructorsConstructorDescriptionSetLoreFunction(List<LootItemCondition> predicates, List<Component> lore, ListOperation mode, Optional<LootContext.EntityTarget> resolutionContext) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<SetLoreFunction> codec()Set<ContextKey<?>> run(ItemStack itemStack, LootContext context) Called to perform the actual action of this function, after conditions have been checked.static SetLoreFunction.BuildersetLore()updateLore(@Nullable ItemLore itemLore, LootContext context) Methods inherited from class LootItemConditionalFunction
apply, commonFields, simpleBuilder, validateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Field Details
-
MAP_CODEC
-
lore
-
mode
-
resolutionContext
-
-
Constructor Details
-
SetLoreFunction
public SetLoreFunction(List<LootItemCondition> predicates, List<Component> lore, ListOperation mode, Optional<LootContext.EntityTarget> resolutionContext)
-
-
Method Details
-
codec
- Specified by:
codecin interfaceLootItemFunction- Specified by:
codecin classLootItemConditionalFunction
-
getReferencedContextParams
-
run
Description copied from class:LootItemConditionalFunctionCalled to perform the actual action of this function, after conditions have been checked.- Specified by:
runin classLootItemConditionalFunction
-
updateLore
-
setLore
-