Class SetItemDamageFunction
java.lang.Object
net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
net.minecraft.world.level.storage.loot.functions.SetItemDamageFunction
- All Implemented Interfaces:
BiFunction<ItemStack,,LootContext, ItemStack> LootItemFunction,LootContextUser
LootItemFunction that sets the stack's damage based on a
NumberProvider, optionally adding to any existing damage.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
LootItemConditionalFunction.Builder<T extends LootItemConditionalFunction.Builder<T>>, LootItemConditionalFunction.DummyBuilder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanstatic final com.mojang.serialization.MapCodec<SetItemDamageFunction> private final NumberProviderprivate static final org.slf4j.LoggerFields inherited from class net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
predicates -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSetItemDamageFunction(List<LootItemCondition> pConditions, NumberProvider pDamage, boolean pAdd) -
Method Summary
Modifier and TypeMethodDescriptionSet<ContextKey<?>> getType()run(ItemStack pStack, LootContext pContext) Called to perform the actual action of this function, after conditions have been checked.static LootItemConditionalFunction.Builder<?> setDamage(NumberProvider pDamageValue) static LootItemConditionalFunction.Builder<?> setDamage(NumberProvider pDamageValue, boolean pAdd) Methods inherited from class net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction
apply, commonFields, simpleBuilder, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CODEC
-
damage
-
add
private final boolean add
-
-
Constructor Details
-
SetItemDamageFunction
private SetItemDamageFunction(List<LootItemCondition> pConditions, NumberProvider pDamage, boolean pAdd)
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceLootItemFunction- Specified by:
getTypein 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
-
setDamage
-
setDamage
public static LootItemConditionalFunction.Builder<?> setDamage(NumberProvider pDamageValue, boolean pAdd)
-