Class SetAttributesFunction
java.lang.Object
net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
net.minecraft.world.level.storage.loot.functions.SetAttributesFunction
- All Implemented Interfaces:
BiFunction<ItemStack, LootContext, ItemStack>, LootItemFunction, LootContextUser, Validatable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate static final recordstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MapCodec<SetAttributesFunction> private final List<SetAttributesFunction.Modifier> private final booleanFields inherited from class LootItemConditionalFunction
predicates -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSetAttributesFunction(List<LootItemCondition> predicates, List<SetAttributesFunction.Modifier> modifiers, boolean replace) -
Method Summary
Modifier and TypeMethodDescriptioncodec()modifier(Identifier id, Holder<Attribute> attribute, AttributeModifier.Operation operation, NumberProvider amount) run(ItemStack itemStack, LootContext context) private ItemAttributeModifiersupdateModifiers(LootContext context, ItemAttributeModifiers itemModifiers) voidvalidate(ValidationContext context) Methods inherited from class LootItemConditionalFunction
apply, commonFields, simpleBuilderMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThenMethods inherited from interface LootContextUser
getReferencedContextParams
-
Field Details
-
MAP_CODEC
-
modifiers
-
replace
private final boolean replace
-
-
Constructor Details
-
SetAttributesFunction
private SetAttributesFunction(List<LootItemCondition> predicates, List<SetAttributesFunction.Modifier> modifiers, boolean replace)
-
-
Method Details
-
codec
- Specified by:
codecin interfaceLootItemFunction- Specified by:
codecin classLootItemConditionalFunction
-
validate
- Specified by:
validatein interfaceLootContextUser- Specified by:
validatein interfaceValidatable- Overrides:
validatein classLootItemConditionalFunction
-
run
- Specified by:
runin classLootItemConditionalFunction
-
updateModifiers
private ItemAttributeModifiers updateModifiers(LootContext context, ItemAttributeModifiers itemModifiers) -
modifier
public static SetAttributesFunction.ModifierBuilder modifier(Identifier id, Holder<Attribute> attribute, AttributeModifier.Operation operation, NumberProvider amount) -
setAttributes
-