Interface ICollisionEntity

All Superinterfaces:
IEntity
All Known Subinterfaces:
ICombatEntity, IMobileEntity
All Known Implementing Classes:
CollisionBox, CollisionEntity, CombatEntity, Creature, Prop, Trigger

public interface ICollisionEntity extends IEntity
  • Method Details

    • onCollision

      void onCollision(CollisionListener listener)
      Registers a CollisionListener to this entity. The listener will be notified whenever this entity collides with another ICollisionEntity.
      Parameters:
      listener - The CollisionListener to be added to this entity. It should not be null.
    • removeCollisionListener

      void removeCollisionListener(CollisionListener listener)
      Removes a previously registered CollisionListener from this entity. After removal, the listener will no longer receive collision events involving this entity.
      Parameters:
      listener - The CollisionListener to be removed. It should match a listener that was previously added with onCollision(CollisionListener).
    • fireCollisionEvent

      void fireCollisionEvent(CollisionEvent event)
      Triggers a collision event for this entity. This method is used to manually fire a collision event, which can be useful for custom collision handling or for simulating collisions in specific scenarios.
      Parameters:
      event - The CollisionEvent that encapsulates the details of the collision. This includes information such as the entities involved in the collision and the collision's impact point.
    • canCollideWith

      boolean canCollideWith(ICollisionEntity otherEntity)
      Determines if this entity can collide with another specified ICollisionEntity. This method should be implemented to define custom collision logic between entities.
      Parameters:
      otherEntity - The other ICollisionEntity to check collision capability with.
      Returns:
      true if this entity can collide with the specified entity; false otherwise.
    • getCollisionBox

      Rectangle2D getCollisionBox()
      Gets the collision box.
      Returns:
      the collision box
    • getCollisionBox

      Rectangle2D getCollisionBox(Point2D location)
      Gets the collision box.
      Parameters:
      location - the location
      Returns:
      the collision box
    • getCollisionBoxCenter

      Point2D getCollisionBoxCenter()
      Gets the center Point2D of the entities collision box.
      Returns:
      The center Point2D of the entities collision box
    • getCollisionBoxValign

      Valign getCollisionBoxValign()
      Retrieves the vertical alignment of the entity's collision box. This alignment determines the vertical positioning of the collision box relative to the entity's location.
      Returns:
      The Valign representing the vertical alignment of the collision box.
    • getCollisionBoxAlign

      Align getCollisionBoxAlign()
      Retrieves the horizontal alignment of the entity's collision box. This alignment determines the horizontal positioning of the collision box relative to the entity's location.
      Returns:
      The Align representing the horizontal alignment of the collision box.
    • getCollisionType

      Collision getCollisionType()
      Retrieves the collision type of this entity. The collision type defines how this entity interacts with other entities in terms of physical collisions.
      Returns:
      The Collision type of this entity, indicating how it should be treated in collision detection and handling.
    • getCollisionBoxHeight

      double getCollisionBoxHeight()
      Retrieves the height of the entity's collision box. This height is used in collision detection to determine the vertical bounds of the entity.
      Returns:
      The height of the collision box in pixels.
    • getCollisionBoxWidth

      double getCollisionBoxWidth()
      Retrieves the width of the entity's collision box. This width is used in collision detection to determine the horizontal bounds of the entity.
      Returns:
      The width of the collision box in pixels.
    • hasCollision

      boolean hasCollision()
      Checks if the entity has collision enabled.
      Returns:
      true if the entity has collision enabled; false otherwise.
    • setCollision

      void setCollision(boolean collision)
      Sets the collision state of the entity.
      Parameters:
      collision - The collision state to set. true to enable collision; false to disable it.
    • setCollisionBoxHeight

      void setCollisionBoxHeight(double collisionBoxHeight)
      Sets the height of the entity's collision box.
      Parameters:
      collisionBoxHeight - The height of the collision box in pixels.
    • setCollisionBoxWidth

      void setCollisionBoxWidth(double collisionBoxWidth)
      Sets the width of the entity's collision box.
      Parameters:
      collisionBoxWidth - The width of the collision box in pixels.
    • setCollisionBoxAlign

      void setCollisionBoxAlign(Align align)
      Sets the horizontal alignment of the entity's collision box.
      Parameters:
      align - The Align representing the horizontal alignment of the collision box.
    • setCollisionBoxValign

      void setCollisionBoxValign(Valign valign)
      Sets the vertical alignment of the entity's collision box.
      Parameters:
      valign - The Valign representing the vertical alignment of the collision box.
    • setCollisionType

      void setCollisionType(Collision collisionType)
      Sets the collision type of this entity.
      Parameters:
      collisionType - The Collision type indicating how this entity should be treated in collision detection and handling.