JSPM

  • Created
  • Published
  • Downloads 52
  • Score
    100M100P100Q78868F
  • License GPL-3.0

a minecraft proxy library powered by mineflayer

Package Exports

  • @rob9315/mcproxy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rob9315/mcproxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mcproxy

a minecraft proxy library powered by mineflayer that replicates data as well as possible from available information of mineflayer

Contribution

This project was inspired by 2bored2wait and now serves as a dependency of it. This project relies heavily on the great work that the awesome people of the PrismarineJS project have done.

API

This project provides the Conn class, which enables you to create a connection to a server and connect clients to the Conn instance. The connection will stay after you disconnect from the Conn instance.

// How to instanciate Conn:
import { Conn } from "@rob9315/mcproxy";
const conn = new Conn(botOptions: mineflayer.BotOptions, relayExcludedPacketNames?: string[], options: ConnOptions);

Conn.bot

Conn.bot is the mineflayer Bot integrated into the library

Conn.pclient

This should not be overwritten, there is a method to change this property. It is the proxyClient that packets are being relayed to. To attach a client, use Conn.link.

Conn.excludedPacketNames

the array one can set at creation of the conn object, can be changed at runtime after being instanciated, (though shouldn't be).

Conn.generatePackets()

Conn.generatePackets(): Packet[]

returns the generated packets for the current gamestate

Conn.sendPackets()

Conn.sendPackets(pclient)

this method calls Conn.generatePackets() and sends the packets to the proxyClient specified

Conn.link(pclient)

this method stops the internal bot from sending any packets to the server and starts relaying all packets to the proxyClient as well as sending the packets from the proxyClient to the server.

Conn.unlink(pclient)

this method removes the proxyClient linked by the .link() method and cleans up afterwards

Conn.writeIf()

Conn.writeIf(name, data)

this is an internal method for filtering Packets, can be used outside but is mostly not necessary to use