From 1c13fe3bbb402a688aacc18f5abc3d8201b13089 Mon Sep 17 00:00:00 2001 From: Mohmmad Qunibi Date: Sun, 10 Nov 2024 08:31:09 +0300 Subject: [PATCH 1/3] Make the bot accept resource packs --- .gitignore | 1 + src/utils/mcdata.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 6dc4554..1e92ae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/ +.idea/ node_modules/ package-lock.json code_records/ diff --git a/src/utils/mcdata.js b/src/utils/mcdata.js index 04a535a..4df8b2a 100644 --- a/src/utils/mcdata.js +++ b/src/utils/mcdata.js @@ -68,6 +68,9 @@ export function initBot(username) { bot.loadPlugin(collectblock); bot.loadPlugin(autoEat); bot.loadPlugin(armorManager); // auto equip armor + bot.once('resourcePack', () => { + bot.acceptResourcePack(); + }); return bot; } From 902d5aa005b2901d8626756831f2a40f0711914a Mon Sep 17 00:00:00 2001 From: Nimi Date: Thu, 14 Nov 2024 17:06:26 -0600 Subject: [PATCH 2/3] Apply profile skin on login --- src/agent/agent.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/agent/agent.js b/src/agent/agent.js index d7f36d6..83c6692 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -84,6 +84,14 @@ export class Agent { this.bot.on('login', () => { console.log('Logged in!'); + + // Set skin for profile after 500ms. Requires Fabric Tailor. (https://modrinth.com/mod/fabrictailor) + if (this.prompter.profile.skin) + { + setTimeout(() => { + this.bot.chat(`/skin set URL ${this.prompter.profile.skin.model} ${this.prompter.profile.skin.path}`); + }, 500); + } }); this.bot.once('spawn', async () => { @@ -93,7 +101,7 @@ export class Agent { // wait for a bit so stats are not undefined await new Promise((resolve) => setTimeout(resolve, 1000)); - + console.log(`${this.name} spawned.`); this.clearBotLogs(); From b4c2c9fc373ebc642a3b868e1bd0509159875ba5 Mon Sep 17 00:00:00 2001 From: Nimi Date: Thu, 14 Nov 2024 17:18:50 -0600 Subject: [PATCH 3/3] Added 'clear' cmd, removed timeout --- src/agent/agent.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/agent/agent.js b/src/agent/agent.js index 83c6692..198de7b 100644 --- a/src/agent/agent.js +++ b/src/agent/agent.js @@ -85,13 +85,11 @@ export class Agent { this.bot.on('login', () => { console.log('Logged in!'); - // Set skin for profile after 500ms. Requires Fabric Tailor. (https://modrinth.com/mod/fabrictailor) + // Set skin for profile, requires Fabric Tailor. (https://modrinth.com/mod/fabrictailor) if (this.prompter.profile.skin) - { - setTimeout(() => { - this.bot.chat(`/skin set URL ${this.prompter.profile.skin.model} ${this.prompter.profile.skin.path}`); - }, 500); - } + this.bot.chat(`/skin set URL ${this.prompter.profile.skin.model} ${this.prompter.profile.skin.path}`); + else + this.bot.chat(`/skin clear`); }); this.bot.once('spawn', async () => {