Interface Entity<T extends Entity<?>>

Type Parameters:
T - Options are either LiveEntity or EntitySnapshot
All Superinterfaces:
Positionable<SyncExactPosition>
All Known Subinterfaces:
AbstractHuman<E>, AgeableEntity<E>, AnimalEntity<E>, ArmoredEntity<E>, AttachableEntity<E>, BasicVillagerEntity<E>, Bat<E>, BatSnapshot, Chicken<E>, ChickenSnapshot, ClassicZombie<E>, ClassicZombieSnapshot, Cod<E>, CodSnapshot, Cow<E>, CowSnapshot, Creature<E>, CreeperEntity<E>, CreeperEntitySnapshot, DroppedItem<E>, DroppedItemSnapshot, EntitySnapshot<E>, EntitySnapshot.NoneDestructibleSnapshot<E>, FishEntity<E>, HostileEntity<E>, Human<E>, HumanSnapshot, InventoryHoldingEntity<E>, ItemFrame<E>, ItemFrameSnapshot, ItemHoldingEntity<E>, ItemProjectileEntity<E>, LiveBat, LiveChicken, LiveClassicZombie, LiveCod, LiveCow, LiveCreeperEntity, LiveDroppedItem, LiveEntity, LiveHuman, LiveItemFrame, LiveMinecart, LiveParrot, LivePlayer, LiveRideableMinecart, LiveSnowballEntity, LivingEntity<E>, Merchant<E>, Minecart<E>, MinecartSnapshot, Parrot<T>, ParrotSnapshot, Player<E>, PlayerSnapshot, ProjectileEntity<E>, RideableMinecart<E>, SnowballEntity<E>, SnowballEntitySnapshot, Tamer<E>, TargetableEntity<E>, WaterEntity<T>, Zombie<E>, ZombieVillager<E>

