0.3.6 • Published 8 months ago

mineflayer-viaproxy v0.3.6

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

mineflayer-viaproxy

NPM version

A mineflayer plugin that allows you to connect to a server through a ViaVersion proxy.

Why? Because I'm tired of people asking for version updates.

If you have issues, join here for support. Alternatively, here for general mineflayer support.

NOTICE

Because mineflayer currently doesn't support ViaProxy due to an error in prismarine-registry (see here), you must use the patched version of prismarine-registry.

This is the TypeError: Cannot read properties of undefined (reading 'overworld') error in plugins/game.js for mineflayer.

To do this, the fix below must be added to your JSON. It is dependent on the dependency installer you are using.:

// For npm:
"overrides": {
    "prismarine-registry": "git+https://github.com/GenerelSchwerz/prismarine-registry#mc-prefix-fix"
}
// For yarn:
"resolutions": {
    "prismarine-registry": "git+https://github.com/GenerelSchwerz/prismarine-registry#mc-prefix-fix"
}

NOTICE 2

This plugin does not work with Python due to JSPYBridge not having the ability to change the resolutions for libraries. I cannot do anything about this.

TODOS

  • Support bedrock versions
  • Support adding accounts to ViaProxy gracefully.
  • Make fix for prismarine-registry more robust (see patches)
  • Add support for more ViaVersion options
  • Add support for more ViaProxy options
  • Support Python

Installation

npm install mineflayer-viaproxy

Usage

const {createBot} = require('mineflayer-viaproxy')

// only difference is that this must be awaited now.
const bot = await createBot({...})

// if you want to pass viaProxy options, it'd be like so:

const orgBotOpts = {...}
const viaProxyOpts = {...}

// same object. 
const bot = await createBot({...orgBotOpts, ...viaProxyOpts});

API

Types

AuthType

enum AuthType {
    NONE,
    OPENAUTHMOD,
    ACCOUNT
}
NameValueDescription
NONE"NONE"No authentication
OPENAUTHMOD"OPENAUTHMOD"OpenAuthMod authentication
ACCOUNT"ACCOUNT"Account authentication (requires manual setup)

ViaProxyOpts

interface ViaProxyOpts {
    javaPath?: string;
    bedrock?: boolean;
    localPort?: number;
    localAuth?: AuthType,
    viaProxyLocation?: string;
    viaProxyWorkingDir?: string;
    autoUpdate?: boolean;
    viaProxyStdoutCb?: (data: any) => void
    viaProxyStderrCb?: (data: any) => void

}
NameTypeDefaultDescription
javaPathstring"java"The path to the java executable.
bedrockbooleanfalseWhether or not to use the bedrock version of ViaProxy.
localPortnumberauto determinedThe port to listen on for the local server. If none is specified, it will automatically locate an open port for you on your computer.
localAuthAuthTypeAuthType.NONEThe authentication type to use for the local server
viaProxyLocationstring""The location of the ViaVersion proxy jar. If none specified, it will download automatically to the CWD + viaproxy.
viaProxyWorkingDirstring""The working directory for the ViaVersion proxy. If none specified, it will use the CWD + viaproxy.
autoUpdatebooleantrueWhether or not to automatically update the ViaVersion proxy.
viaProxyStdoutCb(data: any) => voidundefinedA callback for the stdout of the ViaVersion proxy.
viaProxyStderrCb(data: any) => voidundefinedA callback for the stderr of the ViaVersion proxy.
0.3.6

8 months ago

0.3.5

8 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago

0.0.23

9 months ago

0.0.22

9 months ago

0.0.21

9 months ago

0.0.20

9 months ago

0.0.19

9 months ago

0.0.18

9 months ago

0.0.17

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

10 months ago