open-index/open-npm huggingface dataset:
npm package: @minecraft-ex/server
Description: Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.
Author: PrairieFire2b
Latest version: 0.1.3

# `@minecraft-ex/server`

Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.

## Installation

Execute the following commands

```shell
npm install @minecraft-ex/server
cd node_modules/@minecraft-ex/server
npm run build && cd ../../
```

If error, you should make sure that typescript is installed
Or use `npm install -g typescript`

Change the statements of imports

```ts
- import * as server from "@minecraft/server"
+ import * as server from "@minecraft-ex/server"
```

## **NOTE: This version of this module is still in pre-release.  It may change or it may be removed in future releases.**
npm package: @minecraft-js/bufwrapper
Description: Encode and decode data using buffers
Author: RichardDorian
Latest version: 1.4.6

# BufWrapper

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/BufWrapper/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/BufWrapper?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/bufwrapper?style=for-the-badge)

Encode and decode data using buffers

# Features

Encode and decode:

- Varint
- String
- Int
- Long
- Array of strings
- Array of ints
- UUID
- Byte
- Boolean
- Float
- Short
- Double

⚠️ They are all signed and big endian (As Java does)

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/bufwrapper
```

And then import it in your JavaScript/TypeScript file

```ts
const { BufWrapper } = require('@minecraft-js/bufwrapper'); // CommonJS

import { BufWrapper } from '@minecraft-js/bufwrapper'; // ES6
```

## Writing a buffer

First, instantiate a new BufWrapper

```js
const buf = new BufWrapper();
```

And then you can use any method to write data into it

```js
buf.writeInt(42);
buf.writeString('Hello World');
buf.writeLong(123456789);
```

## Reading a buffer

To read a buffer content, you need to instantiate a new BufWrapper and pass the buffer to the constructor

```js
// Buffer with dummy data
const buffer = Buffer.from(
  '0000002a0b48656c6c6f20576f726c6400000000075bcd15',
  'hex'
);

const buf = new BufWrapper(buffer);
buf.readInt(); // 42
buf.readString(); // 'Hello World'
buf.readLong(); // 123456789
```

## Note on the speed

By default the library can be slow if you are writing a lot of data.
The writing process can be optimized by using the `oneConcat` option.

This option requires an additional call after writing the data.

```js
const buf = new BufWrapper(null, { oneConcat: true });
buf.writeInt(42);
buf.writeString('Hello World');
buf.writeLong(123456789);

// The call required
buf.finish();
```

Before you call the `BufWrapper#finish` method, the `BufWrapper#buffer` property will be an empty buffer.

You can see by yourself the speed upgrade by running the `test/time.js` file. Here is
what I got on my computer when writing 150,000 integers

```
$ node test/time.js
oneConcat = false : 7.261s
oneConcat = true  : 63.869ms
```

See more here: https://minecraftjs.github.io/BufWrapper/
npm package: @minecraft-js/chat
Description: Parse and serialize Minecraft chat messages
Author: RichardDorian
Latest version: 1.0.0

# Chat

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/Chat/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/Chat?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/Chat?style=for-the-badge)

Parse and serialize Minecraft chat messages. Provides builders to make it easy to do.

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/chat
```

And then import it in your JavaScript/TypeScript file

```ts
const chat = require('@minecraft-js/chat').default; // CommonJS

import * as chat from '@minecraft-js/chat'; // ES6
```

## Build a message

```js
const component = new chat.StringComponentBuilder();
component
.setText('Hello World') // Set the text to 'Hello World'
.setColor(chat.MinecraftColor.RED) // Set the color to red
.setBold(true); // Set the bold flag to true
// And so on, all fields are handled by the builder
```

## Parse a message

```js
const message = '{"translate":"chat.type.text","with":[{"text":"Herobrine","clickEvent":{"action":"suggest_command","value":"/msg Herobrine "},"hoverEvent":{"action":"show_entity","value":"{id:f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2,name:Herobrine}"},"insertion":"Herobrine"},{"text":"I don\'t exist"}]}'
const parsed = chat.ComponentBuilder.parse(message);

console.log(parsed.component.translate); // chat.type.text
parsed.setTranslate('chat.whatever');
console.log(parsed.component.translate); // chat.whatever
```


Everything is typed and documented as well. (Most of the documentation is a copy paste from [Wiki.vg](https://wiki.vg/Chat)
npm package: @minecraft-js/launcher
Description: Makes creating Minecraft launchers in JavaScript an easy task
Author: RichardDorian
Latest version: 1.0.0

# Launcher

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/launcher/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/launcher?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/launcher?style=for-the-badge)

This library makes creating Minecraft launchers in JavaScript very easy. It'll help you managing all the stuff Minecraft requires like downloading the game and the assets.

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/launcher
```

And then import it in your JavaScript/TypeScript file

