PacketEntityDsl

sealed interface PacketEntityDsl<M : EntityMetadataDsl>

DSL scope for configuring a PacketEntity.

val entity = packetItemDisplay {
location by player.location
viewerBlacklist by setOf(player.uniqueId)

metadata {
itemStack by item
}

onSpawn {
viewer.sendMessage("Display spawned")
}
}

Properties

Link copied to clipboard

The entity's attributes.

Link copied to clipboard

The entity's equipment slots.

Link copied to clipboard
abstract val location: DslProperty<Location>

The entity location.

Link copied to clipboard

Whether location changes emit movement packets.

Link copied to clipboard
abstract val viewerBlacklist: DslProperty<Set<UUID>>

Blacklist of players that must not see this entity.

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

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 equipment(equipment: EquipmentDsl.() -> Unit)

Configures equipment using named equipment slots.

Link copied to clipboard
abstract fun metadata(metadata: M.() -> Unit)

Configures entity metadata.

Link copied to clipboard
abstract fun onAttack(handler: AttackDsl.() -> Unit)

Registers a handler called on the main server thread when a player attacks this entity (left click).

Link copied to clipboard
abstract fun onAttackAsync(handler: (ServerboundAttackPacketEvent) -> Unit)

Registers a handler called on the player's Netty event-loop thread when they attack this entity (left click).

Link copied to clipboard
abstract fun onDespawn(handler: DespawnDsl.() -> Unit)

Registers a handler called when this entity stops being visible to a player.

Link copied to clipboard
abstract fun onInteract(handler: InteractDsl.() -> InteractionResult)

Registers a handler called on the main server thread when a player interacts with this entity (right click).

Link copied to clipboard

Registers a handler called on the player's Netty event-loop thread when they interact with this entity (right click).

Link copied to clipboard

Registers a handler called on the player's Netty event-loop thread when they pick this entity (middle click).

Link copied to clipboard
abstract fun onSpawn(handler: SpawnDsl.() -> Unit)

Registers a handler called when this entity becomes visible to a player.

Link copied to clipboard
abstract fun passengers(passengers: PacketEntityPassengersDsl.() -> Unit)

Adds passenger packet entities to this entity.