Class TriggerEffect

java.lang.Object
com.hypixel.hytale.builtin.triggervolumes.effect.TriggerEffect
Direct Known Subclasses:
CancelParticlesEffect, ClearRespawnPointsEffect, ControlDoorsEffect, DamageEntityEffect, EntityEffectEffect, GiveItemEffect, ModifyTagsEffect, PastePrefabEffect, PlaceBlockEffect, PlayAnimationEffect, PlaySoundEffect, PlayVfxEffect, RemoveEntitiesEffect, ReplaceBlockTypeEffect, RunRootInteractionEffect, SendMessageEffect, SendSignalEffect, SetGameModeEffect, SetMusicEffect, SetRespawnPointEffect, SetVelocityEffect, SetWeatherEffect, SetWorldSpawnEffect, ShowEventTitleEffect, SpawnNpcEffect, TeleportEffect, TimeEffect, TriggerNpcMarkersEffect, VolumeStateEffect

public abstract class TriggerEffect extends Object
Base class for trigger volume effects. Subclasses define behavior that runs when entities enter, tick inside, or exit a trigger volume. Implementing a new effect: 1. Extend this class and define a BuilderCodec that chains from BASE_CODEC (inherits Event and Interval). 2. Register the codec in TriggerVolumesPlugin.registerEffectTypes() via TriggerEffect.CODEC.register("MyType", MyEffect.class, MyEffect.CODEC). 3. Override execute() (and optionally onEntityExit()). Field initialization constraints: - All codec fields are optional — missing keys decode to null for reference types and JVM defaults for primitives. - Reference-type fields (Vector3d, String, etc.) should be initialized to a sensible non-null default. The effect editor UI displays zeros/empty for unset fields but does not write them to the object unless the user interacts with the input, so a null field will be silently omitted when the effect is saved to disk. - execute() must null-guard any reference field that could still be null after deserialization (e.g. from hand-edited JSON missing the key).
  • Field Details

  • Constructor Details

    • TriggerEffect

      public TriggerEffect()
  • Method Details

    • deepCopy

      @Nonnull public static TriggerEffect deepCopy(@Nonnull TriggerEffect effect)
    • deepCopyList

      @Nonnull public static List<TriggerEffect> deepCopyList(@Nonnull List<TriggerEffect> effects)
    • getEventType

      @Nonnull public TriggerEventType getEventType()
    • setEventType

      public void setEventType(@Nonnull TriggerEventType eventType)
    • getInterval

      public float getInterval()
    • setInterval

      public void setInterval(float interval)
    • getDelay

      public float getDelay()
    • setDelay

      public void setDelay(float delay)
    • getEntry

      public int getEntry()
    • setEntry

      public void setEntry(int entry)
    • execute

      public abstract void execute(@Nonnull TriggerContext context)
    • rotateInPlace

      public void rotateInPlace(float yawRadians, @Nonnull org.joml.Vector3d volumeOrigin)
      Rotates volume-anchored offsets and facings when a prefab paste or world-gen placement applies a yaw to the owning volume. The yaw follows the entity transform convention: world offsets move like Vector3d.rotateY(double). World-, entity-, and event-anchored fields must stay unchanged. volumeOrigin is the post-rotation volume origin, needed by block-grid effects to rotate about the target cell center.
    • onEntityExit

      public void onEntityExit(@Nonnull UUID entityUuid)