```ts
const { mcFolder } = require('@minecraft-js/launcher'); // CommonJS

import { mcFolder } from '@minecraft-js/launcher'; // ES6
```

## Downloading assets

```ts
await mcFolder.downloadAssets('1.16.5'); // You can put any version here
```
npm package: @minecraft-js/lunarbukkitapi
Description: Defines the Lunar Client Bukkit protocol
Author: RichardDorian
Latest version: 1.3.0

# LunarBukkitAPI

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/LunarBukkitAPI/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/LunarBukkitAPI?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/lunarbukkitapi?style=for-the-badge)

Defines the Lunar Client Bukkit protocol

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/lunarbukkitapi
```

And then import it in your JavaScript/TypeScript file

```ts
const LunarClient = require('@minecraft-js/lunarbukkitapi'); // CommonJS

import * as LunarClient from '@minecraft-js/lunarbukkitapi'; // ES6
```

## High level API

This library comes with a high level API for a player which means you can easily set cooldowns, set waypoints without even touching any packets!

For now since there's no MinecraftJS client/server library you need to set your own
packet sending/receiving handling.

At the time of writing, the biggest client/server library is [PrismarineJS](https://github.com/PrismarineJS/node-minecraft-protocol)
and here is a simple example with that library

```js
// PrismarineJS
const mc = require('minecraft-protocol');
const server = mc.createServer({ ... });

server.on('login', (client) => {
  ...

  let playerChannel = '';
  const lunarPlayer = new LunarClient.LunarClientPlayer({
    customHandling: {
      registerPluginChannel(channel) {
        playerChannel = channel;

        // PrismarineJS way of sending packets
        client.write('custom_payload', {
          channel: 'REGISTER',
          data: Buffer.from(channel + '\0')
        });
      },

      sendPacket(buffer) {
        // PrismarineJS way of sending packets
        client.write('custom_payload', {
          channel: playerChannel,
          data: buffer
        })
      }
    }
  });

  // Sending a cooldown
  // with id of `pearl`
  // for 15s and an ender
  // pearl as item (368)
  lunarPlayer.addCooldown('pearl', 15000, 368);
});
```

# Benchmarks

Packet used in the benchmark: `CooldownPacket`

Computer specs: Ryzen 5 3600 - 16GB at 2100MHz

```
Reading x 836,146 ops/sec ±0.28% (97 runs sampled)
Writing x 432,880 ops/sec ±1.23% (95 runs sampled)
```

Run this command to run the benchmarks on your machine

```bash
$ npm run benchmark
```
npm package: @minecraft-js/nbt
Description: Read and write NBT files. Also supports Zlib and Gzip
Author: RichardDorian
Latest version: 1.1.0

# nbt

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/nbt/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/nbt?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/nbt?style=for-the-badge)

Read and write NBT files. Also supports Zlib and Gzip

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/nbt
```

And then import it in your JavaScript/TypeScript file

```ts
const { parseNBT, writeNBT } = require('@minecraft-js/nbt'); // CommonJS

import { parseNBT, writeNBT } from '@minecraft-js/nbt'; // ES6
```

## Parsing

No need to specify the compression if the file is compressed. The writer will figure it out by itself.

Note: _Here I got the data by reading a file but you can get it whatever you want as long as you provide a valid buffer with valid NBT data inside._

```js
import { readFileSync } from 'node:fs';

const buffer = readFileSync('myFile.nbt');
const parsed = parseNBT(buffer);
```

## Writing

To write an NBT file you must pass a `NBT_Compound` instance to the write function.

```js
import { writeFileSync } from 'node:fs';

const buffer = writeNBT(compound);
writeFileSync('myFile.nbt', buffer);
```

# Benchmark

Data used: [bigtest.nbt](https://wiki.vg/NBT#bigtest.nbt)

Computer specs: Ryzen 5 3600 - 16GB at 2100MHz

```
--- Reading benchmarks ---
Reading | Uncompressed x 587,802 ops/sec ±0.47% (96 runs sampled)
Reading | Gzip x 15,892 ops/sec ±0.36% (90 runs sampled)
Reading | Zlib x 83,879 ops/sec ±2.72% (84 runs sampled)

--- Writing benchmarks ---
Reading | Uncompressed x 305,369 ops/sec ±0.57% (96 runs sampled)
Reading | Gzip x 62,383 ops/sec ±1.14% (92 runs sampled)
Reading | Zlib x 63,816 ops/sec ±0.67% (89 runs sampled)
```
npm package: @minecraft-js/protocol-1.8
Description: Minecraft 1.8 protocol (47)
Author: RichardDorian
Latest version: 1.0.3

# Minecraft 1.8 Protocol

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/protocol-1.8/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/protocol-1.8?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/protocol-1.8?style=for-the-badge)

Minecraft 1.8 protocol (47)

# Benchmarks

Packet used in the benchmark: `HandshakePacket`

Computer specs: Ryzen 5 3600 - 16GB at 2100MHz

