Sample: csv_export
Overview
Section titled “Overview”A sample that exports the per-block-type counts of the world (or the selection) to CSV. It has the id csv_export, SDK ^1.0 and version 1.0.0, and appears in the Plugin Manager as 블록 통계 CSV (예제) (block statistics CSV, sample). It uses only SDK 1.0 features. The sample’s UI text is Korean only, so this page quotes it as shown on screen, with an English gloss.
| What it shows | Code |
|---|---|
| Export format | AddExporter · NpFileFormat |
| Console command with arguments | AddCommand |
| Watching edits | Committed |
| Clearing state in a new world | WorldChanged |
| Easy-to-test structure | Calculation functions (Stats · ToCsv) moved out as static functions that take only an INpWorld |
The source is in samples/plugins/csv_export/ in the NP Editor repository (Plugin.cs · CsvExport.csproj · plugin.json).
Basic use
Section titled “Basic use”-
From the repository root, run
dotnet build samples/plugins/csv_export/CsvExport.csproj -c Release. The output goes to%LOCALAPPDATA%\NPEditorBuild\CsvExport\bin\Release\net8.0\. -
Copy
CsvExport.dllandplugin.jsonfrom the output to%APPDATA%\NPEditor\plugins\csv_export\. Do not includeNP.Editor.Sdk.dll.Note: the installed editor loads only plugins signed by Noplatea. If you build the sample yourself and put it in, it has no signature, so the Plugin Manager shows “Signature problem” and you cannot check Enable. To try it in the installed editor, you need a signed build — “Getting a signature” in Distribution and versioning. Only the editor team’s development build loads without a signature.
-
Click Tools > Plugin Manager…, then check Enable on the
블록 통계 CSV (예제)row shown as “Approval needed”. The first time, click Trusted — load. -
Open a map. To count only part of it, select a region.
-
In the Build menu, click
Export: 블록 통계 CSV(block statistics CSV). -
In the save dialog, type a file name and save. The default name is
<world name>.csv. -
The notification “블록 통계 CSV:
종 → ” (block statistics CSV: types → ) appears at the bottom of the screen.
Tips and tricks
Section titled “Tips and tricks”-
To see the result directly without exporting, type
blockstats 3in the Console (the number is an example).> blockstats 3블록 2,304칸 · 4종 · 편집 2번(2,304칸)minecraft:grass_block 2,048minecraft:stone_bricks 200minecraft:oak_stairs 40 -
The CSV is written as UTF-8 with BOM, so Korean text does not break when you open it in Excel.
-
Stats·ToCsvtake only anINpWorld, so you can test them without the editor using the fake world in Testing and debugging.
Reference
Section titled “Reference”What it adds
Section titled “What it adds”| Kind | Name | Description |
|---|---|---|
| Export | Export: 블록 통계 CSV in the Build menu (.csv) | Writes the count and ratio per block state to CSV. If there is a selection, only inside it; otherwise the whole world. Air is not counted. |
| Command | blockstats [n] | Shows the total cell count · type count · edit count and the top n rows by count (default 5). If there is a selection, counts only inside it. |
| Event | Committed | Counts the undo steps and changed cells since the plugin was enabled (or since a new world). |
| Event | WorldChanged | Resets the edit count to 0. |
CSV format
Section titled “CSV format”| Column | Contents | Example |
|---|---|---|
block | Block id without properties | minecraft:oak_stairs |
state | Full block state string | "minecraft:oak_stairs[facing=east,half=bottom]" |
count | Number of cells | 40 |
percent | % of the total (up to 3 decimal places, dot decimal) | 1.736 |
- The first line is
block,state,count,percent. - Rows are sorted by
count, largest first; ties are sorted bystatename. - Values that contain commas or double quotes are wrapped in double quotes. A
statewith two or more properties is such a case.
Limitations and known issues
Section titled “Limitations and known issues”- Counts are per block state. The
blockstatsrows show ids without properties, so the same id can appear on several rows (stairs facing different directions and so on). - The
plugin.jsondescription says “파일 › 내보내기” (File > Export), but the export item is in the Build menu. - In a large world it scans the whole world, so it takes time, and the editor freezes meanwhile.
- The edit count is kept in memory only. It is 0 after you restart the editor.
- If you move the sample out of the source tree to build it, change the csproj’s SDK project reference to a reference to
NP.Editor.Sdk.dllin the install folder, as in Quick start.
Changelog
Section titled “Changelog”| Version | Date | Details |
|---|---|---|
| 1.0.0 | — | First version: export 블록 통계 CSV · command blockstats · Committed edit count |
Related pages
Section titled “Related pages”Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.