Class Entity

java.lang.Object
com.welcome234.pluginsystem.entity.Entity
Direct Known Subclasses:
CorruptionBoss, Cow, EndBoss, Pig, Sheep, Slime

public class Entity extends Object
Represents an entity, any type
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the type for this entity
    int
    Gets the number of health points this entity has
    double
    Gets the height of this entity
    int
    Gets the unique identifier for this entity
    int
    Gets the maximum health of this entity
    double
    Gets the width of this entity
    double
    Gets the current X-coordinate of this entity
    double
    Gets the current Y-coordinate of this entity
    boolean
    Gets if this entity is alive and loaded
    boolean
    Gets whether the entity is currently in the end dimension
    void
    Removes this entity completely
    void
    setHealth​(int health)
    Sets the number of health points of this entity
    void
    setPos​(double x, double y, boolean endDimension)
    Sets the current position of this entity

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getEntityType

      public EntityTypes getEntityType()
      Gets the type for this entity
      Returns:
      Entity type
    • isAlive

      public boolean isAlive()
      Gets if this entity is alive and loaded
      Returns:
      Whether alive
    • getID

      public int getID()
      Gets the unique identifier for this entity
      Returns:
      Unique entity ID
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getX

      public double getX()
      Gets the current X-coordinate of this entity
      Returns:
      X-coordinate position
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getY

      public double getY()
      Gets the current Y-coordinate of this entity
      Returns:
      Y-coordinate position
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getWidth

      public double getWidth()
      Gets the width of this entity
      Returns:
      Width in blocks
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getHeight

      public double getHeight()
      Gets the height of this entity
      Returns:
      Height in blocks
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • isInEnd

      public boolean isInEnd()
      Gets whether the entity is currently in the end dimension
      Returns:
      Whether in end dimension
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • setPos

      public void setPos(double x, double y, boolean endDimension)
      Sets the current position of this entity

      If the chunk containing the position is not loaded, it will be automatically loaded when calling this.

      Parameters:
      x - X-coordinate of the entity
      y - Y-coordinate of the entity
      endDimension - Dimension of this entity (false = Overworld, true = End)
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getMaximumHealth

      public int getMaximumHealth()
      Gets the maximum health of this entity
      Returns:
      Maximum health points
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • getHealth

      public int getHealth()
      Gets the number of health points this entity has
      Returns:
      Health points
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • setHealth

      public void setHealth(int health)
      Sets the number of health points of this entity
      Parameters:
      health - Health points
      Throws:
      IllegalStateException - if entity is not loaded or alive
    • remove

      public void remove()
      Removes this entity completely
      Throws:
      IllegalStateException - if entity is not loaded or alive