Interface IEntity

All Known Subinterfaces:
ICollisionEntity, ICombatEntity, IMobileEntity
All Known Implementing Classes:
CollisionBox, CollisionEntity, CombatEntity, Creature, Emitter, Entity, EntityEmitter, LightSource, MapArea, Prop, SoundSource, Spawnpoint, StaticShadow, Trigger

public interface IEntity
  • Method Details

    • onMessage

      void onMessage(EntityMessageListener listener)
    • onMessage

      void onMessage(String message, EntityMessageListener listener)
    • addTransformListener

      void addTransformListener(EntityTransformListener listener)
    • addListener

      void addListener(EntityListener listener)
    • removeListener

      void removeListener(EntityMessageListener listener)
    • removeListener

      void removeListener(EntityTransformListener listener)
    • removeListener

      void removeListener(EntityListener listener)
    • onRendered

      void onRendered(EntityRenderedListener listener)
      Adds the specified entity rendered listener to receive events when entities were rendered.
      Parameters:
      listener - The listener to add.
    • removeListener

      void removeListener(EntityRenderedListener listener)
      Removes the specified entity rendered listener.
      Parameters:
      listener - The listener to remove.
    • addEntityRenderListener

      void addEntityRenderListener(EntityRenderListener listener)
      Adds the specified entity render listener to receive events and callbacks about the rendering process of entities.
      Parameters:
      listener - The listener to add.
    • removeListener

      void removeListener(EntityRenderListener listener)
      Removes the specified entity render listener.
      Parameters:
      listener - The listener to remove.
    • getAngle

      double getAngle()
    • setAngle

      void setAngle(double angle)
      Sets the angle (in degrees) in which the entity is directed.
      Parameters:
      angle - the new angle in degrees
    • animations

      Gets the entities animation controller.
      Returns:
      The entities animation controller or null if none was registered.
      See Also:
    • isVisible

      boolean isVisible()
    • setVisible

      void setVisible(boolean visible)
    • behavior

    • addController

      void addController(IEntityController controller)
    • setController

      <T extends IEntityController> void setController(Class<T> clss, T controller)
    • getController

      <T extends IEntityController> T getController(Class<T> clss)
    • actions

      EntityActionMap actions()
      All registered actions of this entity.
      Returns:
      The EntityActionMap that holds all registered EntityActions for this instance.
      See Also:
    • perform

      void perform(String actionName)
      Performs an EntityAction that was previously registered for this entity.

      Does nothing in case no action has been registered for the specified actionName.

      Parameters:
      actionName - The name of the action to be performed.
      See Also:
    • register

      EntityAction register(String name, Runnable action)
      Registers an EntityAction with the specified name. It's later possible to execute these actions on the entity by using the Entity.perform(String actionName) method.
      Parameters:
      name - The name of the action to be registered.
      action - The action to be performed by the entity.
      Returns:
      The created EntityAction instance; or null if the name or action parameter were invalid.
      See Also:
    • detachControllers

      void detachControllers()
    • attachControllers

      void attachControllers()
    • getBoundingBox

      Rectangle2D getBoundingBox()
    • getCenter

      Point2D getCenter()
    • getHeight

      double getHeight()
    • getLocation

      Point2D getLocation()
    • getMapId

      int getMapId()
    • getName

      String getName()
      Gets the name of this entity.
      Returns:
      The name of this entity.
    • getRenderType

      RenderType getRenderType()
    • renderWithLayer

      boolean renderWithLayer()
      Determines whether this entity is being rendered with the layer it's originating from. This ignores the specified RenderType and makes the entity dependent upon the visibility of it's layer.

      This can only be used, of course, if the entity is related to a MapObject.
      This defaults to false if not explicitly set on the MapObject.

      Returns:
      True if the entity should be rendered with the layer of the corresponding map object; otherwise false.
      See Also:
    • getWidth

      double getWidth()
    • getX

      double getX()
    • getY

      double getY()
    • sendMessage

      String sendMessage(Object sender, String message)
    • setHeight

      void setHeight(double height)
    • setLocation

      void setLocation(double x, double y)
    • hasTag

      boolean hasTag(String tag)
    • getTags

      List<String> getTags()
    • addTag

      void addTag(String tag)
    • removeTag

      void removeTag(String tag)
    • setLocation

      void setLocation(Point2D location)
      Sets the map location.
      Parameters:
      location - the new map location
    • setMapId

      void setMapId(int mapId)
      Sets an id which should only be filled when an entity gets added due to map information.
      Parameters:
      mapId - The unique map ID for this IEntity
    • setName

      void setName(String name)
    • setRenderType

      void setRenderType(RenderType renderType)
    • setRenderWithLayer

      void setRenderWithLayer(boolean renderWithLayer)
    • setSize

      void setSize(double width, double height)
    • setWidth

      void setWidth(double width)
    • setX

      void setX(double x)
    • setY

      void setY(double y)
    • getProperties

      ICustomPropertyProvider getProperties()
    • getEnvironment

      Environment getEnvironment()
      Gets the environment the entity was loaded to or null if it is not loaded.
      Returns:
      The entity's environment.
    • loaded

      void loaded(Environment environment)
      This method provides the possibility to implement behavior whenever this entity was added to the environment.
      Parameters:
      environment - The environment that the entity was added to
      See Also:
    • removed

      void removed(Environment environment)
      This method provides the possibility to implement behavior whenever this entity was removed from the environment.
      Parameters:
      environment - The environment that the entity was removed from
      See Also:
    • isLoaded

      boolean isLoaded()
      Indicates whether this entity is loaded on the currently active environment.
      Returns:
      True if the entity is loaded on the game's currently active environment; otherwise false.
      See Also: