Class Entity
java.lang.Object
com.welcome234.pluginsystem.entity.Entity
Represents an entity, any type
-
Method Summary
Modifier and TypeMethodDescriptionGets the type for this entityintGets the number of health points this entity hasdoubleGets the height of this entityintgetID()Gets the unique identifier for this entityintGets the maximum health of this entitydoublegetWidth()Gets the width of this entitydoublegetX()Gets the current X-coordinate of this entitydoublegetY()Gets the current Y-coordinate of this entitybooleanisAlive()Gets if this entity is alive and loadedbooleanisInEnd()Gets whether the entity is currently in the end dimensionvoidremove()Removes this entity completelyvoidsetHealth(int health)Sets the number of health points of this entityvoidsetPos(double x, double y, boolean endDimension)Sets the current position of this entity
-
Method Details
-
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 entityIf the chunk containing the position is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of the entityy- Y-coordinate of the entityendDimension- 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
-