From 4fd8b9502464c8c588221d175eb1d3bbf770dce2 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 14 Jan 2022 15:09:02 +0800 Subject: add exp/hour, runs/hour and average time per run (including downtime inbetween) --- features/hud/HudTextElement.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'features/hud') diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index b56b350..5599b5c 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -16,7 +16,7 @@ class HudTextElement{ setText(text){ this.text = text - if(this.locationSetting.shadowType === 2){ + if(this.locationSetting && this.locationSetting.shadowType === 2){ this.blackText = "&0" + ChatLib.removeFormatting(text) } return this @@ -28,6 +28,10 @@ class HudTextElement{ setLocationSetting(setting){ this.locationSetting = setting setting.setParent(this) + + if(this.locationSetting.shadowType === 2){ + this.blackText = "&0" + ChatLib.removeFormatting(text) + } return this } @@ -38,6 +42,13 @@ class HudTextElement{ this.renderRaw() } + getWidth(){ + return Math.max(...(this.getText()[0].map(a=>Renderer.getStringWidth(ChatLib.removeFormatting(a))))) + } + getHeight(){ + return 9*this.getText()[0].length + } + getText(){ let text = this.text let blackText = this.blackText -- cgit