https://github.com/matcool/node-anvil
Simple package for making your own minecraft regions
https://github.com/matcool/node-anvil
minecraft minecraft-saves npm
Last synced: over 1 year ago
JSON representation
Simple package for making your own minecraft regions
- Host: GitHub
- URL: https://github.com/matcool/node-anvil
- Owner: matcool
- Created: 2019-08-20T21:18:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-23T23:00:19.000Z (almost 7 years ago)
- Last Synced: 2024-04-26T09:03:56.095Z (about 2 years ago)
- Topics: minecraft, minecraft-saves, npm
- Language: JavaScript
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-anvil
Simple package that can write region files in the [Minecraft anvil file format](https://minecraft.gamepedia.com/Anvil_file_format)
Only supports 1.14 and reading support is planned
# Installation
```
npm install node-anvil
```
# Usage
```js
const anvil = require('node-anvil');
let region = new anvil.Region(0, 0);
// 10x10 grass block platform
region.fill(new anvil.Block('minecraft', 'grass_block'), 0, 0, 0, 9, 0, 9);
// Fill mapping
let blocks = [
new anvil.Block('minecraft', 'stone'),
new anvil.Block('minecraft', 'dirt')
];
region.fill((x, y, z) => {
return blocks[Math.floor(Math.random() * blocks.length)];
}, 0, 0, 10, 5, 5, 15);
// Oak log facing up
region.setBlock(new anvil.Block('minecraft', 'oak_log', { axis: 'y' }), 0, 1, 0);
// Persistent oak leaves on top of it
region.setBlock(new anvil.Block('minecraft', 'oak_leaves', { persistent: true }), 0, 2, 0);
// Tall grass consists of two tall_grass blocks, one with half: 'lower', and the other with half: 'upper'
region.setBlock(new anvil.Block('minecraft', 'tall_grass', { half: 'lower' }), 1, 1, 1);
region.setBlock(new anvil.Block('minecraft', 'tall_grass', { half: 'upper' }), 1, 2, 1);
// save() returns a Buffer with the data, but you can provide a file and it'll save there
region.save('r.0.0.mca');
```