Class CopyComponentsFunction
java.lang.Object
net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
net.minecraft.world.level.storage.loot.functions.CopyComponentsFunction
- All Implemented Interfaces:
BiFunction<ItemStack, LootContext, ItemStack>, LootItemFunction, LootContextUser, Validatable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordstatic classprivate static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Predicate<DataComponentType<?>> private final Optional<List<DataComponentType<?>>> private static final com.mojang.serialization.Codec<LootContextArg<DataComponentGetter>> private final Optional<List<DataComponentType<?>>> static final com.mojang.serialization.MapCodec<CopyComponentsFunction> private final LootContextArg<DataComponentGetter> Fields inherited from class LootItemConditionalFunction
predicates -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCopyComponentsFunction(List<LootItemCondition> predicates, LootContextArg<DataComponentGetter> source, Optional<List<DataComponentType<?>>> include, Optional<List<DataComponentType<?>>> exclude) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<CopyComponentsFunction> codec()copyComponentsFromBlockEntity(ContextKey<? extends BlockEntity> source) copyComponentsFromEntity(ContextKey<? extends Entity> source) Set<ContextKey<?>> run(ItemStack itemStack, LootContext context) Called to perform the actual action of this function, after conditions have been checked.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
-
GETTER_CODEC
private static final com.mojang.serialization.Codec<LootContextArg<DataComponentGetter>> GETTER_CODEC -
MAP_CODEC
-
source
-
include
-
exclude
-
bakedPredicate
-
-
Constructor Details
-
CopyComponentsFunction
private CopyComponentsFunction(List<LootItemCondition> predicates, LootContextArg<DataComponentGetter> source, Optional<List<DataComponentType<?>>> include, Optional<List<DataComponentType<?>>> exclude)
-
-
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
-
copyComponentsFromEntity
public static CopyComponentsFunction.Builder copyComponentsFromEntity(ContextKey<? extends Entity> source) -
copyComponentsFromBlockEntity
public static CopyComponentsFunction.Builder copyComponentsFromBlockEntity(ContextKey<? extends BlockEntity> source)
-