aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/dungeonSolvers/index.js4
-rw-r--r--features/globalSettings/index.js4
-rw-r--r--features/hud/HudTextElement.js53
-rw-r--r--features/hud/index.js28
-rw-r--r--features/lockedFeatures/index.js5
-rw-r--r--features/mining/index.js7
-rw-r--r--features/settings/settingThings/location.js3
-rw-r--r--features/settings/settingThings/toggle.js24
-rw-r--r--features/slayers/index.js7
9 files changed, 43 insertions, 92 deletions
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 5b675a7..d753b43 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -487,10 +487,6 @@ class DungeonSolvers extends Feature {
} else {
this.spiritBearSpawnElement.setText("");
}
-
- for (let element of this.hudElements) {
- element.render();
- }
}
onWorldLoad() {
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 39a2714..b77fd0e 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -73,10 +73,6 @@ class GlobalSettings extends Feature {
this.registerEvent("tick", this.fixNEU)
}
- if (net.minecraftforge.fml.common.Loader.isModLoaded("SoopyV2")) {
-
- }
-
this.registerCommand("soopyweight", (user = Player.getName()) => {
this.soopyWeight(user)
})
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 46c660d..de031a2 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -1,3 +1,5 @@
+import { HudText } from "../../utils/renderJavaUtils"
+
class HudTextElement {
constructor() {
this.text = ""
@@ -5,8 +7,6 @@ class HudTextElement {
this.toggleSetting = undefined
this.locationSetting = undefined
- this.blackText = "&0" + ChatLib.removeFormatting(this.text)
-
this.editTempTimeV = 0
this.editTempTextV = undefined
@@ -16,8 +16,9 @@ class HudTextElement {
this.tempDisableTime = 0
this.renderTextCache = [""]
- this.renderBlackTextCache = [""]
this.textChanged = false
+
+ this.renderElm = new HudText([""], 0, 0, true).startRender()
}
setBaseEditWidth(width) {
@@ -34,25 +35,30 @@ class HudTextElement {
if (text === this.text) return this
this.text = text
- if (this.locationSetting && this.locationSetting.shadowType === 2) {
- this.blackText = "&0" + ChatLib.removeFormatting(text)
- }
+ this.renderTextCache = ChatLib.addColor(this.text).split("\n")
- this.renderTextCache = this.text.split("\n")
- this.renderBlackTextCache = this.blackText.split("\n")
+ this.renderElm.setText(this.renderTextCache)
return this
}
setToggleSetting(setting) {
this.toggleSetting = setting
+ setting.onChange = () => {
+ if (this.toggleSetting.getValue()) {
+ this.renderElm.startRender()
+ } else {
+ this.renderElm.stopRender()
+ }
+ }
return this
}
setLocationSetting(setting) {
this.locationSetting = setting
setting.setParent(this)
- if (this.locationSetting.shadowType === 2) {
- this.blackText = "&0" + ChatLib.removeFormatting(text)
+ setting.onChange = () => {
+ this.renderElm.setX(this.locationSetting.x).setY(this.locationSetting.y).setScale(this.locationSetting.scale)
}
+ this.renderElm.setX(this.locationSetting.x).setY(this.locationSetting.y).setScale(this.locationSetting.scale)
return this
}
@@ -93,24 +99,6 @@ class HudTextElement {
return this.renderTextCache
}
- getBlackText() {
- if (Date.now() - this.editTempTimeV < 100) {
- let text = this.text
- let blackText = this.blackText
- if (this.editTempTextV) {
- text = this.editTempTextV
- blackText = "&0" + ChatLib.removeFormatting(text)
- }
-
- if (ChatLib.removeFormatting(text) === "") {
- blackText = "&0Empty string"
- }
-
- return blackText.split("\n")
- }
- return this.renderBlackTextCache
- }
-
renderRaw() {
let text = this.getText()
@@ -123,15 +111,6 @@ class HudTextElement {
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 c6254d4..7d07085 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -137,6 +137,7 @@ class Hud extends Feature {
scale: this.spotifyElement.locationSetting.scale,
shadowType: this.spotifyElement.locationSetting.shadowType
})
+ this.spotifyElement2.renderElm.stopRender()
let hudStatTypes = {
"cata": "Catacombs level + Exp",
@@ -311,6 +312,14 @@ class Hud extends Feature {
}
tick() {
+ if (this.fpsFastSetting.getValue()) {
+ if (this.fpsLowSetting.getValue()) {
+ this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()) + "&7/" + Math.round(this.lowFps.get()))
+ } else {
+ this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()))
+ }
+ }
+
if (!this.lagEnabled.getValue()) return
if (this.packetMoves > 0) {
this.secondPackets++
@@ -329,22 +338,9 @@ class Hud extends Feature {
}
renderHud() {
- if (this.fpsFastSetting.getValue()) {
- if (this.fpsLowSetting.getValue()) {
- this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()) + "&7/" + Math.round(this.lowFps.get()))
- } else {
- this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()))
- }
- }
-
- for (let element of this.hudElements) {
- element.render()
- }
-
if (this.showSpotifyPlaying.getValue() && Date.now() - this.spotifyElement.tempDisableTime > 100) {
let scale = this.spotifyElement.locationSetting.scale
let spotifyWidth1 = this.spotifyElement.getWidth() * scale
- this.spotifyElement.render()
this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x + spotifyWidth1
this.spotifyElement2.locationSetting.y = this.spotifyElement.locationSetting.y
this.spotifyElement2.locationSetting.scale = scale
@@ -373,10 +369,6 @@ class Hud extends Feature {
if (this.witherImpactCooldownSetting.getValue() && Date.now() - this.lastWitherImpact < 10000) {
Renderer.drawString(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s") / 2, Renderer.screen.getHeight() / 2 - 15)
}
-
- for (let stat of this.hudStat) {
- stat.textElement.render()
- }
}
renderWorld() {
@@ -484,7 +476,7 @@ class Hud extends Feature {
if (!Player.getPlayer()) return
if (!Player.getInventory()) return
- if (!this.FeatureManager.features["dataLoader"].class.isInSkyblock) {
+ if (this.FeatureManager.features["dataLoader"] && !this.FeatureManager.features["dataLoader"].class.isInSkyblock) {
this.soulflowElement.setText("")
this.petElement.setText("")
return
diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js
index 44a4139..2826626 100644
--- a/features/lockedFeatures/index.js
+++ b/features/lockedFeatures/index.js
@@ -29,7 +29,6 @@ class LockedFeatures extends Feature {
this.eventCommand = undefined
this.registerStep(true, 1, this.step)
- this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.guildEventLb.getValue())
}
step() {
@@ -107,10 +106,6 @@ class LockedFeatures extends Feature {
this.guildLbElement.setText(text)
}
- renderOverlay() {
- this.hudElements.forEach(a => a.render())
- }
-
initVariables() {
}
diff --git a/features/mining/index.js b/features/mining/index.js
index a05552d..8c6ce12 100644
--- a/features/mining/index.js
+++ b/features/mining/index.js
@@ -53,7 +53,6 @@ class Mining extends Feature {
this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class
- this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue())
this.registerEvent("tick", this.tick)
this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue())
this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue())
@@ -218,12 +217,6 @@ class Mining extends Feature {
}
}
- renderOverlay() {
- for (let element of this.hudElements) {
- element.render()
- }
- }
-
initVariables() {
this.hudElements = undefined
this.guessBalHp = undefined
diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js
index 70e1527..9cd13af 100644
--- a/features/settings/settingThings/location.js
+++ b/features/settings/settingThings/location.js
@@ -26,6 +26,8 @@ class LocationSetting extends ButtonSetting {
this.resizePoint = 0
this.resizeInitialPos = [0, 0, 0, 0, 0, 0]
+ this.onChange = undefined
+
this.parent = undefined
this.soopyGui = new SoopyGui()
@@ -146,6 +148,7 @@ class LocationSetting extends ButtonSetting {
_updateValue() {
this.setValue([this.x, this.y, this.scale, this.shadowType])
+ if (this.onChange) this.onChange()
}
editTempText(text) {
diff --git a/features/settings/settingThings/toggle.js b/features/settings/settingThings/toggle.js
index d839b8f..200ac87 100644
--- a/features/settings/settingThings/toggle.js
+++ b/features/settings/settingThings/toggle.js
@@ -4,47 +4,51 @@ import Toggle from "../../../../guimanager/GuiElement/Toggle";
import SettingBase from "./settingBase";
class ToggleSetting extends SettingBase {
- constructor(name, description, defaultVal, settingId, module){
+ constructor(name, description, defaultVal, settingId, module) {
super(name, description, defaultVal, settingId, module)
+ this.onChange = undefined
+
this.toggleObject = new Toggle().setLocation(0, 0.3, 0.8, 0.4).setValue(this.getValue())
this.settingObject.addChild(this.toggleObject)
- this.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
+ this.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
this.setValue(newVal)
}))
}
- setValue(newVal){
+ setValue(newVal) {
super.setValue(newVal)
this.toggleObject.setValue(newVal)
+ if (this.onChange) this.onChange()
+
return this
}
- requires(toggleSetting){
+ requires(toggleSetting) {
this.requiresO = toggleSetting
- toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
- if(newVal){
+ toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
+ if (newVal) {
this.setValue(this.temp_val)
- this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, ()=>{}])
+ this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, () => { }])
this.guiObject.location.size.y.set(0.2, 500)
- }else{
+ } else {
this.temp_val = this.getValue()
this.setValue(false)
- this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [false, this.temp_val, ()=>{}])
+ this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [false, this.temp_val, () => { }])
this.guiObject.location.size.y.set(0, 500)
}
}))
let newVal = this.requiresO.getValue()
- if(!newVal){
+ if (!newVal) {
let temp_val = this.temp_val
this.setValue(false)
this.temp_val = temp_val
diff --git a/features/slayers/index.js b/features/slayers/index.js
index a7b0f73..16ac357 100644
--- a/features/slayers/index.js
+++ b/features/slayers/index.js
@@ -127,7 +127,6 @@ class Slayers extends Feature {
this.registerEvent("tick", this.tick);
this.registerEvent("renderWorld", this.renderWorld);
this.registerEvent("worldLoad", this.worldLoad);
- this.registerEvent("renderOverlay", this.renderHud);
this.registerStep(true, 2, this.step);
}
@@ -139,12 +138,6 @@ class Slayers extends Feature {
this.slayerLocationDataH[user] = [loc, Date.now()]
}
- renderHud() {
- for (let element of this.hudElements) {
- element.render();
- }
- }
-
worldLoad() {
this.todoE = [];
this.beaconPoints = {};