Preset - MarkusBordihn/BOs-Easy-NPC GitHub Wiki
Presets let you save, share, import, and export NPC data. The current code supports both binary NBT presets and text-based SNBT presets.
Supported file formats:
.npc.nbt.npc.snbt
Preset files can also contain compatible third-party entity data that belongs to the NPC.
Easy NPC currently distinguishes between these preset sources:
-
defaultfor presets shipped with the mod -
datafor presets loaded from data packs or other resources -
customfor presets stored inconfig/easy_npc/preset -
worldfor presets stored in the current world -
localfor client-local presets used by the UI
local presets are not available through the server import command.
Import an existing preset:
/easy_npc preset import custom <preset> [position] [uuid]
/easy_npc preset import data <preset> [position] [uuid]
/easy_npc preset import default <preset> [position] [uuid]
/easy_npc preset import world <preset> [position] [uuid]Import a preset as a new NPC with a new UUID:
/easy_npc preset import_new custom <preset> [position]
/easy_npc preset import_new data <preset> [position]
/easy_npc preset import_new default <preset> [position]
/easy_npc preset import_new world <preset> [position]Import a preset as a new NPC and assign an owner immediately:
/easy_npc preset import_with_owner custom <preset> <player> <position>
/easy_npc preset import_with_owner data <preset> <player> <position>
/easy_npc preset import_with_owner default <preset> <player> <position>
/easy_npc preset import_with_owner world <preset> <player> <position>If you provide a UUID to preset import, Easy NPC first tries to update an existing NPC with that
UUID. If that is not possible, it spawns a new NPC with the imported data.

Local import is available through the Config UI. These presets are read from the local client config directory and are not shared automatically with the server or other players.
Server command note:
/easy_npc preset import localThis command is currently rejected by the server and only exists to tell you that local preset import is handled client-side.

Export the selected NPC:
/easy_npc preset export local <NPC> [name]
/easy_npc preset export custom <NPC> [name]
/easy_npc preset export world <NPC> [name]Export targets:
-
localwrites to the player-local config preset directory -
customwrites toconfig/easy_npc/preset -
worldwrites to the world preset storage

Preset import is sanitized on the server before the NPC is created or updated.
Depending on the importing player and the current security config, the server may:
- rewrite the owner
- remove owner data
- remove trading
- remove objectives
- remove movement and attribute data
- remove blocked action entries
- clamp command permission levels
If sanitizing changes the imported preset, the importing player receives a short warning in chat.
The preset browser uses the same security rules to show a preview before import:
- allowed features
- blocked features
- reduced command authority
Preset export removes server-specific live data before saving. This includes:
- entity UUID
- owner data
- live position
- live rotation
- stored action authority
This keeps exported presets portable and avoids leaking world-specific ownership information.
Common preset locations used by the code:
config/easy_npc/preset- world preset storage managed by Easy NPC
- built-in resource locations for
defaultanddata
The exact resource path depends on the preset type and the selected skin model.
The Config UI still provides dedicated screens for:
- local import
- default import
- custom import
- world import
- custom export
- world export
Those screens use the same handler and sanitizing rules as the command-based import and export paths.
