Preset - MarkusBordihn/BOs-Easy-NPC GitHub Wiki

Preset ๐Ÿ—‚๏ธ

Presets let you save, share, import, and export NPC data. The current code supports both binary NBT presets and text-based SNBT presets.

Format ๐Ÿงพ

Supported file formats:

  • .npc.nbt
  • .npc.snbt

Preset files can also contain compatible third-party entity data that belongs to the NPC.

Import Sources ๐Ÿ“ฅ

Easy NPC currently distinguishes between these preset sources:

  • default for presets shipped with the mod
  • data for presets loaded from data packs or other resources
  • custom for presets stored in config/easy_npc/preset
  • world for presets stored in the current world
  • local for client-local presets used by the UI

local presets are not available through the server import command.

Import Commands ๐Ÿ› ๏ธ

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.

Default Import

Local Import ๐Ÿ“

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 local

This command is currently rejected by the server and only exists to tell you that local preset import is handled client-side.

Data Import

Export Commands ๐Ÿ“ค

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:

  • local writes to the player-local config preset directory
  • custom writes to config/easy_npc/preset
  • world writes to the world preset storage

Auto Suggest Export

Security and Sanitizing ๐Ÿ›ก๏ธ

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

Export Sanitizing ๐Ÿ“ฆ

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.

Storage Paths ๐Ÿ“

Common preset locations used by the code:

  • config/easy_npc/preset
  • world preset storage managed by Easy NPC
  • built-in resource locations for default and data

The exact resource path depends on the preset type and the selected skin model.

UI Notes ๐Ÿ–ฅ๏ธ

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.

Custom Import World Import Custom Export World Export

โš ๏ธ **GitHub.com Fallback** โš ๏ธ