Class ThrowableEntity

java.lang.Object
org.geysermc.connector.entity.Entity
org.geysermc.connector.entity.ThrowableEntity
All Implemented Interfaces:
Tickable
Direct Known Subclasses:
FishingHookEntity, ItemedFireballEntity, ItemEntity, ThrowableItemEntity

public class ThrowableEntity extends Entity implements Tickable
Used as a class for any object-like entity that moves as a projectile
  • Field Details

    • lastJavaPosition

      protected com.nukkitx.math.vector.Vector3f lastJavaPosition
  • Constructor Details

    • ThrowableEntity

      public ThrowableEntity(long entityId, long geyserId, EntityType entityType, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f motion, com.nukkitx.math.vector.Vector3f rotation)
  • Method Details

    • tick

      public void tick(GeyserSession session)
      Updates the position for the Bedrock client. Java clients assume the next positions of moving items. Bedrock needs to be explicitly told positions
      Specified by:
      tick in interface Tickable
    • moveAbsoluteImmediate

      protected void moveAbsoluteImmediate(GeyserSession session, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f rotation, boolean isOnGround, boolean teleported)
    • getGravity

      protected float getGravity(GeyserSession session)
      Get the gravity of this entity type. Used for applying gravity while the entity is in motion.
      Parameters:
      session - the session of the Bedrock client.
      Returns:
      the amount of gravity to apply to this entity while in motion.
    • getDrag

      protected float getDrag(GeyserSession session)
      Parameters:
      session - the session of the Bedrock client.
      Returns:
      the drag that should be multiplied to the entity's motion
    • isInWater

      protected boolean isInWater(GeyserSession session)
      Parameters:
      session - the session of the Bedrock client.
      Returns:
      true if this entity is currently in water.
    • despawnEntity

      public boolean despawnEntity(GeyserSession session)
      Description copied from class: Entity
      Despawns the entity
      Overrides:
      despawnEntity in class Entity
      Parameters:
      session - The GeyserSession
      Returns:
      can be deleted
    • moveRelative

      public void moveRelative(GeyserSession session, double relX, double relY, double relZ, com.nukkitx.math.vector.Vector3f rotation, boolean isOnGround)
      Overrides:
      moveRelative in class Entity
    • moveAbsolute

      public void moveAbsolute(GeyserSession session, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f rotation, boolean isOnGround, boolean teleported)
      Overrides:
      moveAbsolute in class Entity