aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-06 21:40:49 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-06 21:40:49 +0800
commitf0cfad5af93244618d5a60c88b1c0a4837e629ae (patch)
tree062a301f34c8e6d3284fa845676b23b2ab8d7f9a /features
parente2e2d676ee056e9f44f6c67e29f0952b9ef956b2 (diff)
downloadSoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.gz
SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.bz2
SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.zip
+ Many performance improvements
+ Fix rescue mission waypoints
Diffstat (limited to 'features')
-rw-r--r--features/dungeonMap/index.js13
-rw-r--r--features/dungeonSolvers/index.js34
-rw-r--r--features/events/index.js14
-rw-r--r--features/fragBot/index.js38
-rw-r--r--features/hud/HudTextElement.js47
-rw-r--r--features/hud/index.js3
-rw-r--r--features/lockedFeatures/index.js78
-rw-r--r--features/mining/index.js144
-rw-r--r--features/nether/index.js34
-rw-r--r--features/nether/metadata.json4
-rw-r--r--features/slayers/index.js9
-rw-r--r--features/spamHider/index.js204
12 files changed, 316 insertions, 306 deletions
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js
index cfa4fd9..fcb964b 100644
--- a/features/dungeonMap/index.js
+++ b/features/dungeonMap/index.js
@@ -25,6 +25,7 @@ class DungeonMap extends Feature {
}
isInDungeon() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
return this.FeatureManager.features["dataLoader"].class.isInDungeon
}
@@ -112,13 +113,13 @@ class DungeonMap extends Feature {
this.spiritLeapOverlayGui = new SpiritLeapOverlay(this)
// this.registerEvent("tick", this.tick)
- this.registerStep(true, 3, this.step)
+ this.registerStep(true, 3, this.step).registeredWhen(() => this.isInDungeon())
this.registerStep(true, 10, () => {
this.spiritLeapOverlayGui.tick()
- })
- this.registerStep(false, 5, this.step5s)
- this.registerEvent("renderOverlay", this.renderOverlay)
- this.registerEvent("renderWorld", this.renderWorld)
+ }).registeredWhen(() => this.isInDungeon())
+ this.registerStep(false, 5, this.step5s).registeredWhen(() => this.isInDungeon())
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.isInDungeon())
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon())
this.registerEvent("worldLoad", this.worldLoad)
this.registerEvent("guiOpened", (event) => {
@@ -150,7 +151,7 @@ class DungeonMap extends Feature {
new Thread(() => {
this.updateMapImage()
}).start()
- })
+ }).registeredWhen(() => this.isInDungeon())
this.registerChat("&r&r&r &r&cThe Catacombs &r&8- &r&eFloor ${*} Stats&r", () => {
this.puzzles = {}
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 218642b..f9e0026 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -4,7 +4,6 @@ import { f, m } from "../../../mappings/mappings";
import Feature from "../../featureClass/class";
import { numberWithCommas } from "../../utils/numberUtils";
import * as renderUtils from "../../utils/renderUtils";
-import { drawBoxAtBlock } from "../../utils/renderUtils";
import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import ToggleSetting from "../settings/settingThings/toggle";
@@ -23,6 +22,11 @@ class DungeonSolvers extends Feature {
super();
}
+ isInDungeon() {
+ if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false
+ return this.FeatureManager.features["dataLoader"].class.isInDungeon
+ }
+
onEnable() {
this.initVariables();
@@ -163,12 +167,12 @@ class DungeonSolvers extends Feature {
7: 360,
};
- this.registerStep(true, 2, this.step);
- this.registerStep(true, 10, this.step2);
+ this.registerStep(true, 2, this.step).registeredWhen(() => this.isInDungeon());
+ this.registerStep(true, 10, this.step2).registeredWhen(() => this.isInDungeon());
this.registerEvent("worldLoad", this.onWorldLoad);
- this.registerEvent("renderOverlay", this.renderHud);
- this.registerEvent("renderWorld", this.renderWorld);
+ this.registerEvent("renderOverlay", this.renderHud).registeredWhen(() => this.isInDungeon());
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.isInDungeon());
this.bloodOpenedBonus = false;
this.goneInBonus = false;
@@ -196,7 +200,7 @@ class DungeonSolvers extends Feature {
}
}
}
- })
+ }).registeredWhen(() => this.isInDungeon())
let mimicDeadMessages = ["$SKYTILS-DUNGEON-SCORE-MIMIC$", "Mimic Killed!", "Mimic Dead!", "Mimic dead!"]
this.registerChat("&r&9Party &8> ${msg}", (msg) => {
mimicDeadMessages.forEach(dmsg => {
@@ -238,7 +242,7 @@ class DungeonSolvers extends Feature {
}
});
- this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent);
+ this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDungeon());
// this.registerEvent("renderEntity", this.renderEntity)
this.renderEntityEvent = undefined;
@@ -403,7 +407,7 @@ class DungeonSolvers extends Feature {
}
if (this.bloodCampAssist.getValue()) {
- this.skulls.forEach((skull) => {
+ for (let skull of this.skulls) {
let skullE = skull.getEntity();
// renderUtils.drawBoxAtEntity(skull, 255, 0, 0, 0.5, 0.5, ticks)
@@ -435,19 +439,23 @@ class DungeonSolvers extends Feature {
// Tessellator.drawString((time/1000).toFixed(3)+"s", endPoint[0], endPoint[1]+2, endPoint[2])
// }
}
- });
+ }
}
if (this.blazeX !== -1 && this.blazes.length > 0 && this.blazeSolver.getValue()) {
renderUtils.drawBoxAtEntity(this.blazes[0], 255, 0, 0, 1, 2, ticks, 2);
let lastLoc = [this.blazes[0].getX(), this.blazes[0].getY() + 1.5, this.blazes[0].getZ()];
- this.blazes.forEach((blaze, i) => {
+ // this.blazes.forEach((blaze, i) => {
+ for (let i = 0, blaze = this.blazes[0]; i < this.blazes.length; i++, blaze = this.blazes[i]) {
if (i < 3 && i !== 0) {
renderUtils.drawLineWithDepth(lastLoc[0], lastLoc[1], lastLoc[2], blaze.getX(), blaze.getY() + 1.5, blaze.getZ(), i === 1 ? 0 : 255, i === 1 ? 255 : 0, 0, 3 / i);
- lastLoc = [blaze.getX(), blaze.getY() + 1.5, blaze.getZ()];
+
+ lastLoc[0] = blaze.getX();
+ lastLoc[1] = blaze.getY() + 1.5;
+ lastLoc[2] = blaze.getZ();
}
- });
+ }
}
}
@@ -760,7 +768,7 @@ class DungeonSolvers extends Feature {
}
} else {
if (this.renderEntityEvent) {
- this.unregisterEvent(this.renderEntityEvent);
+ this.renderEntityEvent.unregister()
this.renderEntityEvent = undefined;
}
}
diff --git a/features/events/index.js b/features/events/index.js
index 8ab5f86..51081fd 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -25,7 +25,6 @@ class Events extends Feature {
this.showingWaypoints = false
this.lastPath = []
this.updatingPath = false
- this.hudElements = []
this.lastPathCords = undefined
@@ -48,24 +47,17 @@ class Events extends Feature {
this.shinyBlockOverlayEnabled = new ToggleSetting("Shiny blocks highlight", "Will highlight shiny blocks in the end", false, "shiny_blocks_overlay", this)
this.registerEvent("worldLoad", this.worldLoad)
- this.registerEvent("spawnParticle", this.spawnParticle)
- this.registerEvent("renderWorld", this.renderWorld)
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("spawnParticle", this.spawnParticle).registeredWhen(() => this.showingWaypoints)
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
this.registerStep(true, 2, this.step)
this.registerStep(false, 5, this.step_5s)
- this.registerEvent("soundPlay", this.playSound)
+ this.registerEvent("soundPlay", this.playSound).registeredWhen(() => this.showingWaypoints)
this.registerChat("&r&eYou dug out a Griffin Burrow! &r&7(${*}/4)&r", this.burrialClicked)
this.registerChat("&r&eYou finished the Griffin burrow chain! &r&7(4/4)&r", this.burrialClicked)
}
- renderOverlay() {
- for (let element of this.hudElements) {
- element.render()
- }
- }
-
renderWorld(ticks) {
this.shinyBlocks.forEach(([loc]) => {
drawBoxAtBlockNotVisThruWalls(loc[0], loc[1], loc[2], 0, 255, 0, 0.1, 0.1)
diff --git a/features/fragBot/index.js b/features/fragBot/index.js
index 5662111..c6a2fd9 100644
--- a/features/fragBot/index.js
+++ b/features/fragBot/index.js
@@ -9,7 +9,7 @@ class FragBot extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.hostingFragBot = false
@@ -23,58 +23,58 @@ class FragBot extends Feature {
this.registerCommand("fragbot", this.fragbotCommand)
- this.registerStep(false, 5, this.step)
- this.registerStep(true, 2, this.step2)
+ this.registerStep(false, 5, this.step).registeredWhen(() => this.hostingFragBot)
+ this.registerStep(true, 2, this.step2).registeredWhen(() => this.hostingFragBot)
this.registerChat("&9&m---------------------------${*}&r&9\n&r${player} &r&ehas invited you to join their party!\n&r&eYou have &r&c60 &r&eseconds to accept. &r&6Click here to join!&r&9\n&r&9&m----------------------------${*}&r", this.recievedPartyInvite)
}
-
- step(){
- if(!this.hostingFragBot) return
- if(this.fragBotQueue.length > 0){
+ step() {
+ if (!this.hostingFragBot) return
+
+ if (this.fragBotQueue.length > 0) {
let player = this.fragBotQueue.shift()
- if(player){
+ if (player) {
this.commandQueue.push("/party leave")
this.commandQueue.push("/party accept " + player)
}
}
}
- step2(){
- if(!this.hostingFragBot) return
+ step2() {
+ if (!this.hostingFragBot) return
- if(this.commandQueue.length > 0){
+ if (this.commandQueue.length > 0) {
let command = this.commandQueue.shift()
- if(command){
+ if (command) {
ChatLib.say(command)
}
}
}
- recievedPartyInvite(player){
- if(!this.hostingFragBot) return
+ recievedPartyInvite(player) {
+ if (!this.hostingFragBot) return
player = ChatLib.removeFormatting(player).split(" ").pop()
this.fragBotQueue.push(player)
}
- fragbotCommand(...args){
- if(this.hostingFragBot){
+ fragbotCommand(...args) {
+ if (this.hostingFragBot) {
this.hostingFragBot = false
ChatLib.chat(this.FeatureManager.messagePrefix + "Fragbot has been disabled")
- }else{
+ } else {
this.hostingFragBot = true
ChatLib.chat(this.FeatureManager.messagePrefix + "Now acting as a fragbot, run /fragbot again to disable")
}
}
- initVariables(){
+ initVariables() {
this.hostingFragBot = undefined
this.fragBotQueue = undefined
this.commandQueue = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 8646e45..3d09319 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -31,6 +31,7 @@ class HudTextElement {
}
setText(text = "") {
+ if (text === this.text) return this
this.text = text
if (this.locationSetting && this.locationSetting.shadowType === 2) {
@@ -111,30 +112,28 @@ class HudTextElement {
}
renderRaw() {
- try {
- let text = this.getText()
-
- text.forEach((line, i) => {
- Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
- switch (this.locationSetting.shadowType) {
- case 0:
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 1:
- Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 2:
- let blackText = this.getBlackText()
- Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
-
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- }
- })
- } catch (e) { }//incase of wrong opengl context
+ let text = this.getText()
+
+ text.forEach((line, i) => {
+ Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
+ switch (this.locationSetting.shadowType) {
+ case 0:
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 1:
+ Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 2:
+ let blackText = this.getBlackText()
+ Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
+
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ }
+ })
}
}
diff --git a/features/hud/index.js b/features/hud/index.js
index f3761d7..44ee38a 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -225,7 +225,7 @@ class Hud extends Feature {
this.registerEvent("renderOverlay", this.renderHud)
this.registerStep(true, 5, this.step)
this.registerStep(false, 5, this.step_5second)
- this.registerEvent("renderWorld", this.renderWorld)
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue())
this.registerEvent("worldLoad", this.worldLoad)
this.petLevels = {}
@@ -378,7 +378,6 @@ class Hud extends Feature {
}
renderWorld() {
- if (!this.fpsEnabledSetting.getValue() || !this.fpsFastSetting.getValue()) return
this.framesSince++
let instant = this.Instant.now()
diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js
index 1332cd1..44a4139 100644
--- a/features/lockedFeatures/index.js
+++ b/features/lockedFeatures/index.js
@@ -13,12 +13,12 @@ class LockedFeatures extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.guildEventLbPossible = new FakeRequireToggle(false)
this.guildEventLb = new ToggleSetting("Guild event leaderboard", "A gui element for guild leaderboard progress", true, "guild_event_lb", this).requires(this.guildEventLbPossible)
-
+
this.hudElements = []
this.guildLbElement = new HudTextElement()
.setToggleSetting(this.guildEventLb)
@@ -29,59 +29,59 @@ class LockedFeatures extends Feature {
this.eventCommand = undefined
this.registerStep(true, 1, this.step)
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.guildEventLb.getValue())
}
- step(){
- if(!SoopyV2Server.lbdatathing){
+ step() {
+ if (!SoopyV2Server.lbdatathing) {
this.guildEventLbPossible.set(false)
- if(this.eventCommand){
- this.unregisterCommand("eventlb")
+ if (this.eventCommand) {
+ this.eventCommand.unregister()
this.eventCommand = undefined
}
return;
}
-
+
this.guildEventLbPossible.set(true)
- if(!this.eventCommand){
- this.eventCommand = this.registerCommand("eventlb", ()=>{
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
+ if (!this.eventCommand) {
+ this.eventCommand = this.registerCommand("eventlb", () => {
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
let text = ""
- text += "§6#" + (i+1)
+ text += "§6#" + (i + 1)
text += "§7 - "
- text += "§e"+u.username
- text += "&7: §r"+numberWithCommas(Math.round(parseFloat(u.startingAmount)))
- if(u.progress) text += " §7("+ (u.progress>0?"+":"-")+Math.abs(Math.round(u.progress)) + "/h)"
+ text += "§e" + u.username
+ text += "&7: §r" + numberWithCommas(Math.round(parseFloat(u.startingAmount)))
+ if (u.progress) text += " §7(" + (u.progress > 0 ? "+" : "-") + Math.abs(Math.round(u.progress)) + "/h)"
ChatLib.chat(text)
})
})
}
- if(!this.guildEventLb.getValue()) return
+ if (!this.guildEventLb.getValue()) return
let text = ""
let playerPos = 0
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
- if(u.uuid === Player.getUUID().toString().replace(/-/g, "")) playerPos = i
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
+ if (u.uuid === Player.getUUID().toString().replace(/-/g, "")) playerPos = i
})
let prevProgress
let playerProgress
let nextProgress
- SoopyV2Server.lbdatathing.forEach((u, i)=>{
- if(i === playerPos-1) nextProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos) playerProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos+1) prevProgress = [parseFloat(u.startingAmount), u.progress]
- if(i === playerPos-1 || i === playerPos || i === playerPos+1 || (playerPos === 0 && i===playerPos+2)){
- text += "§6#" + (i+1)
+ SoopyV2Server.lbdatathing.forEach((u, i) => {
+ if (i === playerPos - 1) nextProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos) playerProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos + 1) prevProgress = [parseFloat(u.startingAmount), u.progress]
+ if (i === playerPos - 1 || i === playerPos || i === playerPos + 1 || (playerPos === 0 && i === playerPos + 2)) {
+ text += "§6#" + (i + 1)
text += "§7 - "
- text += "§e"+u.username
- text += "&7: §r"+numberWithCommas(Math.round(parseFloat(u.startingAmount)))
- if(u.progress) text += " §7("+ (u.progress>0?"+":"-")+Math.abs(Math.round(u.progress)) + "/h)"
+ text += "§e" + u.username
+ text += "&7: §r" + numberWithCommas(Math.round(parseFloat(u.startingAmount)))
+ if (u.progress) text += " §7(" + (u.progress > 0 ? "+" : "-") + Math.abs(Math.round(u.progress)) + "/h)"
text += "\n"
}
})
@@ -90,32 +90,32 @@ class LockedFeatures extends Feature {
let timeTillIncrease = Infinity
let timeTillDecrease = Infinity
- if(nextProgress && nextProgress[1]-playerProgress[1] < 0){
- timeTillIncrease = ((nextProgress[0]-playerProgress[0])/(playerProgress[1]-nextProgress[1])*60*60*1000)
+ if (nextProgress && nextProgress[1] - playerProgress[1] < 0) {
+ timeTillIncrease = ((nextProgress[0] - playerProgress[0]) / (playerProgress[1] - nextProgress[1]) * 60 * 60 * 1000)
}
- if(prevProgress && prevProgress[1]-playerProgress[1] < 0){
- timeTillDecrease = ((playerProgress[0]-prevProgress[0])/(prevProgress[1]-playerProgress[1])*60*60*1000)
+ if (prevProgress && prevProgress[1] - playerProgress[1] < 0) {
+ timeTillDecrease = ((playerProgress[0] - prevProgress[0]) / (prevProgress[1] - playerProgress[1]) * 60 * 60 * 1000)
}
- if((timeTillIncrease < timeTillDecrease || (timeTillIncrease > 0)) && timeTillDecrease < 0 && timeTillIncrease < 10000000000){
- text = "&d ^ in " + timeNumber2(timeTillIncrease) + "\n"+text
+ if ((timeTillIncrease < timeTillDecrease || (timeTillIncrease > 0)) && timeTillDecrease < 0 && timeTillIncrease < 10000000000) {
+ text = "&d ^ in " + timeNumber2(timeTillIncrease) + "\n" + text
}
- if((timeTillIncrease > timeTillDecrease || (timeTillDecrease>0))&&timeTillIncrease<0 && timeTillDecrease < 10000000000){
- text = "&d v in " + timeNumber2(timeTillDecrease) + "\n"+text
+ if ((timeTillIncrease > timeTillDecrease || (timeTillDecrease > 0)) && timeTillIncrease < 0 && timeTillDecrease < 10000000000) {
+ text = "&d v in " + timeNumber2(timeTillDecrease) + "\n" + text
}
this.guildLbElement.setText(text)
}
- renderOverlay(){
- this.hudElements.forEach(a=>a.render())
+ renderOverlay() {
+ this.hudElements.forEach(a => a.render())
}
- initVariables(){
+ initVariables() {
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
diff --git a/features/mining/index.js b/features/mining/index.js
index a2cfccf..a05552d 100644
--- a/features/mining/index.js
+++ b/features/mining/index.js
@@ -14,7 +14,7 @@ class Mining extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.hudElements = []
@@ -35,10 +35,10 @@ class Mining extends Feature {
this.compactProgressHud = new ToggleSetting("Show compact blocks in the current session", "This will add a HUD element with the compact progress", true, "compact_progress_hud", this)
this.compactHudElement = new HudTextElement()
- .setToggleSetting(this.compactProgressHud)
- .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the compact progress", "compact_progress_location", this, [10, 50, 1, 1])
- .requires(this.compactProgressHud)
- .editTempText("&6Compact Session&7> &f12,345"))
+ .setToggleSetting(this.compactProgressHud)
+ .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the compact progress", "compact_progress_location", this, [10, 50, 1, 1])
+ .requires(this.compactProgressHud)
+ .editTempText("&6Compact Session&7> &f12,345"))
this.hudElements.push(this.compactHudElement)
this.compactProgressHudOnlyWhenMoreThan0 = new ToggleSetting("Only show compact progress when it is above 0", "So that you dont need to disable it when you start doing something else", true, "compact_progress_disable_0", this).requires(this.compactProgressHud)
@@ -53,178 +53,178 @@ class Mining extends Feature {
this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class
- this.registerEvent("renderOverlay", this.renderOverlay)
+ this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue())
this.registerEvent("tick", this.tick)
- this.registerEvent("itemTooltip", this.itemTooltipEvent)
- this.registerEvent("renderWorld", this.renderWorld)
+ this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue())
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue())
- this.registerChat("&r&c&o&r&6&lRARE DROP! &r&eA Bal Pet dropped!&r", ()=>{
- if(this.balPetAlert.getValue()){
+ this.registerChat("&r&c&o&r&6&lRARE DROP! &r&eA Bal Pet dropped!&r", () => {
+ if (this.balPetAlert.getValue()) {
World.playSound("random.orb", 1, 1)
Client.showTitle("§r§c§o§r§6§lRARE DROP! §r§eA Bal Pet dropped!§r", "", 20, 50, 20)
}
})
- this.registerChat("&r&c&oThe bosses outer shell looks to be weakening!&r", ()=>{
+ this.registerChat("&r&c&oThe bosses outer shell looks to be weakening!&r", () => {
this.balHP = 200
})
- this.registerChat("&r&c&oHalf way there! The boss is starting to become weaker!&r", ()=>{
+ this.registerChat("&r&c&oHalf way there! The boss is starting to become weaker!&r", () => {
this.balHP = 125
})
- this.registerChat("&r&c&oNearly there! The boss is shaking it can't last much longer!&r", ()=>{
+ this.registerChat("&r&c&oNearly there! The boss is shaking it can't last much longer!&r", () => {
this.balHP = 75
})
- this.registerChat("&r&c&oThe boss looks weak and tired and retreats into the lava...&r", ()=>{
+ this.registerChat("&r&c&oThe boss looks weak and tired and retreats into the lava...&r", () => {
this.balHP = 0
})
}
- itemTooltipEvent(lore, item, event){
+ itemTooltipEvent(lore, item, event) {
this.addLore(item)
}
/**
* @param {Item} item
*/
- addLore(item){
- if(!item) return
- if(this.showUnlockedGemstoneSlots.getValue()){
+ addLore(item) {
+ if (!item) return
+ if (this.showUnlockedGemstoneSlots.getValue()) {
let gems = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getCompoundTag("gems")
- if(gems){
+ if (gems) {
let unlockedGems = gems.getTagMap().get("unlocked_slots")
- if(unlockedGems){
+ if (unlockedGems) {
- if(unlockedGems[m.tagCount]() === 0){
+ if (unlockedGems[m.tagCount]() === 0) {
utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&cNone!"))
- }else{
+ } else {
let gemstoneString = ""
- for(let i = 0; i < unlockedGems[m.tagCount](); i++){
+ for (let i = 0; i < unlockedGems[m.tagCount](); i++) {
let gem = String(unlockedGems[m.getStringTagAt](i)).split("_")
let name = stringUtils.firstLetterCapital(gem[0].toLowerCase())
- gemstoneString += (gemstoneString===""?"":"&7, &a")+name
+ gemstoneString += (gemstoneString === "" ? "" : "&7, &a") + name
}
- utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&a"+gemstoneString))
+ utils.addLore(item, ChatLib.addColor("&d&lGemstones Unlocked: &f"), ChatLib.addColor("&a" + gemstoneString))
}
}
}
- }
- if(this.showContainedGemstoneSlots.getValue()){
+ }
+ if (this.showContainedGemstoneSlots.getValue()) {
let gems = item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getCompoundTag("gems")
- if(gems){
+ if (gems) {
let unlockedGems = gems.getTagMap()
let gemStr = ""
unlockedGems.keySet().forEach(gem => {
- if(gem !== "unlocked_slots" && !gem.endsWith("_gem")){
+ if (gem !== "unlocked_slots" && !gem.endsWith("_gem")) {
gem = gem.split("_")
- let gemName = stringUtils.firstLetterCapital(gems.getString(gem.join("_") + "_gem").toLowerCase()) ||stringUtils.firstLetterCapital(gem[0].toLowerCase())
+ let gemName = stringUtils.firstLetterCapital(gems.getString(gem.join("_") + "_gem").toLowerCase()) || stringUtils.firstLetterCapital(gem[0].toLowerCase())
let name = stringUtils.firstLetterCapital(gems.getString(gem.join("_")).toLowerCase()) + " " + gemName
-
- gemStr += (gemStr===""?"":"&7, &a")+name
+
+ gemStr += (gemStr === "" ? "" : "&7, &a") + name
}
});
- if(gemStr !== ""){
- utils.addLore(item, ChatLib.addColor("&d&lGemstones: &f"), ChatLib.addColor("&a"+gemStr))
+ if (gemStr !== "") {
+ utils.addLore(item, ChatLib.addColor("&d&lGemstones: &f"), ChatLib.addColor("&a" + gemStr))
}
}
- }
+ }
}
- renderWorld(){
- if(this.guessBalHp.getValue()){
- if(this.balEntity) Tessellator.drawString(this.balHP + "/250" , this.balEntity.getX(), this.balEntity.getY()+12, this.balEntity.getZ())
+ renderWorld() {
+ if (this.guessBalHp.getValue()) {
+ if (this.balEntity) Tessellator.drawString(this.balHP + "/250", this.balEntity.getX(), this.balEntity.getY() + 12, this.balEntity.getZ())
}
}
- tick(){
+ tick() {
let oldCompactItems = this.compactItems
let oldTotalCompact = this.totalCompact
this.totalCompact = 0
this.compactItems = 0
let slots = [0, 1, 2, 3, 4, 5, 6, 7, 8]
-
- slots.forEach(a=>{
+
+ slots.forEach(a => {
item = Player.getInventory().getStackInSlot(a)
- if(!item) return
- if(item.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("compact_blocks")){
+ if (!item) return
+ if (item.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("compact_blocks")) {
this.compactItems++
this.totalCompact += item.getNBT().getCompoundTag("tag").getCompoundTag("ExtraAttributes").getInteger("compact_blocks")
}
})
- if(oldCompactItems === this.compactItems){
- this.compactProgress += this.totalCompact-oldTotalCompact
+ if (oldCompactItems === this.compactItems) {
+ this.compactProgress += this.totalCompact - oldTotalCompact
}
- if(this.compactItems === 0){
+ if (this.compactItems === 0) {
this.compactProgress = 0
}
- if(this.compactProgress === 0 && this.compactProgressHudOnlyWhenMoreThan0.getValue()){
+ if (this.compactProgress === 0 && this.compactProgressHudOnlyWhenMoreThan0.getValue()) {
this.compactHudElement.setText("")
- }else{
+ } else {
this.compactHudElement.setText("&6Compact Session&7> &f" + numberWithCommas(this.compactProgress))
}
- if(!this.FeatureManager.features["dataLoader"]) return
- if(this.guessBalHp.getValue() || this.balRespawnHud.getValue()){
- if(this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm"){
-
+ if (!this.FeatureManager.features["dataLoader"]) return
+ if (this.guessBalHp.getValue() || this.balRespawnHud.getValue()) {
+ if (this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" && this.FeatureManager.features["dataLoader"].class.areaFine === "Khazad-dm") {
+
this.balEntity = undefined
- World.getAllEntities().filter(a=>a.getName()==="Magma Cube").filter(a=>a.getEntity()[m.getSlimeSize]() > 10).forEach((bal)=>{
+ World.getAllEntities().filter(a => a.getName() === "Magma Cube").filter(a => a.getEntity()[m.getSlimeSize]() > 10).forEach((bal) => {
//Bal found
this.balEntity = bal
})
- if(this.balEntity){
- this.balDespawnDebounce=0
- if(this.lastBalAlive !== 0){
+ if (this.balEntity) {
+ this.balDespawnDebounce = 0
+ if (this.lastBalAlive !== 0) {
this.lastBalAlive = 0
}
- World.getAllEntitiesOfType(this.armourstandClass).forEach(e=>{
- if(Math.abs(e.getX()-this.balEntity.getX())<=5 && Math.abs(e.getZ()-this.balEntity.getZ())<=5 && Math.abs(e.getY()-(this.balEntity.getY()+12))<=5){
- if(!this.seenBalDamages.includes(e.getUUID())){
+ World.getAllEntitiesOfType(this.armourstandClass).forEach(e => {
+ if (Math.abs(e.getX() - this.balEntity.getX()) <= 5 && Math.abs(e.getZ() - this.balEntity.getZ()) <= 5 && Math.abs(e.getY() - (this.balEntity.getY() + 12)) <= 5) {
+ if (!this.seenBalDamages.includes(e.getUUID())) {
this.balHP--
this.seenBalDamages.push(e.getUUID())
}
}
})
- }else{
+ } else {
this.balDespawnDebounce++
- if(this.balDespawnDebounce > 10){
+ if (this.balDespawnDebounce > 10) {
this.seenBalDamages = []
this.balHP = 250
- if(this.lastBalAlive === 0) this.lastBalAlive = Date.now()
+ if (this.lastBalAlive === 0) this.lastBalAlive = Date.now()
}
}
}
}
- if(this.balRespawnHud.getValu