Interface ITelegraphInstance


  • public interface ITelegraphInstance
    A runtime instance of an active telegraph in the world. Represents a spawned telegraph with position, timing, and control methods.

    Instances are created when you call spawn() on an ITelegraph:

     var telegraph = API.getTelegraphs().createCircle(5.0);
     var instance = telegraph.spawn(world, x, y, z);
    
     // Later...
     instance.remove(); // Remove the telegraph early
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void followEntity​(IEntity entity)
      Make this telegraph follow an entity.
      String getInstanceId()
      Get the unique instance ID.
      float getProgress()
      Get the progress from 0.0 (just started) to 1.0 (finished).
      int getRemainingTicks()
      Get the remaining ticks before the telegraph expires.
      int getTotalTicks()
      Get the total duration ticks.
      double getX()
      Get the current X position.
      double getY()
      Get the current Y position.
      float getYaw()
      Get the rotation yaw.
      double getZ()
      Get the current Z position.
      boolean isFollowing()
      Check if this telegraph is following an entity.
      boolean isWarning()
      Check if the telegraph is in the warning phase.
      void lockPosition()
      Lock the telegraph at its current position.
      void remove()
      Remove this telegraph immediately.
      void setPosition​(double x, double y, double z)
      Set the position.
      void stopFollowing()
      Stop following any entity and fix the current position.
    • Method Detail

      • getInstanceId

        String getInstanceId()
        Get the unique instance ID.
        Returns:
        the unique instance identifier
      • getX

        double getX()
        Get the current X position.
        Returns:
        the current X coordinate
      • getY

        double getY()
        Get the current Y position.
        Returns:
        the current Y coordinate
      • getZ

        double getZ()
        Get the current Z position.
        Returns:
        the current Z coordinate
      • getYaw

        float getYaw()
        Get the rotation yaw.
        Returns:
        the rotation yaw in degrees
      • setPosition

        void setPosition​(double x,
                         double y,
                         double z)
        Set the position. Note: Only works for static telegraphs (not following an entity).
        Parameters:
        x - X coordinate
        y - Y coordinate
        z - Z coordinate
      • followEntity

        void followEntity​(IEntity entity)
        Make this telegraph follow an entity. The telegraph position will update each tick to match the entity.
        Parameters:
        entity - the entity to follow
      • stopFollowing

        void stopFollowing()
        Stop following any entity and fix the current position.
      • isFollowing

        boolean isFollowing()
        Check if this telegraph is following an entity.
        Returns:
        true if currently following an entity
      • getRemainingTicks

        int getRemainingTicks()
        Get the remaining ticks before the telegraph expires.
        Returns:
        remaining ticks before expiration
      • getTotalTicks

        int getTotalTicks()
        Get the total duration ticks.
        Returns:
        the total duration in ticks
      • getProgress

        float getProgress()
        Get the progress from 0.0 (just started) to 1.0 (finished).
        Returns:
        progress from 0.0 (just started) to 1.0 (finished)
      • isWarning

        boolean isWarning()
        Check if the telegraph is in the warning phase.
        Returns:
        true if in the warning phase
      • remove

        void remove()
        Remove this telegraph immediately. Sends a removal packet to all clients tracking it.
      • lockPosition

        void lockPosition()
        Lock the telegraph at its current position. Equivalent to calling stopFollowing().