Skip to main content

Overview

Entities represent all moving objects in Minestom including players, mobs, items, and projectiles.

Entity Class

Base class for all entities in the game.

Entity Creation

Entity(EntityType)
constructor
Creates a new entity with a random UUID.Parameters:
  • entityType - The type of entity to create
Entity zombie = new EntityCreature(EntityType.ZOMBIE);
Entity(EntityType, UUID)
constructor
Creates an entity with a specific UUID.Parameters:
  • entityType - The entity type
  • uuid - The entity UUID

Spawning & Despawning

setInstance(Instance, Pos)
CompletableFuture<Void>
Spawns the entity in an instance at the specified position.Parameters:
  • instance - The instance to spawn in
  • spawnPosition - The spawn position
Returns: Future completed when entity is spawnedThrows: IllegalStateException if instance is not registered
Entity entity = new EntityCreature(EntityType.ZOMBIE);
entity.setInstance(instance, new Pos(0, 42, 0)).thenRun(() -> {
    System.out.println("Entity spawned!");
});
setInstance(Instance)
CompletableFuture<Void>
Changes the entity’s instance, keeping current position.Parameters:
  • instance - The new instance
Returns: Future completed when transfer is done
remove()
void
Removes the entity temporarily (can respawn).
entity.remove();
remove(boolean)
void
Removes the entity with optional permanent removal.Parameters:
  • permanent - true for permanent removal

Position & Movement

teleport(Pos)
CompletableFuture<Void>
Teleports the entity to a position.Parameters:
  • position - The target position
Returns: Future completed when teleport finishes
entity.teleport(new Pos(10, 64, 10));
teleport(Pos, Vec)
CompletableFuture<Void>
Teleports with velocity.Parameters:
  • position - Target position
  • velocity - New velocity vector
Returns: Future completed when teleport finishes
getPosition()
Pos
Gets the current entity position.Returns: The entity position (includes yaw/pitch)
Pos pos = entity.getPosition();
System.out.println("Entity at: " + pos.x() + ", " + pos.y() + ", " + pos.z());
setVelocity(Vec)
void
Sets the entity velocity and fires EntityVelocityEvent.Parameters:
  • velocity - The velocity in blocks/second
entity.setVelocity(new Vec(0, 10, 0)); // Launch upward
getVelocity()
Vec
Gets the entity velocity.Returns: Velocity vector in blocks/second
setView(float, float)
void
Changes the entity’s view direction.Parameters:
  • yaw - Horizontal rotation
  • pitch - Vertical rotation
entity.setView(90f, 0f); // Face east
lookAt(Point)
void
Makes the entity look at a specific position.Parameters:
  • point - The point to look at
entity.lookAt(player.getPosition());
lookAt(Entity)
void
Makes the entity look at another entity.Parameters:
  • entity - The entity to look at
Throws: IllegalArgumentException if entities are in different instances

Entity Properties

getEntityId()
int
Gets the unique entity ID (server-wide, changes on restart).Returns: The entity ID
getUuid()
UUID
Gets the entity UUID.Returns: The entity UUID
getEntityType()
EntityType
Gets the entity type.Returns: The EntityType
if (entity.getEntityType() == EntityType.ZOMBIE) {
    // Handle zombie
}
getInstance()
Instance
Gets the entity’s current instance.Returns: The instance, or null if not spawned
getChunk()
Chunk
Gets the chunk the entity is in.Returns: The current chunk, or null
isOnGround()
boolean
Checks if the entity is on the ground.Returns: true if on ground
isRemoved()
boolean
Checks if the entity has been removed.Returns: true if removed
isActive()
boolean
Checks if the entity has been added to an instance.Returns: true if active (spawned)

Physics

hasPhysics()
boolean
Checks if physics calculations are enabled.Returns: true if physics are enabled
setHasPhysics(boolean)
void
Enables or disables physics calculations.Parameters:
  • hasPhysics - true to enable physics
entity.setHasPhysics(false); // Disable gravity/collisions
hasNoGravity()
boolean
Checks if the entity ignores gravity.Returns: true if gravity is disabled
setNoGravity(boolean)
void
Sets whether the entity should ignore gravity.Parameters:
  • noGravity - true to disable gravity
getBoundingBox()
BoundingBox
Gets the entity’s collision bounding box.Returns: The BoundingBox
setBoundingBox(double, double, double)
void
Sets the entity bounding box dimensions.Parameters:
  • width - Box width (X)
  • height - Box height (Y)
  • depth - Box depth (Z)

