Skip to content

Sample: csv_export

A sample that exports the per-block-type counts of the world (or the selection) to CSV · id csv_export · SDK ^1.0 · latest version 1.0.0

Its name in the manager window is 블록 통계 CSV (예제) (block statistics CSV, sample). It uses only SDK 1.0 features.

What it showsCode
Export formatAddExporter · NpFileFormat
Console command with argumentsAddCommand
Watching editsCommitted
Clearing state in a new worldWorldChanged
Easy-to-test structureCalculation functions (Stats · ToCsv) extracted as static functions that take only an INpWorld
ItemValue
Editor0.9.0 or later
SDK1.0 or later (^1.0)
Plugin dependenciesNone
Sourcesamples/plugins/csv_export/ in the NP Editor source (Plugin.cs · CsvExport.csproj · plugin.json)
  1. Build it.
    dotnet build samples/plugins/csv_export/CsvExport.csproj -c Release
    If you build outside the source tree, change the csproj to reference NP.Editor.Sdk.dll in the install folder, as in Quick start.
  2. Copy CsvExport.dll and plugin.json to %APPDATA%\NPEditor\plugins\csv_export\. Do not include NP.Editor.Sdk.dll.
  3. In Tools › Plugin Manager…, click Rescan.
  4. You are done when 블록 통계 CSV (예제) is On.
  1. Open a map. To count only part of it, select a region.
  2. Select Build › Export: 블록 통계 CSV.
  3. Choose a file name to save to. The default name is <world name>.csv.
  4. The notification 블록 통계 CSV: 종 → appears.
  5. Korean text does not break when opened in Excel (UTF-8 BOM).

You can also view the result directly in the console (the numbers are examples).

> blockstats 3
블록 2,304칸 · 4종 · 편집 2번(2,304칸)
minecraft:grass_block 2,048
minecraft:stone_bricks 200
minecraft:oak_stairs 40
KindNameDescription
ExportBuild › Export: 블록 통계 CSV (.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.
Commandblockstats [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.
EventCommittedCounts the undo steps and changed cells since the plugin was enabled (or since a new world).
EventWorldChangedResets the edit count to 0.
ColumnContentsExample
blockBlock id without propertiesminecraft:oak_stairs
stateFull block state string"minecraft:oak_stairs[facing=east,half=bottom]"
countNumber of cells40
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, descending; ties are sorted by state name.
  • Values containing commas or double quotes are wrapped in double quotes. A state with two or more properties is such a case.
  • The file is written as UTF-8 with BOM.
  • Counts are per block state. The blockstats rows show ids without properties, so the same id can appear on several rows (stairs facing different directions and so on).
  • The plugin.json description says “파일 › 내보내기” (File › Export). Since 0.9.0, export items are in the Build menu.
  • In a large world it scans the whole world, so it takes time. The editor freezes meanwhile.
  • The edit count is kept in memory only. It is 0 after the editor restarts.
VersionDateDetails
1.0.02026-10-02First version: export 블록 통계 CSV · command blockstats · Committed edit count