Open rom1504 opened 9 years ago
I... oh god this is both a terrible and great idea XD.
So you'd use the minecraft client as a viewer for what the mineflayer bot is doing ?
@roblabla Yeah that's the idea. Not sure how doable that is, it seems easy and at the same time both mineflayer, node-minecraft-protocol, the vanilla server and the vanilla client were not meant for that at all so we'll see if that can work :D
Sort of like https://github.com/zerowidth/golem? ("minecraft beta proxy · no longer maintained")
Yes exactly
On Thu, Feb 18, 2016, 02:02 deathcap notifications@github.com wrote:
Sort of like https://github.com/zerowidth/golem? ("minecraft beta proxy · no longer maintained")
— Reply to this email directly or view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/315#issuecomment-185486107 .
this works but you cant do much since mineflayer isn't written to support this.
const version = '1.9.4'
const nmp = require('minecraft-protocol')
const mineflayer = require('mineflayer')
const server = nmp.createServer({ port:25566, version })
server.on('login', connect)
function connect(client) {
const bot = mineflayer.createBot({
username: client.username,
version,
keepAlive: false,
plugins: {
physics: false
}
})
bot._client.on('raw', (buffer, metadata) => {
if (metadata.state !== 'play') return
client.writeRaw(buffer)
})
client.on('raw', buffer => bot._client.writeRaw(buffer))
}
@plexigras how would you connect to another server using that code?
edit: nvm i cant think
by setting the mineflayer.createBot
options?
I'm trying to make the code @plexigras provided a few comments above and I'm running into a kind of strange issue. My client connects fine but it gets kicked by the real server 1-2 after login due to a timeout, so I'm guessing the real server expects some packet (keepAlive maybe) that my proxy isn't sending. I'd really appreciate some help.
One thing to mention is that this error doesn't happen when using this code from node-minecraft-protocol
My code can be seen here
Seems like this error is fixed just by modifying this line
client.on('raw', buffer => bot._client.writeRaw(buffer))
to
client.on('raw', (buffer, metadata) => {
if(metadata.name === 'keep_alive') {
if(buffer.toString('hex') === '0b0000000000000000') return;
}
// Send event to server
bot._client.writeRaw(buffer)
})```
bump
do you mean you're interested to work on this @iBuyMountainDew ?
I am just going to leave this here, currently only actively developed for the 1.12.2 but many other versions should work too mcproxy
How about implementing all this in a fabric mod. I am also just thinking of controlling the bots via a fabric pinging system etc via a RESTFUL API.
What are your thoughts? Any better ideas than RESTFUL or some example codes?
And wouldn't it be much cooler to "jump into the bot" and control it rather the other way around? Maybe I just misunderstood you guys but both ideas sound awesome!
I made it lol
Would it be possible to make a proxy and plug mineflayer in it ? That way it would be possible to see with the vanilla client what the bot is doing. proxy examples :
idea from @Corgano
It would probably mean ignoring everything the vanilla client is saying