Passengers & Vehicles

addPassenger(Entity)
void
Adds a passenger to this entity.Parameters:
  • entity - The entity to add as passenger
Throws: IllegalStateException if instance is null or entity is the vehicle
Entity minecart = new Entity(EntityType.MINECART);
minecart.setInstance(instance, pos);
minecart.addPassenger(player);
removePassenger(Entity)
void
Removes a passenger.Parameters:
  • entity - The passenger to remove
getPassengers()
Set<Entity>
Gets all passengers.Returns: Unmodifiable set of passengers
getVehicle()
Entity
Gets the entity this entity is riding.Returns: The vehicle entity, or null

Metadata & Visual

getEntityMeta()
EntityMeta
Gets the entity metadata object for modification.Returns: The EntityMeta
isInvisible()
boolean
Checks if the entity is invisible.Returns: true if invisible
setInvisible(boolean)
void
Makes the entity invisible or visible.Parameters:
  • invisible - true to make invisible
isGlowing()
boolean
Checks if the entity has the glowing effect.Returns: true if glowing
setGlowing(boolean)
void
Enables or disables the glowing effect.Parameters:
  • glowing - true to make glow
entity.setGlowing(true); // Entity glows through walls
getPose()
EntityPose
Gets the current entity pose.Returns: The EntityPose (STANDING, SNEAKING, SWIMMING, etc.)
setPose(EntityPose)
void
Sets the entity pose.Parameters:
  • pose - The new pose

LivingEntity Class

Extends Entity with health, equipment, and damage handling.

Health & Damage

getHealth()
float
Gets the current health.Returns: Current health points
setHealth(float)
void
Sets the entity health.Parameters:
  • health - The new health value
livingEntity.setHealth(20f); // Full health
damage(Damage)
boolean
Damages the entity.Parameters:
  • damage - The damage source and amount
Returns: true if damage was applied
livingEntity.damage(Damage.fromPlayer(player, 5f));
kill()
void
Kills the entity, triggering the death event and animation.
livingEntity.kill();
isDead()
boolean
Checks if the entity is dead.Returns: true if dead

Equipment

getItemInMainHand()
ItemStack
Gets the item in the main hand.Returns: The ItemStack
setItemInMainHand(ItemStack)
void
Sets the main hand item.Parameters:
  • itemStack - The item to set
livingEntity.setItemInMainHand(ItemStack.of(Material.DIAMOND_SWORD));
getItemInOffHand()
ItemStack
Gets the off-hand item.Returns: The ItemStack
setItemInOffHand(ItemStack)
void
Sets the off-hand item.Parameters:
  • itemStack - The item to set
getHelmet()
ItemStack
Gets the helmet.Returns: The helmet ItemStack
setHelmet(ItemStack)
void
Sets the helmet.Parameters:
  • itemStack - The helmet item
getChestplate()
ItemStack
Gets the chestplate.Returns: The chestplate ItemStack
setChestplate(ItemStack)
void
Sets the chestplate.Parameters:
  • itemStack - The chestplate item
getLeggings()
ItemStack
Gets the leggings.Returns: The leggings ItemStack
setLeggings(ItemStack)
void
Sets the leggings.Parameters:
  • itemStack - The leggings item
getBoots()
ItemStack
Gets the boots.Returns: The boots ItemStack
setBoots(ItemStack)
void
Sets the boots.Parameters:
  • itemStack - The boots item
getEquipment(EquipmentSlot)
ItemStack
Gets equipment in a specific slot.Parameters:
  • slot - The equipment slot
Returns: The ItemStack in that slot
setEquipment(EquipmentSlot, ItemStack)
void
Sets equipment in a specific slot.Parameters:
  • slot - The equipment slot
  • itemStack - The item to equip

Attributes

getAttribute(Attribute)
AttributeInstance
Gets an attribute instance for modification.Parameters:
  • attribute - The attribute to get
Returns: The AttributeInstance
AttributeInstance speed = livingEntity.getAttribute(Attribute.MOVEMENT_SPEED);
speed.setBaseValue(0.15); // Faster movement
getAttributeValue(Attribute)
double
Gets the current value of an attribute.Parameters:
  • attribute - The attribute
Returns: The attribute value

Fire & Effects

getFireTicks()
int
Gets remaining fire ticks.Returns: Fire duration in ticks
setFireTicks(int)
void
Sets the entity on fire.Parameters:
  • ticks - Duration in ticks
