diff options
-rw-r--r-- | featureClass/featureManager.js | 1 | ||||
-rw-r--r-- | features/hud/index.js | 43 | ||||
-rw-r--r-- | features/nether/index.js | 62 | ||||
-rw-r--r-- | utils/renderUtils.js | 2 |
4 files changed, 95 insertions, 13 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index cfb7ff1..3c7ff54 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -544,6 +544,7 @@ class FeatureManager { } catch (e) { logger.logMessage("Error loading feature " + feature, 1) console.log(JSON.stringify(e, undefined, 2)) + console.log(e.stack) ChatLib.chat(this.messagePrefix + "Error loading feature " + feature) soopyV2Server.reportError(e, "Error loading feature " + feature) diff --git a/features/hud/index.js b/features/hud/index.js index 8c03e1e..92d91bd 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -13,6 +13,9 @@ import renderLibs from "../../../guimanager/renderLibs"; const ProcessBuilder = Java.type("java.lang.ProcessBuilder") const Scanner = Java.type("java.util.Scanner") +const Base64 = Java.type("java.util.Base64") +const CompressedStreamTools = Java.type("net.minecraft.nbt.CompressedStreamTools") +const ByteArrayInputStream = Java.type("java.io.ByteArrayInputStream") class Hud extends Feature { constructor() { @@ -95,7 +98,7 @@ class Hud extends Feature { .requires(this.petEnabledSetting) .editTempText("&6Pet&7> &7[Lvl 100] &aEnderman")) this.hudElements.push(this.petElement) - this.scanGuiForPet = new ToggleSetting("Scan pets menu gui for selected pet", "Only disable if you get a lot of lag in the pets menu", true, "scan_pets_menu", true).requires(this.petEnabledSetting) + this.scanGuiForPet = new ToggleSetting("Scan pets menu gui for selected pet", "Only disable if you get a lot of lag in the pets menu", true, "scan_pets_menu", this).requires(this.petEnabledSetting) this.soulflowEnabledSetting = new ToggleSetting("Show Soulflow", "Whether the soulflow count is rendered onto the screen", true, "soulflow_enabled", this) this.soulflowShowWarningSetting = new ToggleSetting("Show no Talisman Warning", "Shows a warning if you dont have a soulflow talis in ur inv", true, "soulflow_notalis_warning", this).requires(this.soulflowEnabledSetting) @@ -205,6 +208,7 @@ class Hud extends Feature { this.lastTickEventEpochTimestamp = 0 this.lastAbsorbtion = 0 this.impactTest = false + this.apiSoulflow = false this.lastUpdatedStatData = 0 @@ -505,15 +509,17 @@ class Hud extends Feature { } }) if (!hasSoulflowItem) { - if (this.soulflowShowWarningSetting.getValue()) { - this.soulflowElement.setText("&6Soulflow&7> &cNO TALISMAN") - } else { - this.soulflowElement.setText("") + if (!this.apiSoulflow) { + if (this.soulflowShowWarningSetting.getValue()) { + this.soulflowElement.setText("&6Soulflow&7> &cNO TALISMAN") + } else { + this.soulflowElement.setText("") + } } return; } if (soulflowCount > 0 && !this.soulflowShowWhen0Setting.getValue()) { - this.soulflowElement.setText("") + if (!this.apiSoulflow) this.soulflowElement.setText("") return; } @@ -524,9 +530,34 @@ class Hud extends Feature { data.profiles.forEach(p => { if (!this.lastStatData || (p.members[Player.getUUID().toString().replace(/-/g, "")] && p.members[Player.getUUID().toString().replace(/-/g, "")].last_save > this.lastStatData.last_save)) { this.lastStatData = p.members[Player.getUUID().toString().replace(/-/g, "")] + this.lastStatData.itemsData = {} + + if (this.lastStatData?.talisman_bag && this.lastStatData?.talisman_bag?.data) { + let nbtTagCompound = CompressedStreamTools[m.readCompressed](new ByteArrayInputStream(Base64.getDecoder().decode(this.lastStatData.talisman_bag.data))); + + this.lastStatData.itemsData.talisman_bag = new NBTTagCompound(nbtTagCompound) + } } }) + if (this.lastStatData.itemsData.talisman_bag) { + let isSoulflowCounting = false + this.lastStatData.itemsData.talisman_bag.toString().split(",").forEach(line => { + if (isSoulflowCounting) { + this.lastStatData._soulflow *= 1000 + this.lastStatData._soulflow += parseInt(ChatLib.removeFormatting(line.split(` `)[0]).replace(/[^0-9]/g, "")) + isSoulflowCounting = !line.endsWith(`Soulflow"`) + } + if (line.startsWith(`display:{Lore:[0:"§7Internalized:`)) { + isSoulflowCounting = !line.endsWith(`Soulflow"`) + this.lastStatData._soulflow = parseInt(ChatLib.removeFormatting(line.split(`"§7Internalized: `)[1])) + + this.apiSoulflow = true + } + }) + if (this.apiSoulflow) this.soulflowElement.setText("&6Soulflow&7> &f" + this.numberUtils.numberWithCommas(this.lastStatData._soulflow)) + } + this.updateHudThingos() } diff --git a/features/nether/index.js b/features/nether/index.js index e0c5cd3..4eb6fab 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -1,10 +1,12 @@ /// <reference types="../../../CTAutocomplete" /> /// <reference lib="es2015" /> -import { m } from "../../../mappings/mappings"; +import { f, m } from "../../../mappings/mappings"; import Feature from "../../featureClass/class"; -import { drawBoxAtBlock, drawLine } from "../../utils/renderUtils"; +import { drawBoxAtBlock, drawBoxAtEntity, drawLine, drawLineWithDepth, renderBeaconBeam } from "../../utils/renderUtils"; import ToggleSetting from "../settings/settingThings/toggle"; 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"); class Nether extends Feature { constructor() { @@ -16,13 +18,20 @@ 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.registerCustom("packetReceived", this.packetReceived) this.registerStep(true, 1, this.step1S) this.registerEvent("renderWorld", this.renderWorld) + this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent); + this.registerEvent("tick", this.tick) + + this.todoE = [] + this.todoE2 = [] this.blocks = [] + this.dojoFireBalls = [] this.inSwiftness = false this.lastBlock = undefined this.registerChat("&r&r&r &r&aTest of Swiftness &r&e&lOBJECTIVES&r", () => { @@ -37,6 +46,23 @@ class Nether extends Feature { }) } + tick() { + this.todoE2.forEach(e => { + let item = e[m.getHeldItem]() + if (!item) return + if (MCItem[m.getIdFromItem](item[m.getItem.ItemStack]()) !== 173) return + + this.dojoFireBalls.push(e) + }) + + this.todoE2 = this.todoE + this.todoE = [] + } + + entityJoinWorldEvent(event) { + if (this.tenacityLine.getValue() && event.entity instanceof ArmorStand) this.todoE.push(event.entity) + } + packetReceived(packet, event) { if (!this.masteryTimer.getValue()) return let packetType = new String(packet.class.getSimpleName()).valueOf() @@ -71,23 +97,47 @@ class Nether extends Feature { if (oldBlockState === 0 && blockState === 20515 && this.inSwiftness) { this.lastBlock = [position.getX(), position.getY(), position.getZ()] } + if (oldBlockState === 20515 && blockState === 16419) { + this.blocks.push({ loc: position, time: Date.now() + 3000 }) + } + if (blockState === 57379) { + this.blocks = this.blocks.filter(b => { + if (b.loc.x === position.x && b.loc.y === position.y && b.loc.z === position.z) { + return false + } + return true + }) + //air=0 + //green=20515 + //yellow=16419 + //red=57379 + } }) } } renderWorld(event) { if (this.masteryTimer.getValue()) { - this.blocks.forEach(data => { - Tessellator.drawString(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) + 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) }) - if (this.blocks.length >= 2) drawLine(this.blocks[0].loc.getX(), this.blocks[0].loc.getY(), this.blocks[0].loc.getZ(), this.blocks[1].loc.getX(), this.blocks[1].loc.getY(), this.blocks[1].loc.getZ(), 255, 0, 0) + if (this.blocks.length >= 2) drawLine(this.blocks[0].loc.getX() + 0.5, this.blocks[0].loc.getY(), this.blocks[0].loc.getZ() + 0.5, this.blocks[1].loc.getX() + 0.5, this.blocks[1].loc.getY(), this.blocks[1].loc.getZ() + 0.5, 255, 0, 0) } if (this.lastBlock && this.inSwiftness) drawBoxAtBlock(this.lastBlock[0], this.lastBlock[1], this.lastBlock[2], 0, 255, 0, 1, 1) + + if (this.tenacityLine.getValue()) this.dojoFireBalls.forEach(e => { + let offset = [e[f.width.Entity] / 2, e[f.height.Entity] / 2, e[f.width.Entity] / 2] + let entitylocation = [e[f.posX.Entity], e[f.posY.Entity], e[f.posZ.Entity]] + let lastLocation = [e[f.prevPosX], e[f.prevPosY], e[f.prevPosZ]] + let change = [entitylocation[0] - lastLocation[0], entitylocation[1] - lastLocation[1], entitylocation[2] - lastLocation[2]] + 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) + }) } step1S() { - this.blocks = this.blocks.filter(state => Date.now() < state.time) + if (this.blocks) this.blocks = this.blocks.filter(state => Date.now() < state.time) + if (this.dojoFireBalls) this.dojoFireBalls = this.dojoFireBalls.filter(e => !e[f.isDead]) } getBlockIdFromState(state) { diff --git a/utils/renderUtils.js b/utils/renderUtils.js index 857c7ab..4ec1bc8 100644 --- a/utils/renderUtils.js +++ b/utils/renderUtils.js @@ -63,7 +63,7 @@ let ret = { GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); }, - drawLineWithDepth: function (x, y, z, x2, y2, z2, r, g, b, t) { + drawLineWithDepth: function (x, y, z, x2, y2, z2, r, g, b, t = 1) { GL11.glBlendFunc(770, 771); GL11.glEnable(GL11.GL_BLEND); |