From c0474e6f8c15bae1a862adfaae328ea223d20041 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 11 Sep 2022 17:33:44 +0800 Subject: nether miniboss hp hud + hp hud for ashfang barb duke mage outlaw and bladesoul --- features/nether/index.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'features') diff --git a/features/nether/index.js b/features/nether/index.js index ec2ef08..d8e4db7 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -5,6 +5,8 @@ import Feature from "../../featureClass/class"; import socketConnection from "../../socketConnection"; import { drawBoxAtBlock, drawBoxAtBlockNotVisThruWalls, drawBoxAtEntity, drawCoolWaypoint, drawLine, drawLineWithDepth, renderBeaconBeam } from "../../utils/renderUtils"; import ToggleSetting from "../settings/settingThings/toggle"; +import HudTextElement from "../hud/HudTextElement"; +import LocationSetting from "../settings/settingThings/location"; const MCBlock = Java.type("net.minecraft.block.Block"); const ArmorStand = Java.type("net.minecraft.entity.item.EntityArmorStand") const MCItem = Java.type("net.minecraft.item.Item"); @@ -58,12 +60,23 @@ class Nether extends Feature { this.hostageWaypoints = new ToggleSetting("Show hostage waypoints", "Waypoint for location of hostage in rescue missions", true, "hostage_waypoint", this) this.slugfishTimer = new ToggleSetting("Show timer over rod", "This may help with fishing slugfish", false, "slugfish_timer", this) + this.minibossNametag = new ToggleSetting("Nether Miniboss Nametag Hud", "renders the HP of minibosses on screen (exclude Magma Boss)", false, "nether_mini_nametag_hud", this); + this.minibossNametagElement = new HudTextElement() + .setText("") + .setToggleSetting(this.minibossNametag) + .setLocationSetting(new LocationSetting("Nether Miniboss Nametag Hud location", "allows you to change the location of the hud", "nether_mini_nametag_hud_location", this, [10, 100, 1, 1]).requires(this.minibossNametag).editTempText("&5&lMage Outlaw &r&a70M&c❤")); + this.hudElements.push(this.minibossNametagElement); + + this.registerStep(true, 5, this.minibossHPHud) + this.todoE = [] this.todoE2 = [] this.blocks = [] this.todoF = [] this.todoF2 = [] + this.todoM = [] + this.todoM2 = [] this.disciplineZombies = { "Wood": [], "Iron": [], @@ -97,6 +110,7 @@ class Nether extends Feature { this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInNether()) this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDojo()); + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEventNether) this.registerEvent("tick", this.tick).registeredWhen(() => this.isInNether()) this.registerChat("&r&r&r &r&aTest of Swiftness &r&e&lOBJECTIVES&r", () => { if (this.speedNextBlock.getValue()) { @@ -201,6 +215,18 @@ class Nether extends Feature { this.controlLocLast = undefined this.controlLoc = undefined } + + this.todoM2.forEach(e => { + let name = e.getName() + if (name) { + if (name.includes("Ashfang") || name.includes("Barbarian Duke X") || name.includes("Bladesoul") || name.includes("Mage Outlaw")) { + this.miniboss = e + } + } + }) + + this.todoM2 = this.todoM + this.todoM = [] } entityJoinWorldEvent(event) { @@ -210,6 +236,12 @@ class Nether extends Feature { if (event.entity instanceof EntitySkeleton && !this.controlSkeleton) this.controlSkeleton = new Entity(event.entity) } + entityJoinWorldEventNether(event) { + if (this.minibossNametag.getValue() && event.entity instanceof ArmorStand) { + this.todoM.push(new Entity(event.entity)) + } + } + packetReceived(packet, event) { if (!this.masteryTimer.getValue()) return let packetType = new String(packet.class.getSimpleName()).valueOf() @@ -324,10 +356,40 @@ class Nether extends Feature { return MCBlock[m.getStateId](state) } + minibossHPHud() { + if (this.miniboss && this.miniboss.getEntity()[f.isDead]) this.miniboss = undefined + if (!this.minibossNametag.getValue() || !this.miniboss) { + this.minibossNametagElement.setText("") + return + } + let name = this.miniboss.getName() + let nameRemoveFormat = name.removeFormatting() + let mobName = "" + if (nameRemoveFormat.includes("Ashfang")) mobName = "&dAshfang" + if (nameRemoveFormat.includes("Bladesoul")) mobName = "&dBladesoul" + if (nameRemoveFormat.includes("Barbarian Duke X")) mobName = "&dBarbarian Duke X" + if (nameRemoveFormat.includes("Mage Outlaw")) mobName = "&dMage Outlaw" + if (!mobName) { + this.minibossNametagElement.setText("") + return + } + let indexOfHP = { + "&dAshfang": 3, + "&dBladesoul": 3, + "&dBarbarian Duke X": 5, + "&dMage Outlaw": 4 + } + let HP = `&l${mobName} &r${name.split(" ")[indexOfHP[mobName]].split("/")[0]}&c❤` + this.minibossNametagElement.setText(HP) + } + initVariables() { + this.hudElements = []; + this.miniboss = undefined } onDisable() { + this.hudElements.forEach(h => h.delete()) this.initVariables(); } } @@ -344,4 +406,4 @@ function getField(e, field) { field2.setAccessible(true) return field2.get(e) -} \ No newline at end of file +} -- cgit From 0cb014b4931376fe3d7e803942d1b8f53f6fbe85 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sun, 11 Sep 2022 18:20:15 +0800 Subject: Make closest warp calculations use the updated guess location --- features/events/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/events/index.js b/features/events/index.js index 312a999..d208c4d 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -346,7 +346,7 @@ class Events extends Feature { this.hasWarps.forEach(w => { if (!warpData[w]) return - let d = calculateDistance(warpData[w], this.guessPoint) + let d = calculateDistance(warpData[w], this.guessPoint2) if (d < minDist) { warp = "warp " + w minDist = d -- cgit From a6f82817793c6ac904173fbb7077c2542ae5679b Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 11 Sep 2022 18:36:31 +0800 Subject: changes --- features/nether/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'features') diff --git a/features/nether/index.js b/features/nether/index.js index d8e4db7..fa6a712 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -109,8 +109,7 @@ class Nether extends Feature { this.registerStep(true, 1, this.step1S).registeredWhen(() => this.isInNether()) this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInNether()) - this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDojo()); - this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEventNether) + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDojo() || (this.isInNether() && this.minibossNametag.getValue())); this.registerEvent("tick", this.tick).registeredWhen(() => this.isInNether()) this.registerChat("&r&r&r &r&aTest of Swiftness &r&e&lOBJECTIVES&r", () => { if (this.speedNextBlock.getValue()) { @@ -217,7 +216,7 @@ class Nether extends Feature { } this.todoM2.forEach(e => { - let name = e.getName() + let name = e[m.getCustomNameTag]() if (name) { if (name.includes("Ashfang") || name.includes("Barbarian Duke X") || name.includes("Bladesoul") || name.includes("Mage Outlaw")) { this.miniboss = e @@ -234,11 +233,8 @@ class Nether extends Feature { if (this.disciplineOverlay.getValue() && this.inDiscipline && event.entity instanceof ArmorStand) this.todoF.push(new Entity(event.entity)) if (event.entity instanceof EntitySkeleton && !this.controlSkeleton) this.controlSkeleton = new Entity(event.entity) - } - - entityJoinWorldEventNether(event) { if (this.minibossNametag.getValue() && event.entity instanceof ArmorStand) { - this.todoM.push(new Entity(event.entity)) + this.todoM.push(event.entity) } } -- cgit From b6f16165d53d8a542fe76fa1cfc96dd9521fd218 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 11 Sep 2022 18:41:26 +0800 Subject: oopsie --- features/nether/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/nether/index.js b/features/nether/index.js index fa6a712..49388bd 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -219,7 +219,7 @@ class Nether extends Feature { let name = e[m.getCustomNameTag]() if (name) { if (name.includes("Ashfang") || name.includes("Barbarian Duke X") || name.includes("Bladesoul") || name.includes("Mage Outlaw")) { - this.miniboss = e + this.miniboss = new Entity(e) } } }) -- cgit From 0679a5c7f51923b77b95f2e34b1d0107462db8db Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sun, 11 Sep 2022 20:30:36 +0800 Subject: oops! "message": "\"assignActualEmanBoss\" is not defined.", --- features/slayers/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'features') diff --git a/features/slayers/index.js b/features/slayers/index.js index 590c5b6..2d8e1fa 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -531,7 +531,7 @@ class Slayers extends Feature { this.cannotFindEmanBoss = false } else if (nameRemoveFormat.includes("Voidgloom Seraph") && ((name.getX() - Player.getX()) ** 2 + (name.getY() - Player.getY()) ** 2 + (name.getZ() - Player.getZ()) ** 2 < 25)) { this.emanBoss = name - assignActualEmanBoss(this.emanBoss) + this.assignActualEmanBoss(this.emanBoss) this.cannotFindEmanBoss = false } } @@ -622,12 +622,12 @@ class Slayers extends Feature { if (e[m.getCustomNameTag]() && e[m.getCustomNameTag]().includes("Voidgloom Seraph")) { if (Date.now() - this.nextIsBoss < 3000) { this.emanBoss = new Entity(e); - assignActualEmanBoss(this.emanBoss) + this.assignActualEmanBoss(this.emanBoss) this.nextIsBoss = false; } if (this.cannotFindEmanBoss && ((e[f.posX.Entity] - Player.getX()) ** 2 + (e[f.posY.Entity] - Player.getY()) ** 2 + (e[f.posZ.Entity] - Player.getZ()) ** 2 < 5)) { this.emanBoss = new Entity(e); - assignActualEmanBoss(this.emanBoss) + this.assignActualEmanBoss(this.emanBoss) this.cannotFindEmanBoss = false } -- cgit