```
--- Reading benchmarks ---
Reading | Uncompressed + Unencrypted x 1,095,528 ops/sec ±1.29% (91 runs sampled)
Reading | Compressed   + Unencrypted x 1,461,069 ops/sec ±0.21% (94 runs sampled)
Reading | Compressed   + Encrypted   x 1,380,441 ops/sec ±0.80% (97 runs sampled)
Reading | Uncompressed + Encrypted   x 1,398,104 ops/sec ±0.35% (94 runs sampled)

--- Writing benchmarks ---
Writing | Uncompressed + Unencrypted x 305,641 ops/sec ±0.38% (96 runs sampled)
Writing | Compressed   + Unencrypted x 63,164 ops/sec ±1.66% (91 runs sampled)
Writing | Compressed   + Encrypted   x 55,236 ops/sec ±1.03% (89 runs sampled)
Writing | Uncompressed + Encrypted   x 207,023 ops/sec ±0.89% (93 runs sampled)
```

Run this command to run the benchmarks on your machine

```bash
$ npm run benchmark
```
npm package: @minecraft-js/proxies
Description: Create proxies for Minecraft
Author: RichardDorian
Latest version: 1.0.0

# Proxies

Create proxies for Minecraft

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/proxies
```

And then import it in your JavaScript/TypeScript file

```ts
const Proxies = require('@minecraft-js/proxies'); // CommonJS

import * as Proxies from '@minecraft-js/proxies'; // ES6
```

## Read only proxies
Read only proxies are proxies where you can only read packets.
Create a read only proxy like so

```js
const proxy = new Proxies.ReadOnlyProxy({
  serverHostname: 'localhost', // Target server hostname
  port: 8080, // Proxy port
});
```

And then you can use the `ReadOnlyProxy#on` method to listen for different events:
- `raw_listening` - When the TCP server is listening
- `raw_connect` - When a client opens a connection
- `raw_disconnect` - When a client closes a connection
- `raw_close` - When the TCP server is closed
- `error` - When an error occurs
- `outgoing_data` - When data is sent to the target server
- `incoming_data` - When data is received from the target server

# Using TypeScript?
If you are using TypeScript or you want type checking make sure to install the `typed-emitter` package!
```bash
$ npm install typed-emitter
```
npm package: @minecraft-js/rcon
Description: RCON Minecraft client written in TypeScript
Author: RichardDorian
Latest version: 1.1.0

# rcon

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MinecraftJS/rcon/Build?style=for-the-badge)
![GitHub](https://img.shields.io/github/license/MinecraftJS/rcon?style=for-the-badge)
![npm (scoped)](https://img.shields.io/npm/v/@minecraft-js/rcon?style=for-the-badge)

RCON Minecraft client written in TypeScript

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/rcon
```

And then import it in your JavaScript/TypeScript file

```js
const { RCONClient } = require('@minecraft-js/rcon'); // CommonJS

import { RCONClient } from '@minecraft-js/rcon'; // ES6
```

## Connect

```js
const client = new RCONClient('127.0.0.1', 'my_password');

client.connect();
```

## Listen for events

```js
client.on('authenticated', () => {
  // Do stuff
});

client.on('error', () => {
  // Do stuff
});

// ...
```

## Execute a command

```js
client.on('response', (requestId, packet) => {
  // Do something with requestId and packet
  // Access the command response by `packet.payload`
});

const requestId = client.executeCommand('whitelist list');
```

Full doc: https://minecraftjs.github.io/rcon/
npm package: @minecraft-js/uuid
Description: Serialize, deserialize and generate UUIDs in JavaScript
Author: RichardDorian
Latest version: 1.0.3

# uuid

Serialize, deserialize and generate UUIDs in JavaScript

# Documentation

## Installation

Install the package:

```bash
$ npm install @minecraft-js/uuid
```

And then import it in your JavaScript/TypeScript file

```ts
const { UUID } = require('@minecraft-js/uuid'); // CommonJS

import { UUID } from '@minecraft-js/uuid'; // ES6
```

## Generating an UUID

To generate an UUID use the `generateV4` function that you can import from the package.

```ts
const uuid = generateV4();

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

## Parsing an UUID

If you need to parse UUIDs easily from a string (with dashes or not, both are supported) use the `parseUUID` function.

```ts
const parsed = parseUUID('7ed9e77e-34b8-400e-b684-9093c550b4f9');

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

The parseUUID runs a check to see whether or not the string is a valid UUID before parsing it. If you are 100% sure that the string is a valid UUID you could set the `disableTypeCheck` argument to true to skip that check and makes the function very fast.

```ts
const parsed = parseUUID('7ed9e77e-34b8-400e-b684-9093c550b4f9', true);

console.log(uuid); // 'UUID <7ed9e77e-34b8-400e-b684-9093c550b4f9>'
```

See more here: https://minecraftjs.github.io/uuid/