From b264c12b21d8dd2df3716043f6e12a5209ae5923 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:10:47 +0800 Subject: + dojo disipline overlay thing --- features/dungeonSolvers/index.js | 116 ++++++++++++++++++++------------------- features/nether/index.js | 53 +++++++++++++++++- utils/renderUtils.js | 2 +- 3 files changed, 113 insertions(+), 58 deletions(-) diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 14f8b88..6fba0ab 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -8,6 +8,7 @@ import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; import { fetch } from "../../utils/networkUtils"; +import { Waypoint } from "../../utils/renderJavaUtils"; const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze"); let translate; @@ -252,64 +253,69 @@ class DungeonSolvers extends Feature { //TODO: finish this - let saidLocations = new Set() - let data = [] - let area = 0 - this.registerChat("", () => { - area++ - }) - this.registerStep(false, 3, () => { - World.getAllEntities().forEach(e => { - if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive device")) { - addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "device") - } - if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive terminal")) { - addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "terminal") - } - if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("not activated")) { - addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "lever") - } - }) - }) + // let saidLocations = new Set() + // let waypoints = [] + // let data = [] + // let area = 0 + // this.registerChat("", () => { + // area++ + // }) + // this.registerStep(false, 3, () => { + // World.getAllEntities().forEach(e => { + // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive device")) { + // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "device") + // } + // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive terminal")) { + // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "terminal") + // } + // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("not activated")) { + // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "lever") + // } + // }) + // waypoints.forEach(w => w.update()) + // }) - function addThing(location, type) { - if (saidLocations.has(location.join(","))) return + // function addThing(location, type) { + // if (saidLocations.has(location.join(","))) return - saidLocations.add(location.join(",")) + // saidLocations.add(location.join(",")) - if (type === "lever") { - let finalLoc = undefined - for (let i = 5; i > -5; i--) { - if (World.getBlockAt(location[0], location[1] + i, location[2])?.getType()?.getID() === 69) { - finalLoc = [location[0], location[1] + i, location[2]] - } - } - ChatLib.chat("Loaded " + type) - data.push({ type: "lever", location: finalLoc, phase: area }) - return - } - if (type === "terminal") { - let finalLoc = undefined - for (let x = 5; x > -5; x--) { - for (let y = 5; y > -5; y--) { - for (let z = 5; z > -5; z--) { - if (World.getBlockAt(location[0] + x, location[1] + y, location[2] + x)?.getType()?.getID() === 137) { - finalLoc = [location[0] + x, location[1] + y, location[2] + x] - } - } - } - } - ChatLib.chat("Loaded " + type) - data.push({ type: "terminal", location: finalLoc, phase: area }) - return - } - ChatLib.chat("Loaded " + type) - data.push({ type: type, location: location, phase: area }) - } + // if (type === "lever") { + // let finalLoc = undefined + // for (let i = 5; i > -5; i--) { + // if (World.getBlockAt(location[0], location[1] + i, location[2])?.getType()?.getID() === 69) { + // finalLoc = [location[0], location[1] + i, location[2]] + // } + // } + // ChatLib.chat("Loaded " + type) + // data.push({ type: "lever", location: finalLoc, phase: area }) + // waypoints.push(new Waypoint(finalLoc[0], finalLoc[1], finalLoc[2], 1, 0, 0, { name: type + " | " + area })) + // return + // } + // if (type === "terminal") { + // let finalLoc = undefined + // for (let x = 5; x > -5; x--) { + // for (let y = 5; y > -5; y--) { + // for (let z = 5; z > -5; z--) { + // if (World.getBlockAt(location[0] + x, location[1] + y, location[2] + x)?.getType()?.getID() === 137) { + // finalLoc = [location[0] + x, location[1] + y, location[2] + x] + // } + // } + // } + // } + // ChatLib.chat("Loaded " + type) + // data.push({ type: "terminal", location: finalLoc, phase: area }) + // waypoints.push(new Waypoint(finalLoc[0], finalLoc[1], finalLoc[2], 1, 0, 0, { name: type + " | " + area })) + // return + // } + // ChatLib.chat("Loaded " + type) + // waypoints.push(new Waypoint(finalLoc[0], finalLoc[1], finalLoc[2], 1, 0, 0, { name: type + " | " + area })) + // data.push({ type: type, location: location, phase: area }) + // } - this.registerCommand("getdata", () => { - ChatLib.chat(JSON.stringify(data)) - }) + // this.registerCommand("getdata", () => { + // ChatLib.chat(JSON.stringify(data)) + // }) //§r§6Soopyboo32§r§a activated a lever! (§r§c8§r§a/8)§r //§r§6Soopyboo32§r§a completed a device! (§r§c3§r§a/8)§r @@ -849,7 +855,7 @@ class DungeonSolvers extends Feature { } this.spiritBowPickUps = this.spiritBowPickUps.filter((pickUp) => Date.now() - pickUp < 20000); - if (this.spiritBowPickUps[0]) { + if (this.spiritBowPickUps[0] && this.isInDungeon()) { this.spiritBowDestroyElement.setText("&dBow Destroyed in: &c" + Math.round((this.spiritBowPickUps[0] + 20000 - Date.now()) / 1000) + "s"); } else { this.spiritBowDestroyElement.setText(""); diff --git a/features/nether/index.js b/features/nether/index.js index 52d1041..e9a46eb 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -24,6 +24,13 @@ let locationData = { } } +let disciplineColors = { + "Wood": [196, 100, 0], + "Iron": [194, 194, 194], + "Gold": [235, 182, 0], + "Diamond": [0, 198, 229] +} + class Nether extends Feature { constructor() { super(); @@ -45,6 +52,7 @@ class Nether extends Feature { this.masteryTimer = new ToggleSetting("Mastery Timer", "Countdown untill a block will turn red", true, "nether_mastery_timer", this) this.speedNextBlock = new ToggleSetting("Show next block to stand on for dojo swiftness", "", true, "dojo_swiftness", this) this.tenacityLine = new ToggleSetting("Show line for fireball in dojo tenacity", "This may help you to dodge the fireballs", false, "dojo_tanacity", this) + this.disciplineOverlay = new ToggleSetting("Show overlay for zombies in dojo discipline", "", true, "dojo_discipline", this).contributor("Empa") this.hostageWaypoints = new ToggleSetting("Show hostage waypoints", "Waypoint for location of hostage in rescue missions", true, "hostage_waypoint", this) this.vaniquisherWaypoints = new ToggleSetting("Show vaniqusher waypoints", "Shows the locations of other player's vanquishers", true, "vanquisher_waypoint", this) this.slugfishTimer = new ToggleSetting("Show timer over rod", "This may help with fishing slugfish", false, "slugfish_timer", this) @@ -58,6 +66,17 @@ class Nether extends Feature { this.todoE = [] this.todoE2 = [] this.blocks = [] + + this.todoF = [] + this.todoF2 = [] + this.disciplineZombies = { + "Wood": [], + "Iron": [], + "Gold": [], + "Diamond": [] + } + this.inDiscipline = false + this.dojoFireBalls = [] this.inSwiftness = false this.rescueMissionDifficulty = undefined @@ -72,9 +91,19 @@ class Nether extends Feature { this.lastBlock = [Math.floor(Player.getX()), Math.floor(Player.getY()) - 1, Math.floor(Player.getZ())] } }) + + this.registerChat("&r&r&r &r&cTest of Discipline &r&e&lOBJECTIVES&r", () => { + if (this.disciplineOverlay.getValue()) { + this.inDiscipline = true + this.todoE = [] + this.todoE2 = [] + } + }) + this.registerChat("&r&r&r ${*}&r&6Your Rank: &r${*}&r", () => { this.inSwiftness = false this.lastBlock = undefined + this.inDiscipline = false }) this.registerChat("You completed your rescue quest! Visit the Town Board to claim the rewards,", () => { @@ -114,6 +143,16 @@ class Nether extends Feature { } + this.todoF2.forEach(e => { + let name = ChatLib.removeFormatting(e.getName()) + if (!name) return + if (!disciplineColors[name]) return + + this.disciplineZombies[name].push(e) + }) + + this.todoF2 = this.todoF + this.todoF = [] this.todoE2.forEach(e => { let item = e[m.getHeldItem]() @@ -129,6 +168,7 @@ class Nether extends Feature { entityJoinWorldEvent(event) { if (this.tenacityLine.getValue() && event.entity instanceof ArmorStand) this.todoE.push(event.entity) + if (this.disciplineOverlay.getValue() && this.inDiscipline && event.entity instanceof ArmorStand) this.todoF.push(new Entity(event.entity)) } packetReceived(packet, event) { @@ -188,8 +228,8 @@ class Nether extends Feature { } } - renderWorld(event) { - if (this.masteryTimer.getValue()) { + renderWorld(ticks) { + if (this.masteryTimer.getValue() && this.blocks) { this.blocks.forEach((data, i) => { Tessellator.drawString((i === 0 ? "§1" : "§0") + Math.max(0, (data.time - Date.now()) / 1000).toFixed(1) + "s", data.loc.getX() + 0.5, data.loc.getY() + 0.5, data.loc.getZ() + 0.5, 0, false, 0.05, false) }) @@ -206,6 +246,12 @@ class Nether extends Feature { drawLineWithDepth(entitylocation[0] + change[0] * 100 + offset[0], entitylocation[1] + change[1] * 100 + offset[1], entitylocation[2] + change[2] * 100 + offset[2], entitylocation[0] + offset[0], entitylocation[1] + offset[1], entitylocation[2] + offset[2], 255, 0, 0, 2) }) + if (this.disciplineOverlay.getValue() && Player.getHeldItem() && this.disciplineZombies[ChatLib.removeFormatting(Player.getHeldItem().getName().split(" ")[0].replace("en", ""))]) this.disciplineZombies[ChatLib.removeFormatting(Player.getHeldItem().getName().split(" ")[0].replace("en", ""))].forEach(e => { + let color = disciplineColors[ChatLib.removeFormatting(e.getName())] + + drawBoxAtEntity(e, color[0] / 255, color[1] / 255, color[2] / 255, 0.7, -2, ticks, 4, false); + }) + if (this.rescueMissionDifficulty && this.rescueMissionType && this.hostageWaypoints.getValue()) { let location = locationData[this.rescueMissionType][this.rescueMissionDifficulty] drawCoolWaypoint(location[0], location[1], location[2], 255, 0, 0, { name: "Hostage" }) @@ -231,6 +277,9 @@ class Nether extends Feature { step1S() { if (this.blocks) this.blocks = this.blocks.filter(state => Date.now() < state.time) + if (this.disciplineZombies) Object.keys(this.disciplineZombies).forEach(k => { + this.disciplineZombies[k] = this.disciplineZombies[k].filter(e => !e.getEntity()[f.isDead]) + }) if (this.dojoFireBalls) this.dojoFireBalls = this.dojoFireBalls.filter(e => !e[f.isDead]) if (this.spawnedVanqs) this.spawnedVanqs = this.spawnedVanqs.filter(a => Date.now() - a[2] < 60000) } diff --git a/utils/renderUtils.js b/utils/renderUtils.js index 051d0c6..00b1c41 100644 --- a/utils/renderUtils.js +++ b/utils/renderUtils.js @@ -233,7 +233,7 @@ let ret = { GlStateManager.func_179094_E(); - Tessellator.begin(2).colorize(colorR, colorG, colorB); + Tessellator.begin(2).colorize(colorR, colorG, colorB, 1); Tessellator.pos(x + width, y + height, z + width); Tessellator.pos(x + width, y + height, z - width); -- cgit