Plugin development (SDK) overview
Overview
Section titled “Overview”You can extend NP Editor with external C# plugins. A plugin is one folder that contains a dll and a plugin.json, and it references only one SDK assembly, NP.Editor.Sdk.dll. You do not need to know Godot or the editor’s internal code.
The SDK version of the 0.10.2 editor is 1.5.0. It appears in the top line of the Tools > Plugin Manager… window in the form SDK 1.5.0 · … external plugins. 0.10.2 did not change the SDK surface, so plugins built against SDK 1.0 to 1.5 do not need a rebuild.
Basic use
Section titled “Basic use”- Follow Quick start to create a
net8.0class library that referencesNP.Editor.Sdk.dllfrom the install folder. - In
Register(host)of the class that implementsINpEditorPlugin, attach features withhost.Add…. - Copy the built dll and
plugin.jsonto%APPDATA%\NPEditor\plugins\<folder>\. - Click Tools > Plugin Manager…, then check Enable on the row of the new plugin.
Tips and tricks
Section titled “Tips and tricks”- Press F1 in the Plugin Manager window to open this page.
- Type
pluginsin the console to see the plugin list, versions, states and errors at once. - Move block placement math into a function that takes an
INpWorld, and you can test it with unit tests without the editor (Testing and debugging). - The editor does not lock plugin dlls. Rebuild while the editor is running and apply the change right away with Reload (selected).
Reference
Section titled “Reference”What a plugin can add
Section titled “What a plugin can add”| Where it attaches | In the editor | Registration point | SDK |
|---|---|---|---|
| Menu items | Menu bar (File · Edit · Window · Tools · Build · Help; any other name = a new menu) | AddMenuItem | 1.0 |
| Quick add | Main toolbar Add list (category · search · icon) | AddQuickAddItem | 1.0 |
| Console commands | Console panel | AddCommand | 1.0 |
| Import · export | Import: <name> in the File menu · Export: <name> in the Build menu | AddImporter · AddExporter | 1.0 |
| Panels | Panels in the bottom area (open from the Window menu) | AddContentTab + NpUi | 1.0 |
| Modes | Mode row on the main toolbar · Tool panel · viewport clicks | AddMode | 1.0 |
| Actor types | Text and color in the Type column of the Outliner | AddActorType | 1.0 |
| Cell guards · symmetry | Every block edit | AddCellGuard · AddSymmetry | 1.0 |
| Screen verification scenarios | --np-shot=<id> (runs only in editor development builds) | AddShotScenario | 1.0 |
| Shortcuts | Users can rebind them in Tools > Shortcuts… | AddShortcut | 1.1 |
| Settings storage | One JSON file per plugin | host.Settings | 1.1 |
| 3D overlay drawing | Lines, boxes and text over the viewport | host.Draw | 1.1 |
| World logic types | World logic · Logic graph · checks · AI Studio · Play preview | AddSceneEvent | 1.2 |
| Scene actor reading · play camera | Scene actor list, camera during Play | host.Scene · host.View | 1.3 |
| Account tier check | Read the tier and feature codes | host.Account | 1.4 |
| “Display” menu items · status bar items | Check items in the Display menu of the viewport bar, items in the status bar at the bottom of the screen | AddShowFlag · AddStatusItem | 1.5 |
| Confirm before replacing the map | Before New, Open or loading an autosave | AddWorldReplaceGuard | 1.5 |
Plugins read and write the world through host.World. Block state strings use the Minecraft format (minecraft:oak_stairs[facing=east]), and one World.Edit call is one undo step.
External plugins and built-in features
Section titled “External plugins and built-in features”| External plugin (the subject of these pages) | Built-in feature | |
|---|---|---|
| Location | One folder inside the plugin folder | Inside the editor |
| References | NP.Editor.Sdk.dll only | Editor internal code |
| Enable · disable | In the Plugin Manager, without closing the editor | Always on |
| Exceptions | Only that plugin is disabled (isolated); the editor keeps running | Fixed together with the editor |
| Compatibility | Promised by the SDK version (semver) | Same as the editor version |
Core features such as Block brush, Landscape and World logic are also built-in features attached through the same registration structure. Built-in features also use registration points that are not public (view modes, viewport dragging, panel area selection and so on). The pages in this section cover external plugins only.
Architecture
Section titled “Architecture”MyPlugin.dll ──references──> NP.Editor.Sdk.dll (interfaces · data types only) │ Plugin host (plugin.json check · SDK version comparison · load context · error isolation) │ NP Editor (menus · modes · panels · world logic · viewport)| Layer | What it does |
|---|---|
| Your plugin dll | Calls registration points in INpEditorPlugin.Register(host). |
NP.Editor.Sdk.dll | Contains only interfaces and data types. Plugins share the same assembly that the editor has already loaded. |
| Plugin host | Checks plugin.json and compares SDK versions. Creates a separate load context for each plugin, catches exceptions from plugin code and disables only that plugin. |
| Editor | Attaches what was registered to menus, toolbars, panels and world logic, and detaches all of it when the plugin is disabled. |
Inside the editor, the ids of registered items such as menus, modes and panels get an ext.<plugin id>. prefix, so they never collide with the ids of built-in features or other plugins. Console command names, world logic types and actor kinds get no prefix. See Loading and lifecycle for the full rules.
Prerequisites
Section titled “Prerequisites”| Item | Value |
|---|---|
| Editor | NP Editor 0.10.2 (SDK 1.5.0). If the features you use need a lower SDK version, older editors also work (SDK 1.4 = 0.9.12, 1.3 = 0.9.1, 1.2 = 0.9.0). |
| .NET SDK | A .NET SDK (8 or later) that can build net8.0. The .NET runtime inside the editor is 8, so the target is net8.0. |
| Language | C# 12 |
| Code editor | Any C# editor, such as Visual Studio, Rider or VS Code |
| SDK dll | <install folder>\data_NPEditor_windows_x86_64\NP.Editor.Sdk.dll (NP.Editor.Sdk.xml for IntelliSense is in the same folder) |
The default editor install folder is %LOCALAPPDATA%\Programs\NP Editor.
Security: a plugin is code that runs with the same permissions as the editor, without signature checks. The editor does not load a new plugin folder until the user checks Enable for it in the Plugin Manager. Enable only plugins you built yourself or got from a source you trust. See Distribution and versioning for details.
Where to go next
Section titled “Where to go next”| What you want to do | Page |
|---|---|
| Build your first plugin | Quick start |
Learn the plugin.json fields | plugin.json |
| How enabling, disabling and isolation work | Loading and lifecycle |
| Read and write the world, events, settings, 3D drawing | Host API |
| All registration points: menus, modes, commands and more | Registration points |
| Build panel UI | Panel UI (NpUi) |
| Add triggers, conditions and actions to world logic | Adding world logic types |
| Camera work during Play | Scene access and play camera |
| Testing and debugging | Testing and debugging |
| Share with others | Distribution and versioning |
| When something goes wrong | Troubleshooting |
| What changed in each SDK version | SDK changelog |
| Sample source | Sample: hello_tool · Sample: csv_export · Sample: event_example |
Related
Section titled “Related”Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.