Record Class RunFunction
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.RunFunction
- All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<RunFunction> private final IdentifierThe field for thefunctionrecord component.private static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionRunFunction(Identifier function) Creates an instance of aRunFunctionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) com.mojang.serialization.MapCodec<RunFunction> codec()final booleanIndicates whether some other object is "equal to" this one.function()Returns the value of thefunctionrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
function
The field for thefunctionrecord component. -
LOGGER
private static final org.slf4j.Logger LOGGER -
CODEC
-
-
Constructor Details
-
RunFunction
Creates an instance of aRunFunctionrecord class.- Parameters:
function- the value for thefunctionrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
function
Returns the value of thefunctionrecord component.- Returns:
- the value of the
functionrecord component
-