type: npc. It is declared, spawned, edited and removed exactly like any other mob: /le spawn, eggs from /le gui, spawners, the in-game editor, /le killall. There are no separate NPC commands.
On top of the usual mob fields it gets two more:
To make it look like a player, give it
base: player and a skin; see NPCs that look like players.
A shopkeeper
/le reload, and within five seconds a shopkeeper is standing at the market. Right-click it and the shop_talk conversation starts.
NPCs that look like players
base: player spawns a mannequin, Minecraft’s player-shaped entity, and skin sets what it wears:
skin takes one of three things:
A skin file is baked into the resource pack on
/le reload, so players see it without anyone uploading it to a skin site. For the slim (Alex) arms, write it as a block:
- A mannequin has no AI: it stands where it is put.
look: trueturns its head. - The grey “NPC” line a mannequin normally shows under its name is hidden, so the
displayname is its only label. base: playerneeds Minecraft 1.21.9 or newer. On older versions the mob is skipped, with an error in/le debug.skinon any other base is ignored, with a warning in/le debug.
How NPCs behave
- Nothing is implied by
type: npc. Freeze it, make it invulnerable and keep it from despawning with the ordinary fields, as above. A villager NPC withaileft on wanders around and trades like any villager. - Right-click starts the
dialog, and the vanilla interaction (a villager’s trade window) is cancelled when there is one. The mob’s own+onInteracteffect lines run as well, so an NPC can greet, give items or run commands on a click. Addons can cancel the dialog throughNpcInteractEvent. lookturns only the head of a mob withai: falseor a mannequin; the body follows once the head is more than 25° off the way it was spawned facing, and it settles back once nobody is near. A mob with AI on is simply asked to look at the player.- Fixed spots are spawners. A spawner with the default
spawn.maxof 1 and a short timer keeps exactly one NPC standing there, facingyaw. ApersistentNPC is taken back by its spawner after a restart rather than spawned a second time. One NPC can stand in many places: give it several spawners. /le killallleaves NPCs alone unless the filter names them:/le killall [id=shopkeeper].dialogandlookon a mob withouttype: npcare ignored, with a warning in/le debug.- The free version allows 3 NPCs, counted separately from the 12 mobs. See Licensing.
Tuning NPC cost
The only per-tick work an NPC has islook: true, so this only matters on a server with a lot of looking NPCs. Two options in config.yml, applied on /le reload:
activation-range does most of the work: an NPC with no player within that many blocks of where it was spawned is skipped, for the cost of one distance check. Keep it above 8, the distance at which NPCs notice players; 0 ticks every NPC. look-interval directly controls how often heads turn: 2 is usually indistinguishable and halves the work, and above about 4 turns start to look steppy.
Upgrading from the old NPCs folder
Earlier versions had a separate NPC system with its own/npc commands and an NPCs/ folder. It is converted on the first load:
- Each NPC becomes a
type: npcmob inMobs/npcs/, with the old frozen-prop settings written out (ai: false,invulnerable,silent,persistent). - Each place it stood becomes a spawner under it.
- A copy that changed one of the settings that still exist (its display name, dialog, look) becomes a mob of its own.
- Right-click
effects:becomerun <effect> +onInteractlines. - Player skins,
follow,behaviourandpositioningare dropped. The console lists what was dropped for each NPC. To give a converted NPC its player look back, setbase: playerand askin.
<name>.yml.pre-mobs.bak.
Where to go
- NPC Dialogs: branching conversations with clickable replies.
- Dialog Conditions: show a reply only when the player has the item, at night, mid-quest.
- Dialog Files: big conversations split over many files.
