Class Projectile

java.lang.Object
dev.twilite.game.wrapper.Projectile
All Implemented Interfaces:
Id, Unit

public class Projectile extends Object implements Unit, Id
Projectile moving through the world.
  • Constructor Details

    • Projectile

      public Projectile(dev.twilite.game.internal.memory.RSProjectile memory, World world)
      Wraps a native projectile provider.
  • Method Details

    • id

      public int id()
      Returns the projectile id.
      Specified by:
      id in interface Id
    • constantName

      public String constantName()
      Description copied from interface: Id
      Returns the generated gameval constant name for Id.id(), or the numeric id as text when no constant is known.

      This is intended for logs and diagnostics where a stable symbolic name is easier to read than a raw number.

      Specified by:
      constantName in interface Id
    • source

      public Optional<? extends Actor<?>> source()
      Resolves the actor that launched the projectile.
    • target

      public Optional<? extends Actor<?>> target()
      Resolves the actor targeted by the projectile.
    • duration

      public int duration()
      Returns the total projectile duration in game ticks.
    • elapsed

      public int elapsed()
      Returns the elapsed projectile duration in game ticks.
    • remaining

      public int remaining()
      Returns the remaining projectile duration in game ticks.
    • originCoord

      public Coord originCoord()
      Returns the projectile origin coordinate from its origin fields.
    • targetCoord

      public Coord targetCoord()
      Returns the projectile target coordinate from its target fields.
    • world

      public World world()
      Description copied from interface: Unit
      Returns the world this unit belongs to.
      Specified by:
      world in interface Unit
    • coord

      public Coord coord()
      Description copied from interface: Unit
      Returns this unit's world coordinate.
      Specified by:
      coord in interface Unit
    • fine

      public Coord.Fine fine()
      Description copied from interface: Unit
      Returns this unit's fine coordinate, representing its model location.
      Specified by:
      fine in interface Unit
    • map

      public Coord.Map map()
      Description copied from interface: Unit
      Returns this unit's map coordinate relative to the loaded world area.
      Specified by:
      map in interface Unit