Skip to main content
Version: 2.0

NPC actions



Walk

Function to positon
fun NPCEntity.move(
pos: Vec3,
dist: Double = 1.5,
speed: Double = 1.0
)
Function to entity
fun NPCEntity.move(
entity: Entity,
dist: Double = 1.5,
speed: Double = 1.0
)
Function to positon
fun NPCEntity.move(
pos: Vec3,
dist: Double = 1.5,
speed: Double = 1.0
)
Function to entity
fun NPCEntity.move(
entity: Entity,
dist: Double = 1.5,
speed: Double = 1.0
)
Examples
// NPC will moves to position
npcID move pos(92, 23, 56)

// NPC will follow player
val player = server.playerList.players.first() // Получаем первого игрока из списка
npcID move player

// The NPC will move to the point until the distance is less than 3.0 blocks, with a speed of 2.0
npcID.move(pos(25, 64, 2), 3.0, 2.0)

// The NPC will move towards the player until the distance is less than 3.0 blocks, at a speed of 2.0
npcID.move(player, 3.0, 2.0)



Look

Function to positon
fun NPCEntity.look(pos: Vec3)
Function to entity
fun NPCEntity.look(entity: Entity)
Function to positon
fun NPCEntity.look(pos: Vec3)
Function to entity
fun NPCEntity.look(entity: Entity)
Example
// НИП посмотрит в точку
npcID look pos(92, 3, 24)

// NPC looks to player
val player = server.playerList.player.first() // Получаем первого игрока из списка
npcID look player



Interaction with the world

Interaction with the player

Function
fun NPCEntity.useBlock(pos: Vec3)
Example
// NPC simulates right-clicking on a block
npcID useBlock pos(92, 93, 241)

Destroy block

Function
fun NPCEntity.destroyBlock(pos: Vec3)
Example
// NPC destroy block
npcID destroyBlock pos(92, 46, 24)



Drop item

Function
fun NPCEntity.dropItem(item: ItemStack)
Example
// NPC will drop item "Golden Apple'
npcID dropItem item("golden_apple")



Say

Function
fun NPCEntity.say(text: String)
Example
npcID say "Hello!"