Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
IceTank committed Apr 11, 2023
2 parents a7a5621 + e4b0593 commit 64f0eaa
Show file tree
Hide file tree
Showing 10 changed files with 651 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules
package-lock.json
dist
worlds/**
nmp-cache/**
nmp-cache/**
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Makes a new Inspector Proxy class.
- `disabledCommands` Optional. Defaults to `false`. Disables all in game commands.
- `toClientMiddlewares` Optional. Array off additional middlewares to register for each client's packets going from server to client.
- `toServerMiddlewares` Optional. Array off additional middlewares to register for each client's packets going from client to server.
- `worldCaching` Optional. Defaults to `true`. If `false` deactivates world caching.

### `botIsInControl()`
Returns true when no client is currently controlling the proxy
Expand Down
54 changes: 21 additions & 33 deletions example/simpleProxy.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,39 @@
const { InspectorProxy } = require('../')

const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})

rl.on('line', (line) => {
line = line.trim().toLowerCase()
if (line === 'stopserver') {
proxy.stopServer()
} else if (line === 'startserver') {
proxy.startServer()
} else if (line === 'stopbot') {
proxy.stopBot()
} else if (line === 'startbot') {
proxy.startBot()
}
})
const { Vec3 } = require('vec3')

const proxy = new InspectorProxy({
host: 'localhost',
username: 'proxyBot',
version: '1.12.2'
auth: 'offline',
profilesFolder: './nmp-cache',
version: '1.12.2',
checkTimeoutInterval: 90_000,
// port: 25567
}, {
linkOnConnect: true,
// linkOnConnect: true,
botAutoStart: false, // start the bot when the proxy starts
botStopOnLogoff: false, // Stop the bot when the last person leaves the proxy
botStopOnLogoff: true, // Stop the bot when the last person leaves the proxy
serverAutoStart: true, // start the server when the proxy starts
serverStopOnBotStop: false, // Stop the server when the bot stops
autoStartBotOnServerLogin: false
autoStartBotOnServerLogin: true,
// positionOffset: new Vec3(5000, 0, 0),
worldCaching: false
})

proxy.on('clientDisconnect', () => {
console.info('Client disconnected')
})

proxy.on('serverStart', () => console.info('Server started'))
proxy.on('serverClose', () => console.info('Server closed'))
proxy.on('botEnd', () => console.info('Bot disconnected'))

proxy.on('botStart', (conn) => {
conn.bot.on('spawn', () => {
console.info('Bot spawned')
})

console.info('Bot spawned')

proxy.on('clientChat', (client, line) => {
if (line === 'test') {
console.info(proxy.conn.receivingClients)
}
})

conn.bot._client.on('packet', (data, packetMeta) => {
if (packetMeta.name === 'unlock_recipes') { // This packet is blocked because it is causing issues on 2beeetwoteee
console.info(data)
}
})
})
9 changes: 9 additions & 0 deletions example/writeLevel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const writeLevel = require('prismarine-provider-anvil').level.writeLevel

if (process.argv.length !== 3) {
console.log('Usage : node example_write_level.js <level.dat>')
process.exit(1)
}

writeLevel(process.argv[2], { RandomSeed: [123, 0] })
.catch(function (err) { console.log(err.stack) })
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mineflayer-proxy-inspector",
"version": "1.11.1",
"version": "2.0.2",
"description": "Package for inspecting mineflayer bots as fake players in-game",
"main": "dist/index.js",
"scripts": {
Expand All @@ -13,11 +13,16 @@
"author": "Ic3Tank",
"license": "ISC",
"dependencies": {
"@rob9315/mcproxy": "github:IceTank/mcproxy-1#076c4a11584b2d3e78577bb2979afd01c6e2b611",
"@icetank/mcproxy": "^1.0.0",
"minecraft-protocol": "^1.35.0",
"mineflayer": "^4.2.0"
"mineflayer": "^4.2.0",
"prismarine-provider-anvil": "^2.7.0",
"prismarine-world": "^3.6.1"
},
"devDependencies": {
"@types/node": "^16.11.13"
},
"resolutions": {
"mineflayer/prismarine-world": "IceTank/prismarine-world.git#storage-provider-save-fix"
}
}
Loading

0 comments on commit 64f0eaa

Please sign in to comment.