Class ImpactModifiers

java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.component.ImpactModifiers
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class ImpactModifiers extends Object implements Component<EntityStore>
The resolved ability attributes and rune on-hit effects of an ability cast. Snapshotted onto the cast chain's context when an ability chain starts (so cast-time interactions and selectors can read them) and stamped as a component onto spawned carriers like projectiles and ability entities (their chains run with fresh contexts, so cast-time state only reaches them through the entity itself). Attributes start from the core ability's declared values and each matching support's AttributeModifiers apply left to right.
  • Field Details

    • CAST_SNAPSHOT

      @Nonnull public static final MetaKey<ImpactModifiers> CAST_SNAPSHOT
      The cast's resolved modifiers, carried on the chain's context from the moment the chain starts. Forked contexts inherit it, so a cast's hit chains read the same values.
    • DAMAGE_MODIFIERS

      public static final MetaKey<ImpactModifiers> DAMAGE_MODIFIERS
      The modifiers of the ability whose DamageEntity dealt this damage, so on-damage systems (rune on-hit effects) read the cast's values without knowing whether the damage came from a projectile, an ability entity, or the caster's own chain. Absent for damage that did not come from an ability.
  • Constructor Details

    • ImpactModifiers

      public ImpactModifiers(@Nullable Map<String,Float> attributes, @Nullable String[] onHitEffectIds)
    • ImpactModifiers

      public ImpactModifiers(@Nullable Map<String,Float> attributes, @Nullable String[] onHitEffectIds, @Nullable String elementalCauseId)
  • Method Details

    • getComponentType

      public static ComponentType<EntityStore, ImpactModifiers> getComponentType()
    • collect

      @Nullable public static ImpactModifiers collect(@Nonnull InteractionContext context, @Nonnull Ref<EntityStore> casterRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Collects the resolved modifiers for a projectile launched by an ability cast, or null when the cast isn't an ability cast or there is nothing to carry.
    • snapshotForCast

      public static void snapshotForCast(@Nonnull InteractionContext context, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Snapshots the resolved cast modifiers onto the chain's context when an ability chain starts, so the cast's interactions, selectors, and forks read the fresh values from their first tick. Non-ability chains never touch the snapshot. The caster entity itself carries no snapshot: chains that outlive the cast take their copy at grant time instead (e.g. an ability charges buff).
    • resolve

      @Nullable public static ImpactModifiers resolve(@Nonnull InteractionContext context, @Nonnull Ref<EntityStore> actingRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Resolves the modifiers an interaction should use: the cast snapshot carried on the chain's context when the chain is an ability cast, otherwise the acting entity's component (e.g. a projectile carrying its launch's modifiers into its impact chains).
    • getAttribute

      public float getAttribute(@Nullable String name, float fallback)
      Returns:
      the resolved value of the named attribute, or fallback when the ability doesn't declare it.
    • getAttributes

      @Nullable public Map<String,Float> getAttributes()
    • getOnHitEffectIds

      @Nullable public String[] getOnHitEffectIds()
    • getElementalCauseId

      @Nullable public String getElementalCauseId()
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.