npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minecraft-chunk-dumper

v1.3.0

Published

Dumps chunks for any minecraft version

Downloads

6

Readme

minecraft-chunk-dumper

NPM version Build Status

Dumps chunks for minecraft versions 1.7 to 1.15

Install

To install a minecraftChunkDumper command line program, run:

npm install minecraft-chunk-dumper -g

Usage

Cli

$ minecraftChunkDumper --help

Usage:
    minecraftChunkDumper [command] <minecraft-version> <options>

Example:
    minecraftChunkDumper saveChunk "1.14.4" "chunk.dump" "chunk.meta" "chunk_light.dump" "chunk_light.meta"

Commands:
    saveChunk <minecraft-version> <chunk-file> <meta-file>    save a single chunk file to specified files
    saveChunks <minecraft-version> <folder> <count>           save the specified number of chunks to the given folder
    continuouslySave <minecraft-version> <folder>             continuously saves chunks to the specified folder, until the program is stopped

Programmatic example

const ChunkDumper = require('minecraft-chunk-dumper')

const chunkDumper = new ChunkDumper('1.14.4')

async function run () {
  await chunkDumper.start()
  chunkDumper.on('chunk', (x, z, bitMap, chunkData) => console.log('I received a chunk at ' + x + ';' + z))
  chunkDumper.on('chunk_light', ({ chunkX, chunkZ }) => console.log('I received a chunk light at ' + chunkX + ';' + chunkZ))
  await chunkDumper.saveChunks('dumps/', 100)
  await chunkDumper.stop()
}

run().then(() => console.log('All done !'))

Debugging

You can enable some debugging output using DEBUG environment variable:

DEBUG="chunk-dumper" node [...]

API

ChunkDumper is a class which can dumps chunk for a given minecraft version.

It saves 2 type of files :

  • Chunk files contain the buffer of the chunk (binary format)
  • Metadata files are json files of that shape : {"x":-10,"z":-1,"groundUp":true,"bitMap":15,"biomes":[1,2...]}

for more recent versions (starting from 1.14), it also saves chunk light files :

  • Chunk light files contain the buffer of the chunk (binary format)
  • Metadata chunk light files are json files of that shape : {"chunkX":-10,"chunkZ":-1,"skyLightMask":15,"blockLightMask":15,"emptySkyLightMask":15,"emptyBlockLightMask":15}

You should create an instance with the version you want. Then start it. You then have several possibilities :

  • use the "chunk" event to do whatever you want with chunks
  • use saveChunk to save a single chunk
  • use the saveChunks to save a given number of chunks
  • use the startSavingChunks to continuously save chunks, then call stopSavingChunks to stop

When you are done, you should call the stop method to finish your session.

ChunkDumper(version)

Build a new ChunkDumper for minecraft version

ChunkDumper.start()

Downloads and starts the server then connect a node-minecraft-protocol client to it. Returns a promise when ready.

ChunkDumper.stop()

Stops the nmp client then stops the server. Returns a promise when finished.

ChunkDumper.saveChunk(chunkFile, metaFile, chunkLightFile, metaChunkLightFile)

Save 1 chunk in specified chunkFile and metaFile Save 1 chunk light in specified chunkLightFile and metaChunkLightFile Returns a promise when finished.

ChunkDumper.saveChunks(folder, n)

Save n chunks in specified folder Returns a promise when finished.

ChunkDumper.startSavingChunks(folder)

Continuously saves all chunk and metadata file to folder.

  • Chunks are named chunk_x_z.dump
  • Metadata files are named chunk_x_z.data
  • Chunk light files are named chunk_light_x_z.dump
  • Metadata light files are named chunk_light_x_z.data

ChunkDumper.stopSavingChunks()

Stops saving chunks

"chunk"(x, z, bitMap, chunkData)

Emitted when a chunk is received

License

MIT. Copyright (c) Romain Beaumont