Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getComponentType()
- isInvulnerable()
- setInvulnerable(boolean)
- addEffect(Ref, EntityEffect, ComponentAccessor)
- addEffect(Ref, EntityEffect, ComponentAccessor, Ref)
- addEffect(Ref, int, EntityEffect, ComponentAccessor)
- addEffect(Ref, EntityEffect, float, OverlapBehavior, ComponentAccessor)
- addEffect(Ref, EntityEffect, float, OverlapBehavior, ComponentAccessor, Ref)
- addEffect(Ref, int, EntityEffect, float, OverlapBehavior, ComponentAccessor)
- addEffect(Ref, int, EntityEffect, float, OverlapBehavior, ComponentAccessor, Ref)
- addInfiniteEffect(Ref, int, EntityEffect, ComponentAccessor)
- setModelChange(Ref, EntityEffect, int, ComponentAccessor)
- tryResetModelChange(Ref, int, ComponentAccessor)
- addActiveEntityEffects(ActiveEntityEffect[])
- removeEffect(Ref, int, ComponentAccessor)
- removeEffect(Ref, int, RemovalBehavior, ComponentAccessor)
- clearEffects(Ref, ComponentAccessor)
- invalidateCache()
- getActiveEffects()
- getActiveEffectIndexes()
- consumeNetworkOutdated()
- consumeChanges()
- clearChanges()
- createInitUpdates()
- getAllActiveEntityEffects()
- hasEffect(EntityEffect)
- hasEffect(int)
- toString()
- clone()
Class EffectControllerComponent
java.lang.Object
com.hypixel.hytale.server.core.entity.effect.EffectControllerComponent
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
A component that lives on an entity for updating, adding and removing entity effects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<EffectControllerComponent> The codec used to parseEffectControllerComponentinstances.Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor for anEffectControllerComponentinstance.EffectControllerComponent(EffectControllerComponent effectControllerComponent) Constructor for anEffectControllerComponentinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActiveEntityEffects(ActiveEntityEffect[] activeEntityEffects) Called to add all active entity effects from the given array.booleanaddEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, EntityEffect entityEffect, float duration, OverlapBehavior overlapBehavior, ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.booleanaddEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, EntityEffect entityEffect, float duration, OverlapBehavior overlapBehavior, ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller, attributed to the entity that applied it.booleanaddEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, EntityEffect entityEffect, ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.booleanaddEffect(Ref<EntityStore> ownerRef, EntityEffect entityEffect, float duration, OverlapBehavior overlapBehavior, ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.booleanaddEffect(Ref<EntityStore> ownerRef, EntityEffect entityEffect, float duration, OverlapBehavior overlapBehavior, ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller, attributed to the entity that applied it.booleanaddEffect(Ref<EntityStore> ownerRef, EntityEffect entityEffect, ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.booleanaddEffect(Ref<EntityStore> ownerRef, EntityEffect entityEffect, ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller with its configured duration and overlap behavior, attributed to the entity that applied it.booleanaddInfiniteEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, EntityEffect entityEffect, ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect for an infinite amount of time.voidCalled to clear all entity effect changesvoidclearEffects(Ref<EntityStore> ownerRef, ComponentAccessor<EntityStore> componentAccessor) Called to clear all active entity effects from this controller.clone()Fetches all entity effect updates as a single array.booleanChecks and consumes whether the network is outdated.int[]Called to fetch an array of all active entity effect indexes.it.unimi.dsi.fastutil.ints.Int2ObjectMap<ActiveEntityEffect> Called to fetch an unmodifiable map of all active entity effects.Called to fetch all active entity effect instances for this controller.booleanhasEffect(int effectIndex) Checks whether this controller has an active effect matching the given entity effect index.booleanhasEffect(EntityEffect entityEffect) Checks whether this controller has an active effect matching the given entity effect.voidCalled to invalidate the cache of this controller.booleanvoidremoveEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, ComponentAccessor<EntityStore> componentAccessor) Called to remove an entity effect with the given index.voidremoveEffect(Ref<EntityStore> ownerRef, int entityEffectIndex, RemovalBehavior removalBehavior, ComponentAccessor<EntityStore> componentAccessor) Called to remove an entity effect with the given index.voidsetInvulnerable(boolean invulnerable) Sets whether any of the active effects provide invulnerability.voidsetModelChange(Ref<EntityStore> ownerRef, EntityEffect entityEffect, int entityEffectIndex, ComponentAccessor<EntityStore> componentAccessor) Sets model change from an entity effect, if present.toString()voidtryResetModelChange(Ref<EntityStore> ownerRef, int activeEffectIndex, ComponentAccessor<EntityStore> componentAccessor) Resets model change applied to the owner, if it was applied by this entity effect.Methods inherited from interface Component
cloneSerializable
-
Field Details
-
CODEC
The codec used to parseEffectControllerComponentinstances.
-
-
Constructor Details
-
EffectControllerComponent
public EffectControllerComponent()Empty Constructor for anEffectControllerComponentinstance.Used by the codec to parse
EffectControllerComponentinstances. -
EffectControllerComponent
Constructor for anEffectControllerComponentinstance.- Parameters:
effectControllerComponent- TheEffectControllerComponentinstance to clone from.
-
-
Method Details
-
getComponentType
- Returns:
- the component type for the
EffectControllerComponentcomponent.
-
isInvulnerable
public boolean isInvulnerable()- Returns:
trueif any of the active effects provide invulnerability,falseotherwise.
-
setInvulnerable
public void setInvulnerable(boolean invulnerable) Sets whether any of the active effects provide invulnerability.- Parameters:
invulnerable- Whether any of the active effects provide invulnerability.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, @Nonnull EntityEffect entityEffect, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffect- TheEntityEffectinstance to add.componentAccessor- The component accessor for the component access.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, @Nonnull EntityEffect entityEffect, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nullable Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller with its configured duration and overlap behavior, attributed to the entity that applied it. Owner attribution is not tracked for infinite effects.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffect- TheEntityEffectinstance to add.componentAccessor- The component accessor for component access.owner- The entity that owns the effect (the one that applied it), ornullwhen unknown.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull EntityEffect entityEffect, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect asset.entityEffect- TheEntityEffectinstance to add.componentAccessor- The component accessor for component access.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, @Nonnull EntityEffect entityEffect, float duration, @Nonnull OverlapBehavior overlapBehavior, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffect- TheEntityEffectinstance to add.duration- The duration, in seconds, of the entity effect.overlapBehavior- The overlap behaviour applied by the effect.componentAccessor- The component accessor for component access.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, @Nonnull EntityEffect entityEffect, float duration, @Nonnull OverlapBehavior overlapBehavior, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nullable Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller, attributed to the entity that applied it. Damage ticks from the effect credit the owner (combat text, kill credit) instead of the effect itself.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffect- TheEntityEffectinstance to add.duration- The duration, in seconds, of the entity effect.overlapBehavior- The overlap behaviour applied by the effect.componentAccessor- The component accessor for component access.owner- The entity that owns the effect (the one that applied it), ornullwhen unknown.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull EntityEffect entityEffect, float duration, @Nonnull OverlapBehavior overlapBehavior, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect to this entity effect controller.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect asset.entityEffect- TheEntityEffectinstance to add.duration- The duration, in seconds, of the entity effect.overlapBehavior- The overlap behaviour applied by the effect.componentAccessor- The component accessor for component access.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addEffect
public boolean addEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull EntityEffect entityEffect, float duration, @Nonnull OverlapBehavior overlapBehavior, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nullable Ref<EntityStore> owner) Called to add an entity effect to this entity effect controller, attributed to the entity that applied it.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect asset.entityEffect- TheEntityEffectinstance to add.duration- The duration, in seconds, of the entity effect.overlapBehavior- The overlap behaviour applied by the effect.componentAccessor- The component accessor for component access.owner- The entity that owns the effect (the one that applied it), ornullwhen unknown.- Returns:
trueif the effect was added successfully,falseotherwise.
-
addInfiniteEffect
public boolean addInfiniteEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull EntityEffect entityEffect, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to add an entity effect for an infinite amount of time.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect asset.entityEffect- TheEntityEffectinstance to be added.componentAccessor- TheComponentAccessor<EntityStore>for component access.- Returns:
trueif the effect was added successfully,falseotherwise.
-
setModelChange
public void setModelChange(@Nonnull Ref<EntityStore> ownerRef, @Nonnull EntityEffect entityEffect, int entityEffectIndex, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Sets model change from an entity effect, if present.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffect- the entity effect being applied.entityEffectIndex- the index of the entity effect being applied.componentAccessor- TheComponentAccessor<EntityStore>for component access.
-
tryResetModelChange
public void tryResetModelChange(@Nonnull Ref<EntityStore> ownerRef, int activeEffectIndex, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Resets model change applied to the owner, if it was applied by this entity effect.- Parameters:
ownerRef- The entity reference of the owner entity.activeEffectIndex- The index of the entity effect being removed.componentAccessor- The component accessor for component access.
-
addActiveEntityEffects
Called to add all active entity effects from the given array.- Parameters:
activeEntityEffects- The array of active entity effects to include.
-
removeEffect
public void removeEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to remove an entity effect with the given index.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect to be removed.componentAccessor- The component accessor for component access.
-
removeEffect
public void removeEffect(@Nonnull Ref<EntityStore> ownerRef, int entityEffectIndex, @Nonnull RemovalBehavior removalBehavior, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to remove an entity effect with the given index.- Parameters:
ownerRef- The entity reference of the owner entity.entityEffectIndex- The index of the entity effect to be removed.removalBehavior- Determines the removal behaviour.componentAccessor- The component accessor for component access.
-
clearEffects
public void clearEffects(@Nonnull Ref<EntityStore> ownerRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to clear all active entity effects from this controller.- Parameters:
ownerRef- The entity reference of the owner entity.componentAccessor- The component accessor for component access.
-
invalidateCache
public void invalidateCache()Called to invalidate the cache of this controller. -
getActiveEffects
Called to fetch an unmodifiable map of all active entity effects.- Returns:
- the unmodifiable map of all active entity effects.
-
getActiveEffectIndexes
public int[] getActiveEffectIndexes()Called to fetch an array of all active entity effect indexes.- Returns:
- an array of indexes for all active entity effects.
-
consumeNetworkOutdated
public boolean consumeNetworkOutdated()Checks and consumes whether the network is outdated.- Returns:
trueif the network is outdated,falseotherwise.
-
consumeChanges
Fetches all entity effect updates as a single array.- Returns:
- an array of entity effect updates.
-
clearChanges
public void clearChanges()Called to clear all entity effect changes -
createInitUpdates
- Returns:
- an array of entity effect updates based on the current active effects.
-
getAllActiveEntityEffects
Called to fetch all active entity effect instances for this controller.- Returns:
- an array of active entity effect instances.
-
hasEffect
Checks whether this controller has an active effect matching the given entity effect.- Parameters:
entityEffect- The entity effect to check for.- Returns:
trueif this controller has an active effect matching the given entity effect,falseotherwise.
-
hasEffect
public boolean hasEffect(int effectIndex) Checks whether this controller has an active effect matching the given entity effect index.- Parameters:
effectIndex- The entity effect asset index to check for.- Returns:
trueif this controller has an active effect matching the given entity effect,falseotherwise.
-
toString
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-