From 7611a97716b073634ab42ae7a9baa74f57f4c757 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 24 Jul 2022 01:12:19 +0800 Subject: + fix improve fps --- features/events/index.js | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'features') diff --git a/features/events/index.js b/features/events/index.js index d7280db..1e5ef52 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -69,6 +69,7 @@ class Events extends Feature { this.MythMobsHPGuiElement = new ToggleSetting("Render Mythological Mobs hp on your screen", "This will help you to know their HP.", true, "myth_mobs_hp", this).contributor("EmeraldMerchant"); this.MythMobsHP = new HudTextElement().setToggleSetting(this.MythMobsHPGuiElement).setLocationSetting(new LocationSetting("Mythological Mobs Hp Location", "Allows you to edit the location of Mythological Mobs hp", "myth_mobs_location", this, [10, 50, 1, 1]).requires(this.MythMobsHPGuiElement).editTempText("&8[&7Lv750&8] &2Exalted Minos Inquisitor &a40M&f/&a40M&c❤&r")); this.hudElements.push(this.MythMobsHP); + this.Mobs = [] this.lastDing = 0 this.lastDingPitch = 0 @@ -123,7 +124,8 @@ class Events extends Feature { } }) - this.registerStep(true, 4, this.step_4fps) + this.registerStep(true, 1, this.step_1fps) + this.registerStep(true, 10, this.step_10fps) this.registerCommand("sethubwarp", () => { warpData.worldload = [Player.getX(), Player.getY(), Player.getZ()] @@ -131,18 +133,26 @@ class Events extends Feature { }) } - step_4fps() { + step_1fps() { if (!this.MythMobsHPGuiElement.getValue()) return - if (!this.showingWaypoints) return - World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((mob) => { let name = mob.getName() - if ((name.includes("Exalted") || name.includes("Stalwart")) && !name.split(" ")[2].startsWith("0")) { - this.Mobs.push(name) + if (!this.Mobs?.map(a => a.getUUID().toString()).includes(mob.getUUID().toString())) { + if ((name.includes("Exalted") || name.includes("Stalwart")) && !name.split(" ")[2].startsWith("0")) { + this.Mobs.push(mob) + } } }) - this.MythMobsHP.setText(this.Mobs.join("\n")) - this.Mobs = [] + this.Mobs = this.Mobs.filter((e) => !e[f.isDead]); + } + + step_10fps() { + if (!this.MythMobsHPGuiElement.getValue()) return + let names = [] + this.Mobs.forEach(nameTag => { + names.push(nameTag.getName()) + }) + this.MythMobsHP.setText(names.join("\n")) } entityJoinWorldEvent(e) { @@ -244,8 +254,15 @@ class Events extends Feature { } }) + let mythMobs = [] this.todoE.forEach(e => { e = new Entity(e) + try { + let health = e.getName().removeFormatting().split(" ")[4]?.split("/")[0] + if (this.MythMobsHP.getValue() && health != 0 && (e.getName().removeFormatting().includes("Exalted") || e.getName().removeFormatting().includes("Stalwart"))) { + mythMobs.push(e.getName()) + } + } catch (e) { }//not mytho mob if (e.getName().toLowerCase().includes("inquis") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) { let loc = [e.getX(), e.getY() - 1, e.getZ()] @@ -264,6 +281,9 @@ class Events extends Feature { } }) this.todoE = [] + if (mythMobs.length >= 1) { + this.mythMobsElement.setText(mythMobs.join("\n")) + } if (Player.getContainer().getName() === "Fast Travel") { this.openedWarpsMenu = true -- cgit From 413e5f1f7ab82b2b07125bca664a97db7ca40681 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 24 Jul 2022 01:20:36 +0800 Subject: fix --- features/events/index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'features') diff --git a/features/events/index.js b/features/events/index.js index 1e5ef52..62e8ec7 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -134,7 +134,7 @@ class Events extends Feature { } step_1fps() { - if (!this.MythMobsHPGuiElement.getValue()) return + if (!this.MythMobsHPGuiElement.getValue() || !this.showingWaypoints) return World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((mob) => { let name = mob.getName() if (!this.Mobs?.map(a => a.getUUID().toString()).includes(mob.getUUID().toString())) { @@ -254,15 +254,8 @@ class Events extends Feature { } }) - let mythMobs = [] this.todoE.forEach(e => { e = new Entity(e) - try { - let health = e.getName().removeFormatting().split(" ")[4]?.split("/")[0] - if (this.MythMobsHP.getValue() && health != 0 && (e.getName().removeFormatting().includes("Exalted") || e.getName().removeFormatting().includes("Stalwart"))) { - mythMobs.push(e.getName()) - } - } catch (e) { }//not mytho mob if (e.getName().toLowerCase().includes("inquis") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) { let loc = [e.getX(), e.getY() - 1, e.getZ()] @@ -281,9 +274,6 @@ class Events extends Feature { } }) this.todoE = [] - if (mythMobs.length >= 1) { - this.mythMobsElement.setText(mythMobs.join("\n")) - } if (Player.getContainer().getName() === "Fast Travel") { this.openedWarpsMenu = true -- cgit