From 902d5aa005b2901d8626756831f2a40f0711914a Mon Sep 17 00:00:00 2001 From: Nimi Date: Thu, 14 Nov 2024 17:06:26 -0600 Subject: [PATCH 1/2] 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 2/2] 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 () => {