Modifying outgoing packets without changing node_modules?
I'm writing a bot and I need to modify every position packet (0x14 and 0x15 to be precise) but every way I found requires me to change code in node_modules (hell) and they all work half arsed and straight up don't with control state. Thank you in advance.
Do you mean the server and client you're using do not follow the Minecraft protocol?
You could use the custom packets feature of node-minecraft-protocol
On Wed, Sep 7, 2022, 09:30 Ali Furkan YILDIZ @.***> wrote:
I'm writing a bot and I need to modify every position packet (0x14 and 0x15 to be precise) but every way I found requires me to change code in node_modules (hell) and they all work half arsed and straight up don't with control state. Thank you in advance.
— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/node-minecraft-data/issues/233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437QME3VB4W5XPIKYBZLV5BAC3ANCNFSM6AAAAAAQGPNZ4A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
No, I just want to edit the X and Z of the position packets I'm sending.
Kinda like a mixin.
Do you want to edit the type or the value ?
For the type you can use node-minecraft-protocol custom packets For the value you can use a node-minecraft-protocol proxy, client or server depending on your use case
the value, I'm running a bot
Is the proxy only way to go in this case?
No if you're running a bot you can use mineflayer directly. bot.position = new Vec3(1,2,3)
On Wed, Sep 7, 2022, 10:46 Ali Furkan YILDIZ @.***> wrote:
the value, I'm running a bot
Is the proxy only way to go in this case?
— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/node-minecraft-data/issues/233#issuecomment-1239094181, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437TXAI4WCMRKOJX7C33V5BI5VANCNFSM6AAAAAAQGPNZ4A . You are receiving this because you commented.Message ID: @.***>
but bot.setControlState('...', true) will not get filtered by that. Also I'm interacting with both mineflayer and protocol.
I think you should say more about what you want to do, it's not clear. What is "filtered" ? You dont need to hack things around, simply implement it directly the way you want it
hook outgoing packets
const old_write = bot._client.write.bind(bot._client);
bot._client.write = (name, data) => {
if (['position', 'position_look'].includes(name)) {
data.x = /*modified value*/;
data.z = /*modified value*/;
}
return old_write(name, data);
}