A registration point is a place where a plugin attaches a feature to the editor. Call all of them inside Register(host) as host.Add…(data type). The data types are C# records, and you can pass fields that have default values as named arguments (Order: 600). World logic types (AddSceneEvent) are covered separately in Adding world logic types.
Group menu Order values by hundreds. A separator appears where the hundreds digit changes, so items in the same group, such as 550 and 551, appear as one block.
Panels are created closed. Tell users to open the panel from the Window menu, or put a menu item that opens the panel in the Window menu as well (Menu = "창").
If you use a built-in mode id (for example np.blockbrush) as is in a shortcut’s Mode, the key works only in that built-in mode.
Modes after the first 8 in the mode row go into the list of the More modes button (down arrow) at the end of the mode row. Plugin modes come after built-in modes, so they are usually in this list. Give them a shortcut to make them easier to find.
Do not put emoji or pictographic characters in on-screen text. Pictographic characters are stripped from menu, mode, panel and quick add names on screen. Give icons as an icon name (prefab · block · light · trigger · logic …) in the Icon field.
Id gets an ext.<plugin id>. prefix inside the editor. It only needs to be unique within your plugin.
If Id (Name for commands, Kind for actor types) is empty or the run function (Run · Spawn · Build · Toggled · Poll · Ask) is null, registration throws. The whole plugin then goes to “Error (isolated)”.
If a registered callback throws, the plugin is isolated.
Order is the order within the same location. Smaller values come first, and the default is 500. Modes, show flags, status bar items and map replace guards always come after built-in items.
publicsealedrecordNpMenuItem(string Id, string Menu, string Label, Action Run, string Shortcut ="", int Order =500);
Field
Description
Id
Item id
Menu
"파일" (File) · "편집" (Edit) · "창" (Window) · "도구" (Tools) · "빌드" (Build) · "도움말" (Help). These keys are Korean in every editor language. Any other name creates a new menu before Help.
Label
Text shown in the menu
Run
Runs on click
Shortcut
Shortcut text (for example "Ctrl+Alt+H"). If the key can be parsed, it appears next to the menu text, runs the item, and can be changed in Tools > Shortcuts….
Order
Order within the menu. A separator appears where the hundreds digit changes (for example between 499 and 500).
Items in the Window menu are attached below the panel list and the area items.
Runs when the item is chosen. ctx.Place = the cell to place at (the cell the mouse last pointed at in the viewport; if none, the cell in front of the block at the center of the screen)
Keywords
Search words (separated by spaces). Adding both Korean and English makes the item easier to find. They also appear in the tooltip.
Icon
Icon name (for example "prefab" · "light")
IconState
Block state string to draw as the icon. If set, it takes precedence over Icon.
.Number("Width", width, 1, 9, 1, v => width = (int)v)
.Check("Street lamps", lamps, v => lamps = v)
.Button("Lay in selection", () =>host.Message($"Width {width}"))));
The panel is created closed in the bottom area. The user opens it by checking the panel in the Window menu. Right-click the tab to move it to another area or a floating window.
Content shown in the Tool panel. Built once when first shown and reused. If none, only the title appears.
OnClick
Left-click in the viewport. Hit = the block cell that was hit, Place = the cell outside that face (where to place), Shift · Ctrl = keys held at the same time
Enter · Exit
When entering and leaving the mode
Shortcut
Shortcut text that switches to the mode
Order
Order among plugin modes. Plugin modes always come after built-in modes.
host.AddMode(new NpMode("flag", "Plant flag",
Panel: () =>new NpUi().Title("Flag").Label("Left-click = flag · Shift+click = erase"),
OnClick: c =>
{
var p =c.Shift?c.Hit:c.Place;
host.World.Edit(c.Shift?"Erase flag":"Flag", e =>
{
if (c.Shift) { for (int i =0; i <3; i++) e.Clear(p.X, p.Y+ i, p.Z); return; }
e.Set(p.X, p.Y, p.Z, "minecraft:oak_fence");
e.Set(p.X, p.Y+1, p.Z, "minecraft:oak_fence");
e.Set(p.X, p.Y+2, p.Z, "minecraft:red_wool");
});
returntrue;
},
Exit: () =>host.Draw.Clear()));
If OnClick is set, every left-click in the viewport in that mode goes to OnClick, and the default block placement does not happen. 0.10.2 does not use the return value of OnClick (true and false behave the same).
A click that hits no block (the sky) does not call OnClick.
Drags cannot be received. Only clicks are received.
If the plugin is disabled while its mode is in use, the editor returns to Block brush mode.
Sets the text and color shown when an actor of that kind appears in the Outliner. If the kind already exists (including built-in), only that type is not attached.
No edit can change a cell for which the guard returns true. This applies to brushes, shapes, fills, console commands, AI work and World.Edit from other plugins. Undo and redo are not checked.
host.AddCellGuard((x, y, z) => y <0); // cells below y 0 cannot be changed
If there are several guards, any one returning true blocks the cell.
It is called for every cell. Keep it very light (a dictionary lookup or a box comparison).
Receives the list of cells a Block brush edit (place · break · brush · shape · drag box fill) will change and returns an extended list. It runs after the built-in symmetry.
host.AddSymmetry(cells =>cells.Concat(cells.Select(b => b with { X =-b.X }))); // mirror across the X=0 plane
Return the original cells first. If you leave them out, the original edit disappears. A single-cell place or break treats the first cell of the returned list as the original cell and skips it, so if you change the order, one symmetric cell is lost.
If the same cell appears more than once, only the first is used.
A cell changed to air (break) has State = "minecraft:air".
Points the camera from the eye position to the target point
Frames(int n)
Waits n frames (await)
Check(bool ok, string what)
Records one verdict (pass · fail)
Shot(string name)
Saves the screen as a PNG (await)
The screen verification runner (--np-shot) exists only in editor development builds. In the installed editor, scenarios are registered but do not run. Examples and limits are in Testing and debugging.
Yes. It easily collides with built-in keys, so it is not recommended.
1~8 · W/E/R · Ctrl++
No → registration throws (“Can’t parse shortcut key”) → the plugin does not enable
A key = Ctrl · Alt · Shift plus one key. Key names are a single letter or digit, F1–F24, or names such as Enter · Space · Delete · Esc.
Users change keys in Tools > Shortcuts… (Ctrl+Alt+K). Changed keys persist when the plugin is enabled again.
A key that collides with another key is still registered. It appears in red in the Shortcuts window.
If several bindings use the same key, a key for the current mode takes precedence over an everywhere key. Within the same scope, the key registered first (built-in) wins.
publicsealedrecordNpShowFlag(string Id, string Label, Action<bool> Toggled, string Tooltip ="", bool On =false, int Order =500);
voidSetShowFlag(string id, bool on);
Field
Description
Id · Label
Item id · menu text. If either is empty, registration throws.
Toggled
When the user clicks the item. Argument = on (true) · off (false)
Tooltip
Tooltip
On
Initial check state
Order
Order. Plugin items always come after built-in items.
SetShowFlag(id, on) only sets the check state of an item your plugin registered. It does not call Toggled, and an unknown id does nothing. Use it when you turn the flag on or off from somewhere else, such as a panel or a shortcut.
publicsealedrecordNpWorldReplaceGuard(string Id, Func<NpWorldChangeReason, Action, bool> Ask, int Order =500);
Before the map is replaced by New, Open or loading an autosave (from menus, shortcuts and other plugins’ menus alike), the editor calls Ask(reason, proceed). The reason is New (New) · Open (Open · loading an autosave) · Replaced (any other world replacement).
Return
Meaning
true
The map may be replaced. The editor moves on to the next guard.
false
This plugin takes over. The replacement stops; when the plugin later calls proceed(), the editor goes through every guard again from the start and then replaces the map.
The built-in guards (unsaved changes · live server connection) ask first, and plugin guards ask after them.
If the plugin is disabled or Ask throws, the guard does not block (the replacement goes ahead). This keeps a broken plugin from blocking file opening. A plugin that throws is isolated.
The SDK has no confirmation dialog API. Ask the user with a notification and a panel button, and when they agree, call the proceed you stored.
Do the cleanup after the replacement in WorldChanged.