Record Class SummonSpellFieldAnchorEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.SummonSpellFieldAnchorEffect
- Record Components:
duration- TheLevelBasedValuetotal lifespan of the anchor entity in ticks.tickRate- TheLevelBasedValueinterval in ticks between successive spell field evaluations.activationDelay- TheLevelBasedValueinitial delay in ticks before the anchor begins evaluating its spell field.activePhase- TheLevelBasedValueduration in ticks of each active pulsing window (or<= 0for continuous).restPhase- TheLevelBasedValueduration in ticks of each dormant rest window between active phases.spellField- TheSpellFieldComponentexecuted by the anchor on each active tick.visualConfig- OptionalAnchorVisualConfigcontrolling billboard sprite or custom 3D model rendering for the anchor.useOrigin- Iftrue, spawns the anchor at the trigger'soriginvector; iffalse, spawns attarget.position().
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect, net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
public record SummonSpellFieldAnchorEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue tickRate, net.minecraft.world.item.enchantment.LevelBasedValue activationDelay, net.minecraft.world.item.enchantment.LevelBasedValue activePhase, net.minecraft.world.item.enchantment.LevelBasedValue restPhase, SpellFieldComponent spellField, Optional<AnchorVisualConfig> visualConfig, boolean useOrigin)
extends Record
implements net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
An
EnchantmentEntityEffect that spawns a persistent SpellFieldAnchorEntity in the
world to repeatedly or delayedly evaluate an embedded SpellFieldComponent over time.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the initial activation delay in ticks.static final StringJSON field key for the active duty-cycle window in ticks.static final com.mojang.serialization.MapCodec<SummonSpellFieldAnchorEffect> MapCodec for serializing and deserializingSummonSpellFieldAnchorEffectinstances from JSON.static final StringJSON field key for the anchor lifespan in ticks.static final StringRegistry path identifier for this enchantment entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the dormant rest window in ticks.static final StringJSON field key for the nested spell field component definition.static final StringJSON field key for the evaluation tick interval.static final StringJSON field key for spawning at the trigger origin instead of the target entity position.static final StringJSON field key for the optional client visual configuration. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a defaultSummonSpellFieldAnchorEffectwith a 1-tick duration, 1-tick rate, no delays, and an emptySpellFieldComponent.SummonSpellFieldAnchorEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue tickRate, net.minecraft.world.item.enchantment.LevelBasedValue activationDelay, net.minecraft.world.item.enchantment.LevelBasedValue activePhase, net.minecraft.world.item.enchantment.LevelBasedValue restPhase, SpellFieldComponent spellField, Optional<AnchorVisualConfig> visualConfig, boolean useOrigin) Creates an instance of aSummonSpellFieldAnchorEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theactivationDelayrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theactivePhaserecord component.voidapply(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) Instantiates, configures, and spawns aSpellFieldAnchorEntityin the server level, inheriting the yaw and pitch orientation ofcontext.owner()(ortargetif no owner is present).com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()net.minecraft.world.item.enchantment.LevelBasedValueduration()Returns the value of thedurationrecord 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.LevelBasedValueReturns the value of therestPhaserecord component.Returns the value of thespellFieldrecord component.net.minecraft.world.item.enchantment.LevelBasedValuetickRate()Returns the value of thetickRaterecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theuseOriginrecord component.Returns the value of thevisualConfigrecord component.withActivationDelay(net.minecraft.world.item.enchantment.LevelBasedValue activationDelay) Returns a copy of this effect with the specified initial activation delay.withActivePhase(net.minecraft.world.item.enchantment.LevelBasedValue activePhase) Returns a copy of this effect with the specified active phase duration.withDuration(net.minecraft.world.item.enchantment.LevelBasedValue duration) Returns a copy of this effect with the specified anchor lifespan duration.withRestPhase(net.minecraft.world.item.enchantment.LevelBasedValue restPhase) Returns a copy of this effect with the specified dormant rest phase duration.withSpellFieldComponent(SpellFieldComponent spellField) Returns a copy of this effect with the specifiedSpellFieldComponentpayload.withTickRate(net.minecraft.world.item.enchantment.LevelBasedValue tickRate) Returns a copy of this effect with the specified evaluation tick interval.withUseOrigin(boolean useOrigin) Returns a copy of this effect configured to spawn at either the trigger origin or the target entity's position.withVisualConfig(AnchorVisualConfig visualConfig) Returns a copy of this effect with the specified client visual configuration.Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
DURATION
-
TICK_RATE
-
ACTIVATION_DELAY
JSON field key for the initial activation delay in ticks.- See Also:
-
ACTIVE_PHASE
JSON field key for the active duty-cycle window in ticks.- See Also:
-
REST_PHASE
JSON field key for the dormant rest window in ticks.- See Also:
-
SPELL_FIELD
JSON field key for the nested spell field component definition.- See Also:
-
VISUAL_CONFIG
JSON field key for the optional client visual configuration.- See Also:
-
USE_ORIGIN
JSON field key for spawning at the trigger origin instead of the target entity position.- See Also:
-
KEY
Registry path identifier for this enchantment entity effect.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingSummonSpellFieldAnchorEffectinstances from JSON.
-
-
Constructor Details
-
SummonSpellFieldAnchorEffect
public SummonSpellFieldAnchorEffect()Constructs a defaultSummonSpellFieldAnchorEffectwith a 1-tick duration, 1-tick rate, no delays, and an emptySpellFieldComponent. -
SummonSpellFieldAnchorEffect
public SummonSpellFieldAnchorEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration, net.minecraft.world.item.enchantment.LevelBasedValue tickRate, net.minecraft.world.item.enchantment.LevelBasedValue activationDelay, net.minecraft.world.item.enchantment.LevelBasedValue activePhase, net.minecraft.world.item.enchantment.LevelBasedValue restPhase, SpellFieldComponent spellField, Optional<AnchorVisualConfig> visualConfig, boolean useOrigin) Creates an instance of aSummonSpellFieldAnchorEffectrecord class.- Parameters:
duration- the value for thedurationrecord componenttickRate- the value for thetickRaterecord componentactivationDelay- the value for theactivationDelayrecord componentactivePhase- the value for theactivePhaserecord componentrestPhase- the value for therestPhaserecord componentspellField- the value for thespellFieldrecord componentvisualConfig- the value for thevisualConfigrecord componentuseOrigin- the value for theuseOriginrecord 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 target, net.minecraft.world.phys.Vec3 origin) Instantiates, configures, and spawns aSpellFieldAnchorEntityin the server level, inheriting the yaw and pitch orientation ofcontext.owner()(ortargetif no owner is present).- Specified by:
applyin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Parameters:
level- The server level in which the anchor is spawned.enchantmentLevel- The active level of the source enchantment.context- The context of the enchanted item in use.target- The target entity at which the effect was triggered.origin- The origin coordinate 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
-
withDuration
public SummonSpellFieldAnchorEffect withDuration(net.minecraft.world.item.enchantment.LevelBasedValue duration) Returns a copy of this effect with the specified anchor lifespan duration.- Parameters:
duration- The newLevelBasedValueduration in ticks.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withTickRate
public SummonSpellFieldAnchorEffect withTickRate(net.minecraft.world.item.enchantment.LevelBasedValue tickRate) Returns a copy of this effect with the specified evaluation tick interval.- Parameters:
tickRate- The newLevelBasedValuetick rate.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withActivationDelay
public SummonSpellFieldAnchorEffect withActivationDelay(net.minecraft.world.item.enchantment.LevelBasedValue activationDelay) Returns a copy of this effect with the specified initial activation delay.- Parameters:
activationDelay- The newLevelBasedValueactivation delay in ticks.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withActivePhase
public SummonSpellFieldAnchorEffect withActivePhase(net.minecraft.world.item.enchantment.LevelBasedValue activePhase) Returns a copy of this effect with the specified active phase duration.- Parameters:
activePhase- The newLevelBasedValueactive phase window in ticks.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withRestPhase
public SummonSpellFieldAnchorEffect withRestPhase(net.minecraft.world.item.enchantment.LevelBasedValue restPhase) Returns a copy of this effect with the specified dormant rest phase duration.- Parameters:
restPhase- The newLevelBasedValuerest phase window in ticks.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withSpellFieldComponent
Returns a copy of this effect with the specifiedSpellFieldComponentpayload.- Parameters:
spellField- TheSpellFieldComponentto evaluate.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withVisualConfig
Returns a copy of this effect with the specified client visual configuration.- Parameters:
visualConfig- TheAnchorVisualConfigto attach.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
withUseOrigin
Returns a copy of this effect configured to spawn at either the trigger origin or the target entity's position.- Parameters:
useOrigin-trueto use the trigger origin coordinate,falseto use the target's position.- Returns:
- A new
SummonSpellFieldAnchorEffectinstance.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
duration
-
tickRate
-
activationDelay
public net.minecraft.world.item.enchantment.LevelBasedValue activationDelay()Returns the value of theactivationDelayrecord component.- Returns:
- the value of the
activationDelayrecord component
-
activePhase
public net.minecraft.world.item.enchantment.LevelBasedValue activePhase()Returns the value of theactivePhaserecord component.- Returns:
- the value of the
activePhaserecord component
-
restPhase
-
spellField
Returns the value of thespellFieldrecord component.- Returns:
- the value of the
spellFieldrecord component
-
visualConfig
Returns the value of thevisualConfigrecord component.- Returns:
- the value of the
visualConfigrecord component
-
useOrigin
-