Record Class AreaGravityDamageEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.AreaGravityDamageEffect
- Record Components:
strength- TheLevelBasedValuegoverning the peak gravitational pull (positive) or push (negative) force.radius- TheLevelBasedValuegoverning the cubic half-extent of the area of effect in blocks.damage- TheLevelBasedValuegoverning the flat damage dealt to affected entities.
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect,net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
public record AreaGravityDamageEffect(net.minecraft.world.item.enchantment.LevelBasedValue strength, net.minecraft.world.item.enchantment.LevelBasedValue radius, net.minecraft.world.item.enchantment.LevelBasedValue damage)
extends Record
implements net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
An
EnchantmentEntityEffect that generates a localized gravitational impulse field and inflicts
area-of-effect damage around the target entity.
Living entities (excluding the enchantment owner) within radius() are pulled inward (when
strength() is positive) or pushed outward (when negative) using a sigmoid distance falloff curve,
accompanied by directional particle bursts and sound effects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<AreaGravityDamageEffect> MapCodec for serializing and deserializingAreaGravityDamageEffectinstances from JSON.static final StringJSON field key for the inflicted damage amount.static final StringRegistry path identifier for this entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the area-of-effect radius.static final StringJSON field key for the gravitational impulse strength. -
Constructor Summary
ConstructorsConstructorDescriptionAreaGravityDamageEffect(net.minecraft.world.item.enchantment.LevelBasedValue strength, net.minecraft.world.item.enchantment.LevelBasedValue radius, net.minecraft.world.item.enchantment.LevelBasedValue damage) Creates an instance of aAreaGravityDamageEffectrecord class. -
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 target, net.minecraft.world.phys.Vec3 origin) Applies the gravitational impulse, particle effects, and damage to all valid living entities within the calculated bounding volume aroundtarget.com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()net.minecraft.world.item.enchantment.LevelBasedValuedamage()Returns the value of thedamagerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueradius()Returns the value of theradiusrecord component.net.minecraft.world.item.enchantment.LevelBasedValuestrength()Returns the value of thestrengthrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
STRENGTH
JSON field key for the gravitational impulse strength.- See Also:
-
RADIUS
JSON field key for the area-of-effect radius.- See Also:
-
DAMAGE
JSON field key for the inflicted damage amount.- See Also:
-
KEY
Registry path identifier for this entity effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingAreaGravityDamageEffectinstances from JSON.
-
-
Constructor Details
-
AreaGravityDamageEffect
public AreaGravityDamageEffect(net.minecraft.world.item.enchantment.LevelBasedValue strength, net.minecraft.world.item.enchantment.LevelBasedValue radius, net.minecraft.world.item.enchantment.LevelBasedValue damage) Creates an instance of aAreaGravityDamageEffectrecord class.
-
-
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 target, net.minecraft.world.phys.Vec3 origin) Applies the gravitational impulse, particle effects, and damage to all valid living entities within the calculated bounding volume aroundtarget.- Specified by:
applyin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Parameters:
level- The server level in which the effect is triggered.enchantmentLevel- The level of the source enchantment.context- The context of the enchanted item in use, providing the owner entity.target- The focal entity at the center of the gravity field.origin- The origin position vector of the trigger.
-
codec
public com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
strength
public net.minecraft.world.item.enchantment.LevelBasedValue strength()Returns the value of thestrengthrecord component.- Returns:
- the value of the
strengthrecord component
-
radius
public net.minecraft.world.item.enchantment.LevelBasedValue radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
damage
public net.minecraft.world.item.enchantment.LevelBasedValue damage()Returns the value of thedamagerecord component.- Returns:
- the value of the
damagerecord component
-