Class LootItemConditionalFunction
java.lang.Object
net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
- All Implemented Interfaces:
BiFunction<ItemStack,
,LootContext, ItemStack> LootItemFunction
,LootContextUser
- Direct Known Subclasses:
ApplyBonusCount
,ApplyExplosionDecay
,CopyBlockState
,CopyComponentsFunction
,CopyCustomDataFunction
,CopyNameFunction
,EnchantedCountIncreaseFunction
,EnchantRandomlyFunction
,EnchantWithLevelsFunction
,ExplorationMapFunction
,FillPlayerHead
,FilteredFunction
,FunctionReference
,LimitCount
,ModifyContainerContents
,SetAttributesFunction
,SetBannerPatternFunction
,SetBookCoverFunction
,SetComponentsFunction
,SetContainerContents
,SetContainerLootTable
,SetCustomDataFunction
,SetCustomModelDataFunction
,SetEnchantmentsFunction
,SetFireworkExplosionFunction
,SetFireworksFunction
,SetInstrumentFunction
,SetItemCountFunction
,SetItemDamageFunction
,SetItemFunction
,SetLoreFunction
,SetNameFunction
,SetOminousBottleAmplifierFunction
,SetPotionFunction
,SetStewEffectFunction
,SetWritableBookPagesFunction
,SetWrittenBookPagesFunction
,SmeltItemFunction
,ToggleTooltips
A LootItemFunction that only modifies the stacks if a list of predicates passes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
(package private) static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Predicate
<LootContext> protected final List
<LootItemCondition> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LootItemConditionalFunction
(List<LootItemCondition> pPredicates) -
Method Summary
Modifier and TypeMethodDescriptionfinal ItemStack
apply
(ItemStack pStack, LootContext pContext) protected static <T extends LootItemConditionalFunction>
com.mojang.datafixers.Products.P1<com.mojang.serialization.codecs.RecordCodecBuilder.Mu<T>, List<LootItemCondition>> commonFields
(com.mojang.serialization.codecs.RecordCodecBuilder.Instance<T> p_298453_) abstract LootItemFunctionType
<? extends LootItemConditionalFunction> getType()
protected abstract ItemStack
run
(ItemStack pStack, LootContext pContext) Called to perform the actual action of this function, after conditions have been checked.static LootItemConditionalFunction.Builder
<?> simpleBuilder
(Function<List<LootItemCondition>, LootItemFunction> pConstructor) void
validate
(ValidationContext pContext) Validate that this object is used correctly according to the given ValidationContext.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams
-
Field Details
-
predicates
-
compositePredicates
-
-
Constructor Details
-
LootItemConditionalFunction
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceLootItemFunction
-
commonFields
protected static <T extends LootItemConditionalFunction> com.mojang.datafixers.Products.P1<com.mojang.serialization.codecs.RecordCodecBuilder.Mu<T>,List<LootItemCondition>> commonFields(com.mojang.serialization.codecs.RecordCodecBuilder.Instance<T> p_298453_) -
apply
- Specified by:
apply
in interfaceBiFunction<ItemStack,
LootContext, ItemStack>
-
run
Called to perform the actual action of this function, after conditions have been checked. -
validate
Validate that this object is used correctly according to the given ValidationContext.- Specified by:
validate
in interfaceLootContextUser
-
simpleBuilder
public static LootItemConditionalFunction.Builder<?> simpleBuilder(Function<List<LootItemCondition>, LootItemFunction> pConstructor)
-