Record Class AbsoluteStasisEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.AbsoluteStasisEffect
- Record Components:
entityFilter- OptionalLootItemConditionrestricting which entities are affected.
- All Implemented Interfaces:
SpellFieldEffect, SpellFieldEntityEffect
public record AbsoluteStasisEffect(Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter)
extends Record
implements SpellFieldEntityEffect
A
SpellFieldEntityEffect that zeroes out a target entity's velocity vector and resets its
accumulated Entity.fallDistance, freezing the entity in mid-air without lethal fall damage buildup.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<AbsoluteStasisEffect> MapCodec for serializing and deserializingAbsoluteStasisEffectinstances from JSON.static final StringRegistry path identifier for this spell field entity effect. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an unfilteredAbsoluteStasisEffectaffecting all targeted entities.AbsoluteStasisEffect(Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter) Creates an instance of aAbsoluteStasisEffectrecord class.AbsoluteStasisEffect(net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs anAbsoluteStasisEffectrestricted by the given entity predicate filter. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Clampsvictim's momentum toVec3.ZERO, resetsfallDistanceto0.0F, and marks the entity for immediate client velocity synchronization.com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()Retrieves theMapCodecresponsible for serializing and deserializing this effect.Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> Returns the value of theentityFilterrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
KEY
Registry path identifier for this spell field entity effect.- See Also:
-
CODEC
MapCodec for serializing and deserializingAbsoluteStasisEffectinstances from JSON.
-
-
Constructor Details
-
AbsoluteStasisEffect
public AbsoluteStasisEffect()Constructs an unfilteredAbsoluteStasisEffectaffecting all targeted entities. -
AbsoluteStasisEffect
public AbsoluteStasisEffect(net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter) Constructs anAbsoluteStasisEffectrestricted by the given entity predicate filter.- Parameters:
entityFilter- The predicate filter to match against candidate entities.
-
AbsoluteStasisEffect
public AbsoluteStasisEffect(Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter) Creates an instance of aAbsoluteStasisEffectrecord class.- Parameters:
entityFilter- the value for theentityFilterrecord component
-
-
Method Details
-
apply
public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar) Clampsvictim's momentum toVec3.ZERO, resetsfallDistanceto0.0F, and marks the entity for immediate client velocity synchronization.- Specified by:
applyin interfaceSpellFieldEntityEffect- Parameters:
level- The executing server level.enchantmentLevel- The active level of the spell field enchantment.context- The item usage context triggering the spell field.spatialReference- The anchor entity or focal point of the spell field.epicenter- The exact spatial origin vector of the spell field.victim- The target entity intersecting the spell field.volumeScalar- The active topological multiplier forvictim.
-
codec
Description copied from interface:SpellFieldEffectRetrieves theMapCodecresponsible for serializing and deserializing this effect.- Specified by:
codecin interfaceSpellFieldEffect- Returns:
- The registered
MapCodecinstance.
-
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). -
entityFilter
public Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter()Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-