diff --git a/examples/advanced/README.md b/examples/advanced/README.md new file mode 100644 index 000000000..8087f49dd --- /dev/null +++ b/examples/advanced/README.md @@ -0,0 +1,3 @@ +# Advanced examples + +These are examples that have a very specific use-case, and most people won't need. diff --git a/examples/advanced/accept_texturepack.md b/examples/advanced/accept_texturepack.md new file mode 100644 index 000000000..c2989dffd --- /dev/null +++ b/examples/advanced/accept_texturepack.md @@ -0,0 +1,14 @@ +# Accept server's texturepack + +This code snippet tells the server that the client accepted a custom texture pack when the server sends a texture pack + +```js +bot._client.on('resource_pack_send', (data) => { + bot._client.write('resource_pack_receive', { + result: 3 + }) + bot._client.write('resource_pack_receive', { + result: 0 + }) +}) +``` diff --git a/examples/advanced/chest_confirm.md b/examples/advanced/chest_confirm.md new file mode 100644 index 000000000..5e2792337 --- /dev/null +++ b/examples/advanced/chest_confirm.md @@ -0,0 +1,14 @@ +# Menual Chest Confirm + +This code snippet will tell the bot not to wait for chest confirmations that some spigot plugins will not send + +```js +bot.on('windowOpen', async (window) => { + window.requiresConfirmation = false // fix + await bot.clickWindow(13, 0, 0) + console.log(bot._events) // without the fix this code is unreachable, the promise never resolve +}) +bot.on('windowClose', () => { + console.log(bot._events) // without the fix there is a confirmTransaction1 listener that is never removed +}) +```