Skip to main content
NPCs are the standing characters of your server: shopkeepers, quest givers, guides, decoration with a name. In LodeEntities an NPC is simply a mob with 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: true turns its head.
  • The grey “NPC” line a mannequin normally shows under its name is hidden, so the display name is its only label.
  • base: player needs Minecraft 1.21.9 or newer. On older versions the mob is skipped, with an error in /le debug.
  • skin on 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 with ai left 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 +onInteract effect lines run as well, so an NPC can greet, give items or run commands on a click. Addons can cancel the dialog through NpcInteractEvent.
  • look turns only the head of a mob with ai: false or 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.max of 1 and a short timer keeps exactly one NPC standing there, facing yaw. A persistent NPC 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 killall leaves NPCs alone unless the filter names them: /le killall [id=shopkeeper].
  • dialog and look on a mob without type: npc are ignored, with a warning in /le debug.
  • The free version allows 3 NPCs, counted separately from the 12 mobs. See Licensing.
All of these can be set from the Entities menu editor, too: Type, Dialog and Looks at players.

Tuning NPC cost

The only per-tick work an NPC has is look: 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: npc mob in Mobs/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: become run <effect> +onInteract lines.
  • Player skins, follow, behaviour and positioning are dropped. The console lists what was dropped for each NPC. To give a converted NPC its player look back, set base: player and a skin.
The original file stays beside the converted one as <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.