Record Class SummonMirageEffect
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.spellfield.effect.SummonMirageEffect
- Record Components:
count- Number of mirage decoys to summon into the formation (default:3).duration- Lifetime of the summoned mirages in ticks (default:240).radius- Orbital radius around the subject, or<= 0to auto-scale with entity size.redirectAggro- Whether nearby hostile mobs targeting the subject should redirect aggro to a mirage.entityFilter- Optional predicate filtering which target entities can receive the mirage formation.
- All Implemented Interfaces:
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEffect,johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect,johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect
public record SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter)
extends Record
implements johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect, johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect
A spell field effect that summons a synchronized orbital formation of illusory
MirageEntity decoys
around the target or caster entity.
Implements both SpellFieldEntityEffect and SpellFieldVolumeEffect so it can be
used in either "entity_effects" or "volume_effects" (including self-targeted
spell fields where context.owner() is excluded from entity_effects).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SummonMirageEffect> TheMapCodecresponsible for serializing and deserializingSummonMirageEffectinstances.static final StringJSON field key for the mirage count parameter.static final StringJSON field key for the mirage duration parameter.static final StringJSON field key for the optional entity filter predicate.static final StringRegistry path identifier for this spell field effect ("summon_mirage").static final johnsmith.enchantmentcore.api.registry.LevelBasedKeyProviderProvides the set of JSON property keys that holdLevelBasedValues for data transformation.static final StringJSON field key for the orbital radius parameter.static final StringJSON field key for the aggro redirection flag. -
Constructor Summary
ConstructorsConstructorDescriptionSummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count) Convenience constructor using the default mirage lifetime (MirageEntity.DEFAULT_MAX_LIFETIME_TICKS).SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration) Convenience constructor with auto-scaled orbital radius (0.0F), aggro redirection enabled, and no entity filter.SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) Creates an instance of aSummonMirageEffectrecord 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 spatialReference, net.minecraft.world.phys.Vec3 epicenter, List<johnsmith.enchantmentcore.api.enchantment.spellfield.math.GlobalVolume> volumes) Applies this effect as a volume-level effect, resolving the subject entity fromspatialReferenceorcontext.owner().voidapply(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) Applies this effect to a specific target entity within the spell field volume.com.mojang.serialization.MapCodec<? extends johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect> codec()Retrieves theMapCodecfor this spell field effect.net.minecraft.world.item.enchantment.LevelBasedValuecount()Returns the value of thecountrecord component.net.minecraft.world.item.enchantment.LevelBasedValueduration()Returns the value of thedurationrecord component.Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> 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.net.minecraft.world.item.enchantment.LevelBasedValueradius()Returns the value of theradiusrecord component.booleanReturns the value of theredirectAggrorecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
COUNT
JSON field key for the mirage count parameter.- See Also:
-
DURATION
JSON field key for the mirage duration parameter.- See Also:
-
RADIUS
JSON field key for the orbital radius parameter.- See Also:
-
REDIRECT_AGGRO
JSON field key for the aggro redirection flag.- See Also:
-
ENTITY_FILTER
JSON field key for the optional entity filter predicate.- See Also:
-
KEY
Registry path identifier for this spell field effect ("summon_mirage").- See Also:
-
KEY_PROVIDER
public static final johnsmith.enchantmentcore.api.registry.LevelBasedKeyProvider KEY_PROVIDERProvides the set of JSON property keys that holdLevelBasedValues for data transformation. -
CODEC
TheMapCodecresponsible for serializing and deserializingSummonMirageEffectinstances.
-
-
Constructor Details
-
SummonMirageEffect
public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration) Convenience constructor with auto-scaled orbital radius (0.0F), aggro redirection enabled, and no entity filter.- Parameters:
count- The number of mirages to summon.duration- The lifetime of the mirages in ticks.
-
SummonMirageEffect
public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count) Convenience constructor using the default mirage lifetime (MirageEntity.DEFAULT_MAX_LIFETIME_TICKS).- Parameters:
count- The number of mirages to summon.
-
SummonMirageEffect
public SummonMirageEffect(net.minecraft.world.item.enchantment.LevelBasedValue count, net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue radius, boolean redirectAggro, Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> entityFilter) Creates an instance of aSummonMirageEffectrecord class.- Parameters:
count- the value for thecountrecord componentduration- the value for thedurationrecord componentradius- the value for theradiusrecord componentredirectAggro- the value for theredirectAggrorecord componententityFilter- 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) Applies this effect to a specific target entity within the spell field volume.- Specified by:
applyin interfacejohnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect- Parameters:
level- The executingServerLevel.enchantmentLevel- The enchantment level of the spell field.context- The item-in-use context.spatialReference- The spatial reference entity.epicenter- The epicenter coordinates of the spell field.victim- The target entity receiving the mirage formation.volumeScalar- The topological scalar at the victim's position.
-
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, List<johnsmith.enchantmentcore.api.enchantment.spellfield.math.GlobalVolume> volumes) Applies this effect as a volume-level effect, resolving the subject entity fromspatialReferenceorcontext.owner().- Specified by:
applyin interfacejohnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldVolumeEffect- Parameters:
level- The executingServerLevel.enchantmentLevel- The enchantment level of the spell field.context- The item-in-use context.spatialReference- The spatial reference entity.epicenter- The epicenter coordinates of the spell field.volumes- The list of global volumes comprising the spell field.
-
codec
public com.mojang.serialization.MapCodec<? extends johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEntityEffect> codec()Retrieves theMapCodecfor this spell field effect.- Specified by:
codecin interfacejohnsmith.enchantmentcore.api.enchantment.spellfield.effect.SpellFieldEffect- Returns:
- The
CODECinstance.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
count
public net.minecraft.world.item.enchantment.LevelBasedValue count()Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
duration
public net.minecraft.world.item.enchantment.LevelBasedValue duration()Returns the value of thedurationrecord component.- Returns:
- the value of the
durationrecord component
-
radius
public net.minecraft.world.item.enchantment.LevelBasedValue radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
redirectAggro
public boolean redirectAggro()Returns the value of theredirectAggrorecord component.- Returns:
- the value of the
redirectAggrorecord component
-
entityFilter
Returns the value of theentityFilterrecord component.- Returns:
- the value of the
entityFilterrecord component
-