PacketEntity

A packet-only entity that is spawned, updated, and removed by sending packets to players.

val display = packetItemDisplay {
location by player.location
metadata {
itemStack by item
}
}

display.spawn()

Type Parameters

M

the metadata API type for this entity.

Properties

Link copied to clipboard

Handlers that are called on the player's Netty event-loop thread when they attack this entity (left click).

Link copied to clipboard

Handlers that are called on the main thread when a player attacks this entity (left click).

Link copied to clipboard
abstract val despawnHandlers: MutableList<(Player) -> Unit>

Handlers that are called on the main thread whenever this entity stops being visible to a player.

Link copied to clipboard

The mutable equipment of this node.

Link copied to clipboard
abstract val id: Int

The entity id used in packets for this entity.

Link copied to clipboard

Handlers that are called on the player's Netty event-loop thread when they interact with this entity (right click).

Link copied to clipboard

Handlers that are called on the main thread when a player interacts with this entity (right click).

Link copied to clipboard
abstract var location: Location

The entity location.

Link copied to clipboard
abstract val metadata: M

The mutable metadata of this entity.

Link copied to clipboard
abstract val passengers: List<PacketEntityNode<*>>

The direct passengers mounted on this entity.

Link copied to clipboard

Handlers that are called on the player's Netty event-loop thread when they pick this entity (middle click).

Link copied to clipboard
abstract val spawnHandlers: MutableList<(Player) -> Unit>

Handlers that are called on the main thread whenever this entity becomes visible to a player.

Link copied to clipboard
abstract val uuid: UUID

The UUID used in packets for this entity.

Link copied to clipboard
abstract var viewerBlacklist: Set<UUID>

The set of players that must not see this entity.

Link copied to clipboard
abstract var viewerWhitelist: Set<UUID>?

The optional whitelist of players that may see this entity.

Link copied to clipboard

The visibility of this entity.

Functions

Link copied to clipboard
abstract fun despawn()

Despawns the entity, making it invisible to players.

Link copied to clipboard
abstract fun spawn()

Spawns the entity, making it visible for players.

Link copied to clipboard
abstract fun teleport(modifyLocation: Location.() -> Unit)

Updates location by applying modifyLocation to a clone of the current location.