Record Class ApplyEntityImpulse
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.ApplyEntityImpulse
- All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect
public record ApplyEntityImpulse(Vec3 direction, Vec3 coordinateScale, LevelBasedValue magnitude)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ApplyEntityImpulse> private final Vec3The field for thecoordinateScalerecord component.private final Vec3The field for thedirectionrecord component.private final LevelBasedValueThe field for themagnituderecord component.private static final int -
Constructor Summary
ConstructorsConstructorDescriptionApplyEntityImpulse(Vec3 direction, Vec3 coordinateScale, LevelBasedValue magnitude) Creates an instance of aApplyEntityImpulserecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) com.mojang.serialization.MapCodec<ApplyEntityImpulse> codec()Returns the value of thecoordinateScalerecord component.Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themagnituderecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
direction
The field for thedirectionrecord component. -
coordinateScale
The field for thecoordinateScalerecord component. -
magnitude
The field for themagnituderecord component. -
CODEC
-
POST_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS
private static final int POST_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS- See Also:
-
-
Constructor Details
-
ApplyEntityImpulse
Creates an instance of aApplyEntityImpulserecord class.- Parameters:
direction- the value for thedirectionrecord componentcoordinateScale- the value for thecoordinateScalerecord componentmagnitude- the value for themagnituderecord 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). -
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
coordinateScale
Returns the value of thecoordinateScalerecord component.- Returns:
- the value of the
coordinateScalerecord component
-
magnitude
Returns the value of themagnituderecord component.- Returns:
- the value of the
magnituderecord component
-