livingEntity.setFireTicks(100); // 5 seconds
isInvulnerable()
boolean
Checks if the entity is invulnerable.Returns: true if invulnerable
setInvulnerable(boolean)
void
Makes the entity invulnerable or vulnerable.Parameters:
  • invulnerable - true for invulnerability

Player Class

Extends LivingEntity with player-specific functionality.

Player Information

getUsername()
String
Gets the player’s username.Returns: The username
getDisplayName()
Component
Gets the display name shown in tab list.Returns: Display name component, or null for username
setDisplayName(Component)
void
Sets the tab list display name.Parameters:
  • displayName - The display name (null for username)
player.setDisplayName(Component.text("[Admin] ").append(Component.text(player.getUsername())));
getSkin()
PlayerSkin
Gets the player’s skin.Returns: The PlayerSkin, or null for default
setSkin(PlayerSkin)
void
Changes the player’s skin (respawns player for all viewers).Parameters:
  • skin - The new skin (null for UUID default)

Game Mode & Abilities

getGameMode()
GameMode
Gets the player’s game mode.Returns: The GameMode
setGameMode(GameMode)
void
Sets the game mode.Parameters:
  • gameMode - The new game mode
player.setGameMode(GameMode.CREATIVE);
isFlying()
boolean
Checks if the player is flying.Returns: true if flying
setFlying(boolean)
void
Sets the player flying state.Parameters:
  • flying - true to make fly
isAllowFlying()
boolean
Checks if the player can fly.Returns: true if flight is allowed
setAllowFlying(boolean)
void
Allows or disallows flight.Parameters:
  • allowFlying - true to allow flying
player.setAllowFlying(true);
player.setFlying(true);

Inventory

getInventory()
PlayerInventory
Gets the player’s inventory.Returns: The PlayerInventory
player.getInventory().addItemStack(ItemStack.of(Material.DIAMOND, 64));
openInventory(Inventory)
void
Opens an inventory GUI for the player.Parameters:
  • inventory - The inventory to open
Inventory chest = new Inventory(InventoryType.CHEST_1_ROW, "My Chest");
player.openInventory(chest);
closeInventory()
void
Closes the currently open inventory.
player.closeInventory();
getOpenInventory()
Inventory
Gets the currently open inventory.Returns: The open inventory, or null

Food & Experience

getFood()
int
Gets the food level (0-20).Returns: Food level
setFood(int)
void
Sets the food level.Parameters:
  • food - Food level (0-20)
player.setFood(20); // Full hunger
getFoodSaturation()
float
Gets food saturation.Returns: Saturation level
setFoodSaturation(float)
void
Sets food saturation.Parameters:
  • foodSaturation - Saturation (0-20)
getLevel()
int
Gets the experience level.Returns: The level
setLevel(int)
void
Sets the experience level.Parameters:
  • level - The new level

Respawn

getRespawnPoint()
Pos
Gets the respawn point.Returns: The respawn position
setRespawnPoint(Pos)
void
Sets the respawn point.Parameters:
  • respawnPoint - The new respawn position
player.setRespawnPoint(new Pos(0, 64, 0));
respawn()
void
Respawns the player if dead.
if (player.isDead()) {
    player.respawn();
}

Communication

sendMessage(Component)
void
Sends a chat message to the player.Parameters:
  • message - The message component
player.sendMessage(Component.text("Welcome!").color(NamedTextColor.GREEN));
kick(Component)
void
Kicks the player from the server.Parameters:
  • reason - The kick reason
player.kick(Component.text("You have been kicked"));
sendPacket(ServerPacket)
void
Sends a packet to the player.Parameters:
  • packet - The packet to send

EntityType

Represents a type of entity (autogenerated from Minecraft data).
fromKey(String)
static EntityType
Gets an EntityType by namespaced key.Parameters:
  • key - The entity key (e.g., “minecraft:zombie”)
Returns: The EntityType, or null
EntityType zombie = EntityType.fromKey("minecraft:zombie");
values()
static Collection<EntityType>
Gets all registered entity types.Returns: Collection of all EntityTypes

Examples

public class EntitySpawning {
    public static void spawnZombie(Instance instance, Pos pos) {
        EntityCreature zombie = new EntityCreature(EntityType.ZOMBIE);
        zombie.setInstance(instance, pos);
        
        // Equip the zombie
        zombie.setHelmet(ItemStack.of(Material.DIAMOND_HELMET));
        zombie.setItemInMainHand(ItemStack.of(Material.DIAMOND_SWORD));
        
        // Make it glow
        zombie.setGlowing(true);
    }
}

Build docs developers (and LLMs) love