public interface Entity<T extends Entity<?>> extends Positionable<SyncExactPosition>
Class to represent all Entity types within the Minecraft game
  • Method Details

    • addPassengers

      Entity<T> addPassengers(Collection<? extends T> entities)
      Adds passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.
      Parameters:
      entities - Collection of entities to add
      Returns:
      itself for chaining
    • addPassengers

      default Entity<T> addPassengers(T... entities)
      Adds passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.
      Parameters:
      entities - Collection of entities to add
      Returns:
      itself for chaining
    • clearPassengers

      default Entity<T> clearPassengers()
      Removes all passengers from the entity
      Returns:
      itself for chaining
    • createSnapshot

      EntitySnapshot<? extends LiveEntity> createSnapshot()
      Create a snapshot of this instance of the entity
      Returns:
      The created snapshot
    • getAttachedTo

      default Optional<SyncBlockPosition> getAttachedTo()
      Gets the block that the entity is attached to, this could be the block that the entity is standing on
      Returns:
      The attached block if present
    • setCustomName

      Entity<T> setCustomName(@Nullable @Nullable net.kyori.adventure.text.Component component)
    • setCustomName

      default Entity<T> setCustomName(@Nullable @Nullable net.kyori.adventure.text.ComponentLike like)
    • getCustomNameComponent

      Optional<net.kyori.adventure.text.Component> getCustomNameComponent()
    • getFacingDirection

      default Direction getFacingDirection()
      Gets the position the entity is facing in as a Direction
      Returns:
      A direction of the entities facing direction
    • getPassengers

      Collection<T> getPassengers()
      Gets the passengers of the entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of the entity, if a snapshot is created of a live entity then the passengers will be stored with the created snapshot. And restored as different instances when the snapshot is restored
      Returns:
      A collection of all passengers
    • getPitch

      double getPitch()
      Gets the current pitch of the entity
      Returns:
      the current pitch of the entity
    • setPitch

      Entity<T> setPitch(double value)
      Sets the pitch of the entities rotation
      Parameters:
      value - The pitch to be
      Returns:
      Itself for chaining
    • getPosition

      SyncExactPosition getPosition()
      Gets the position the entity is.
      Specified by:
      getPosition in interface Positionable<T extends Entity<?>>
      Returns:
      The Exact Position the entity is
    • getRoll

      double getRoll()
      Gets the roll of the entity, note that as Bukkit does not support roll, then the result will be 0
      Returns:
      The roll of the entity
    • setRoll

      Entity<T> setRoll(double value)
      Sets the Roll of the entities rotation. Note that bukkit does not support roll, therefore there will be no result in Bukkit
      Parameters:
      value - the roll to be
      Returns:
      Itself for chaining
    • getType

      <E extends LiveEntity> EntityType<E,​? extends EntitySnapshot<E>> getType()
      Gets the type of the entity
      Type Parameters:
      E - Itself as a LiveEntity
      Returns:
      The Entity Type
    • getVelocity

      Vector3<Double> getVelocity()
      Gets the current velocity of the entity
      Returns:
      The current velocity
    • setVelocity

      Entity<T> setVelocity(Vector3<Double> velocity)
      Sets the velocity of the entity
      Parameters:
      velocity - the velocity to be
      Returns:
      itself for chaining
    • getYaw

      double getYaw()
      Gets the yaw of the current entity
      Returns:
      the current yaw of the entity
    • setYaw

      Entity<T> setYaw(double value)
      Sets the Yaw of the entities rotation
      Parameters:
      value - The yaw to be
      Returns:
      Itself for chaining
    • hasGravity

      boolean hasGravity()
      Checks if the entity has gravity
      Returns:
      if the entity has gravity
    • hasPassengers

      default boolean hasPassengers()
      Checks if this entity has any passengers
      Returns:
      if this has passengers
    • isCustomNameVisible

      boolean isCustomNameVisible()
      Checks if the custom name should be visible
      Returns:
      if the custom name is visible
    • setCustomNameVisible

      Entity<T> setCustomNameVisible(boolean visible)
      Sets if the custom name should be visible
      Parameters:
      visible - if the name should be visible
      Returns:
      itself for chaining
    • isOnGround

      boolean isOnGround()
      Checks if the entity is on ground
      Returns:
      If the entity is on the ground
    • isRemoved

      boolean isRemoved()
    • removePassengers

      Entity<T> removePassengers(Collection<T> entities)
      Removes passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.
      Parameters:
      entities - Collection of entities to remove
      Returns:
      itself for chaining
    • removePassengers

      default Entity<T> removePassengers(T... entities)
      Removes passengers to the current entity. The passengers must be of the same type (as in LiveEntity or EntitySnapshot) of this entity.
      Parameters:
      entities - Collection of entities to remove
      Returns:
      itself for chaining
    • setGravity

      Entity<T> setGravity(boolean check)
      Sets if the entity has gravity or not
      Parameters:
      check - If the entity should have gravity
      Returns:
      itself for chaining
    • setPosition

      boolean setPosition(@NotNull @NotNull Position<? extends Number> position)
      Sets the position for the entity to be in.

      Note that platforms that hold more then position information in the Position class will be applied to the entity too. Such as, Bukkits Location holds rotation data, therefore this should be set first and then the rotation data.

      Parameters:
      position - The position for the entity to be in
      Returns:
      was successful
    • setPosition

      default boolean setPosition(@NotNull @NotNull Vector3<? extends Number> vector)
      Sets the position of the entity without the need of a Position, this maintains the world that the entity is in
      Parameters:
      vector - the new position
      Returns:
      was successful
    • setPosition

      default boolean setPosition(@NotNull @NotNull Positionable<? extends Position<? extends Number>> positionable)
    • setPosition

      default boolean setPosition(double x, double y, double z)
      Sets the position of the entity without the need of a Position, this maintains the world that the entity is in
      Parameters:
      x - The X position of the world
      y - The Y position of the world
      z - The Z position of the world
      Returns:
      info about the teleport
    • setVelocity

      default Entity<T> setVelocity(double x, double y, double z)
      Sets the velocity of the entity without the need of a Vector
      Parameters:
      x - the X speed
      y - the Y speed
      z - the Z speed
      Returns:
      itself for chaining