# geocraft

> Minecraft world based on data from geojson files

Latest version **0.0.4** (published 2018-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install geocraft
pnpm add geocraft
yarn add geocraft
bun add geocraft
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-11-27 |
| First published | 2018-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 304.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yaroslav Gaponov |
| Maintainers | yaroslavgaponov |
| Keywords | minecraft, server, geo, geojson |

## Links

- npm: https://www.npmjs.com/package/geocraft
- Repository: https://github.com/YaroslavGaponov/geocraft
- Homepage: https://github.com/YaroslavGaponov/geocraft#readme
- Issues: https://github.com/YaroslavGaponov/geocraft/issues
- npm.io page: https://npm.io/package/geocraft

## Dependencies (3)

- [bresenham](https://npm.io/package/bresenham.md) 0.0.4
- [nodecraft](https://npm.io/package/nodecraft.md) >=0.0.9
- [points-in-polygon](https://npm.io/package/points-in-polygon.md) ^0.2.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.4 (latest) — 2018-11-27
- 0.0.3 — 2018-11-23
- 0.0.2 — 2018-11-22
- 0.0.1 — 2018-11-22

## README

GeoCraft
=====================
Minecraft world from GeoJson

### Steps
- Create GeoJson file
    I am using [geojson.io](http://geojson.io/)

![http://geojson.io/](https://raw.githubusercontent.com/YaroslavGaponov/geocraft/master/images/geojson.jpg "http://geojson.io/")

- My demo map
[github link](https://github.com/YaroslavGaponov/geocraft/blob/master/example/map.geojson)

- Run NodeCraft server

```bash
npm init
npm run demo ~/Downloads/map.geojson
```
 or 

```bash
npm init
npm run demo
```

- Run Minecraft client

![minecraft](https://raw.githubusercontent.com/YaroslavGaponov/geocraft/master/images/minecraft.jpg "nodecraft")

### Server example

```javascript
const fs = require('fs');
const Game = require('nodecraft').Game;
const GeoRender = require('..');

const GEOFILE = process.argv.length > 2 ? process.argv.pop() : `${__dirname}/map.geojson`;

const game = new Game();
const server = game.getServer();
const land = game.getLand();
const render = new GeoRender(land);

console.log(`loading ${GEOFILE}...`);
const features = JSON.parse(fs.readFileSync(GEOFILE)).features;
console.log(`features ${features.length}`);
features.forEach(feature => render.add(feature));
console.log('done');

server.on('packet:handshake', (clientID, packet) => {
        console.log(`Hi, ${packet.username}`);

        const [x, z] = render.getBirthplace();

        server
            .login(clientID, {
                eid: 0,
                level_type: 'flat',
                game_mode: 1,
                dimension: 0,
                difficalty: 0,
                magic: 0,
                max_player: 25
            })
            .spawn_position(clientID, {
                x,
                y: 30,
                z
            })
            .player_position_and_look(clientID, {
                x,
                stance: 94.62,
                y: 30,
                z,
                yaw: 0,
                pitch: 0,
                on_ground: 1
            });
    })
    .start(25565);
```

---
_Source: https://npm.io/package/geocraft · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
