Skip to content

Quick start

Build your first plugin in 10 minutes. This plugin adds two things.

KindNameWhat it does
Menu itemTools › 선택 블록 세기 (count selected blocks)Shows the number of blocks inside the selection box as a notification.
Quick addAdd › Preset › 3×3 기둥 (3×3 pillar)Places a stone brick pillar (3×3, 6 high) at the cell under the mouse.

You need the .NET 8 SDK and an installed NP Editor. Check the prerequisites table in the Overview first.

Create three files in one folder.

my_first_plugin/
├─ MyFirstPlugin.csproj
├─ Plugin.cs
└─ plugin.json
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<!-- References the SDK dll in the editor install folder. If you changed the install folder, change this path too. -->
<Reference Include="NP.Editor.Sdk">
<HintPath>$(LOCALAPPDATA)\Programs\NP Editor\data_NPEditor_windows_x86_64\NP.Editor.Sdk.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
SettingWhy
EnableDynamicLoadingLets the plugin be unloaded from memory when it is disabled.
Private=falseDoes not copy the SDK dll to the output folder. The plugin uses the editor’s SDK.
ImplicitUsingsAdds default usings such as System.Linq and System.IO automatically.
Copy plugin.jsonplugin.json is placed in the build output folder too.
using NP.Editor.Sdk;
namespace MyFirstPlugin;
public sealed class Plugin : INpEditorPlugin
{
public void Register(INpEditorHost host)
{
// Tools › Count selected blocks
host.AddMenuItem(new NpMenuItem("count", "도구", "선택 블록 세기", () =>
{
if (host.World.Selection is not { } box) { host.Message("먼저 영역을 고르세요"); return; }
int n = host.World.Blocks(box).Count();
host.Message($"선택 안 블록 {n:N0}개");
}));
// Add › Preset › 3×3 pillar (placed at the cell under the mouse)
host.AddQuickAddItem(new NpQuickAdd("pillar", "3×3 기둥", "프리셋", ctx =>
ctx.World.Edit("3×3 기둥", e => // one Edit = one undo step
{
for (int y = 0; y < 6; y++)
for (int x = 0; x < 3; x++)
for (int z = 0; z < 3; z++)
e.Set(ctx.Place.X + x, ctx.Place.Y + y, ctx.Place.Z + z, "minecraft:stone_bricks");
}),
Keywords: "pillar column 기둥", Icon: "prefab", IconState: "minecraft:stone_bricks"));
host.Log("준비됨");
}
}
  • The entry class implements INpEditorPlugin. It must have a public parameterless constructor.
  • Attach features inside Register with host.Add….
  • If Register throws, nothing is registered and the plugin is disabled.
{
"id": "my_first_plugin",
"name": "내 첫 플러그인",
"version": "0.1.0",
"sdk": "^1.0",
"dll": "MyFirstPlugin.dll",
"entry": "MyFirstPlugin.Plugin",
"description": "선택 블록 세기 + 3×3 기둥",
"author": "내 이름"
}

This plugin uses only SDK 1.0 features, so it uses "sdk": "^1.0". The fields are described in plugin.json.

dotnet build -c Release

MyFirstPlugin.dll and plugin.json appear in the output folder (bin\Release\net8.0\).

  1. In the editor, select Tools › Open plugin folder. %APPDATA%\NPEditor\plugins\ opens.
  2. Create a my_first_plugin folder inside it.
  3. Copy MyFirstPlugin.dll and plugin.json into it. Do not include NP.Editor.Sdk.dll.
  4. To debug, also include MyFirstPlugin.pdb.
  1. Open Tools › Plugin Manager….
  2. Click Rescan.
  3. The first time, a security warning appears. Click Trusted — load.
  4. You are done when the list shows 내 첫 플러그인 as On.
WhereWhat you should see
Output Log[my_first_plugin] 준비됨
Plugin Manager Registered columnMenu 1 · Quick add 1
Menu barTools › 선택 블록 세기
Main toolbar Add3×3 기둥 in the Preset category (search for 기둥)
  1. Place a few blocks, select a region, then select Tools › 선택 블록 세기. A notification with the block count appears.
  2. Select Add › 3×3 기둥. A pillar appears.
  3. A single Ctrl+Z removes the whole pillar.

The editor does not lock the dll file. You can rebuild while the editor is running.

  1. Edit the code and rebuild.
  2. Overwrite the dll in the plugin folder with the new one.
  3. In the Plugin Manager, select that row and click Reload (selected).

Enter plugins in the console to list plugins and their status. plugins reload rescans the folders.