diff options
| -rw-r--r-- | chat/apiNew.js | 8 | ||||
| -rw-r--r-- | chat/grieferTrack.js | 34 | ||||
| -rw-r--r-- | commandManager.js | 12 | ||||
| -rw-r--r-- | commands/calculate/hotmCalc.js | 4 | ||||
| -rw-r--r-- | commands/claim.js | 116 | ||||
| -rw-r--r-- | commands/coords/automatons.js | 3 | ||||
| -rw-r--r-- | commands/coords/temple.js | 46 | ||||
| -rw-r--r-- | commands/drawLine.js | 3 | ||||
| -rw-r--r-- | commands/findColeweight.js | 14 | ||||
| -rw-r--r-- | commands/help.js | 2 | ||||
| -rw-r--r-- | data/collections.json | 26 | ||||
| -rw-r--r-- | data/hotm.json | 6 | ||||
| -rw-r--r-- | index.js | 1 | ||||
| -rw-r--r-- | metadata.json | 2 | ||||
| -rw-r--r-- | render/efficientMinerOverlay.js | 189 | ||||
| -rw-r--r-- | render/gemstoneMiningStats.js | 23 | ||||
| -rw-r--r-- | render/guis/collectionGui.js | 3 | ||||
| -rw-r--r-- | render/guis/efficientMinerOverlayGui.js | 113 | ||||
| -rw-r--r-- | render/miningAbilities.js | 20 | ||||
| -rw-r--r-- | render/treecapTimer.js | 2 | ||||
| -rw-r--r-- | settings.js | 51 | ||||
| -rw-r--r-- | util/helperFunctions.js | 10 | ||||
| -rw-r--r-- | util/renderUtil.js | 93 |
23 files changed, 598 insertions, 183 deletions
diff --git a/chat/apiNew.js b/chat/apiNew.js index 76a2418..36025e3 100644 --- a/chat/apiNew.js +++ b/chat/apiNew.js @@ -7,13 +7,11 @@ register("chat", (key) => { axios.get(`https://api.hypixel.net/key?key=${key}`) .then(res => { if(res.data.success == true) - { - constants.data.api_key = key - constants.data.save() ChatLib.chat(`${PREFIX}&aSuccsessfully set api key!`) - } else - ChatLib.chat(`${PREFIX}&eKey is not valid!`) + ChatLib.chat(`${PREFIX}&eKey might not be valid!`) + constants.data.api_key = key + constants.data.save() }) .catch(err => { ChatLib.chat(`${PREFIX}&eKey is not valid! if this is a mistake report: ${err}`) diff --git a/chat/grieferTrack.js b/chat/grieferTrack.js index a939b45..157696b 100644 --- a/chat/grieferTrack.js +++ b/chat/grieferTrack.js @@ -1,6 +1,7 @@ import axios from "../../axios" import settings from "../settings" import constants from "../util/constants" +import { checkInDwarven, checkInHollows } from "../util/helperFunctions" const PREFIX = constants.PREFIX let checkedPlayers = [], griefers = [] @@ -25,7 +26,7 @@ register("worldLoad", () => { function checkMMiners() { - if (!settings.trackGriefers) return + if (!settings.trackGriefers || (!settings.grieferEverywhere && !(checkInDwarven() || checkInHollows()))) return try { const NetHandlerPlayClient = Client.getConnection(), @@ -36,14 +37,13 @@ function checkMMiners() if(!checkedPlayers.includes(player)) { - griefers.forEach(griefer => { - let dateObj = new Date(0) - dateObj.setUTCMilliseconds(griefer.timestamp) - - if(griefer.name == player) - ChatLib.chat(`${PREFIX}&e'${player}' has griefed &e&l${griefer.offences} &etime(s). Their last grief was on ${dateObj.toString().slice(4, 15)}.`) - }) - checkedPlayers.push(player) + let griefer = findGriefer(player) + + if(griefer.found) + { + ChatLib.chat(`${PREFIX}&e'${player}' has griefed &e&l${griefer.offences} &etime(s). Their last grief was on ${griefer.dateObj.toString().slice(4, 15)}.`) + checkedPlayers.push(player) + } } }) } catch(err) { if(settings.debug) console.log("grieferTrack trycatch: " + err) } @@ -64,4 +64,20 @@ register("gameLoad", () => { }) +export function findGriefer(player) +{ + let grieferReturnObj = {} + grieferReturnObj.found = false + griefers.forEach(griefer => { + griefer.dateObj = new Date(0) + griefer.dateObj.setUTCMilliseconds(griefer.timestamp) + + if(griefer.name.toLowerCase() == player.toLowerCase()) + { + grieferReturnObj = griefer + grieferReturnObj.found = true + } + }) + return grieferReturnObj +} export default ""
\ No newline at end of file diff --git a/commandManager.js b/commandManager.js index f1b6dee..35ccb7a 100644 --- a/commandManager.js +++ b/commandManager.js @@ -10,7 +10,6 @@ import { leaderboard } from "./commands/leaderboard" import { update } from "./commands/update" import { fetchDiscord } from "./commands/fetchDiscord" import { findColeweight } from "./commands/findColeweight" -import { claim } from "./commands/claim" import { time } from "./commands/time" import { info } from "./commands/info" import { credits } from "./commands/credits" @@ -24,7 +23,8 @@ import { throne } from "./commands/coords/throne" import { divans } from "./commands/coords/divans" import { yog } from "./commands/coords/yog" import { automatons } from "./commands/coords/automatons" -import { drawLine } from "./commands/drawline.js" +import { temple } from "./commands/coords/temple.js" +import { drawLine } from "./commands/drawLine.js" register("command", (...args) => { @@ -97,9 +97,6 @@ register("command", (...args) => { case "settings": Settings.openGUI() break - case "claim": - claim(args[1]) - break case "powdertrackersync": updateDisplay() break @@ -123,6 +120,9 @@ register("command", (...args) => { case "automatons": automatons(args[1]) break + case "temple": + temple(args[1]) + break case "coord": case "coords": openCoordsGui() @@ -148,7 +148,7 @@ register("command", (...args) => { reloadOptions = ["coleweight", "collection"], calculateOptions = ["tick", "ms2toprofessional", "hotm", "calchotm"], commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard", - "settings", "claim", "time", "info", "clearlobbies", "yog", "divan", "automatons", "coords", "credits", "track", "calculate", "drawline"] + "settings", "time", "info", "clearlobbies", "yog", "divan", "automatons", "temple", "coords", "credits", "track", "calculate", "drawline"] if(args[0].length == 0 || args[0] == undefined) return output = commands diff --git a/commands/calculate/hotmCalc.js b/commands/calculate/hotmCalc.js index 7fa947c..1b449d4 100644 --- a/commands/calculate/hotmCalc.js +++ b/commands/calculate/hotmCalc.js @@ -20,7 +20,7 @@ export function hotmCalc(hotmName, minLevel, maxLevel) if(maxLevel == undefined) { maxLevel = minLevel - minLevel = 1 + minLevel = 2 } if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE) @@ -74,5 +74,5 @@ export function findCost(costFormula, minLevel, maxLevel, fortunate = false) export function findReward(rewardFormula, minLevel, maxLevel) { - return eval(rewardFormula.replace("Level", 1+maxLevel-minLevel)) + return eval(rewardFormula.replace("Level", 2+maxLevel-minLevel)) }
\ No newline at end of file diff --git a/commands/claim.js b/commands/claim.js deleted file mode 100644 index a8c51c6..0000000 --- a/commands/claim.js +++ /dev/null @@ -1,116 +0,0 @@ -import axios from "../../axios" -import settings from "../settings" -import constants from "../util/constants" -const PREFIX = constants.PREFIX -const path = `https://ninjune.dev` -const serverId = java.util.UUID.randomUUID().toString().replace("-", "") -let claimedServers = [] - - -export function claim(structure) -{ - if(!settings.claiming) - { - ChatLib.chat(`${PREFIX}&cPlease turn on the &3Claiming&c setting in /cw settings!`) - return - } - - if (constants.serverData.map != "Crystal Hollows") - { - ChatLib.chat(`${PREFIX}&cThis command is only available in the crystal hollows!`) - return - } - - if (structure == undefined || !(structure.toLowerCase() == "throne" || structure.toLowerCase() == "spiral")) - { - ChatLib.chat(`${PREFIX}&cPlease enter the structure you wish to claim! (&3throne&c or &3spiral&c)`) - return - } - - axios.get(`${path}/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`) - .then(res => { - if(res.data.success) - { - ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`) - claimedServers.push({player: Player.getName(), server: constants.serverData.server, structure: structure}) - return - } - else - { - - if(res.data.code == 501) - { - ChatLib.chat(`${PREFIX}&cError: Not logged into the auth server. Try running the command again.`) - return Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - } - else - return ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`) - } - }) - .catch(err => { - return ChatLib.chat(`${PREFIX}&cError: ${err}`) - }) -} - - -register('gameLoad', (event) => { - try - { - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - } - catch(e) {} - getClaimed() -}) - - -register('worldLoad', () => { - if(!settings.claiming) return - setTimeout(() => { - const NetHandlerPlayClient = Client.getConnection(), - PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap - let player - - if(settings.debug) console.log(constants.serverData.server) - - claimedServers.forEach((claimedServer) => { - PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => { - player = PlayerMP.func_178845_a().name - - if (player == claimedServer.player && claimedServer.server == constants.serverData.server) - ChatLib.chat(`${PREFIX}&cThe ${claimedServer.structure} in ${claimedServer.server} is claimed by ${claimedServer.player}.`) - }) - - if (Player.getName() == claimedServer.player) - { - axios.get(`${path}/api/unclaim?username=${Player.getName()}&serverID=${serverId}`) - .then(res => { - if(settings.debug && !res.data.success) - ChatLib.chat("Unclaim: " + res.data.reason) - if(res.data.code == 501) - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - }) - .catch(err => { - if(settings.debug) - ChatLib.chat(`${PREFIX}&cError: ${err}`) - }) - } - }) - }, 2000) -}) - - -function getClaimed() -{ - axios.get(`${path}/api/claimed?authServer=${serverId}&passedName=${Player.getName()}`) - .then(res => { - if(res.data.code == 501) - { - Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId) - return - } - claimedServers = [] - res.data.forEach(server => { - claimedServers.push(server) - }) - }) -} diff --git a/commands/coords/automatons.js b/commands/coords/automatons.js index 4114eec..3284edf 100644 --- a/commands/coords/automatons.js +++ b/commands/coords/automatons.js @@ -24,10 +24,9 @@ export function automatons(arg) y = startPos[1], z = startPos[2] - let coordsRows = FileLib.read("Coleweight", "data/automatons.txt").split("\r\n") + let coordsRows = FileLib.read("Coleweight", "data/automatons.txt").split("\n") coordsRows.forEach(unsplitRow => { let row = unsplitRow.split(" ") - waypoints.push([x + parseInt(row[0]), y + parseInt(row[1]), z + parseInt(row[2])]) }) diff --git a/commands/coords/temple.js b/commands/coords/temple.js new file mode 100644 index 0000000..f60e724 --- /dev/null +++ b/commands/coords/temple.js @@ -0,0 +1,46 @@ +import constants from "../../util/constants" +import { waypointRender } from "../../util/helperFunctions" + +const PREFIX = constants.PREFIX +let waypoints = [] + +export function temple(arg) +{ + const WAYPOINTNAME = "Temple" + + if(arg != "toggle") + { + new TextComponent(`${PREFIX}&bStand on the leftmost key guardian and do /cw ${WAYPOINTNAME} toggle`) + .chat() + } + else + { + if(waypoints[0] == undefined) + { + let startPos = [Player.getX(), Player.getY(), Player.getZ()], + x = startPos[0], + y = startPos[1], + z = startPos[2] + + waypoints.push([x + 61, y + -44, z + 18]) + + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned on!`) + } + else + { + waypoints = [] + ChatLib.chat(`${PREFIX}&b${WAYPOINTNAME} waypoints turned off!`) + } + } +} + +register("renderWorld", () => { + waypointRender(waypoints) +}) + + +register("worldLoad", () => { + waypoints = [] +}) + +export default ""
\ No newline at end of file diff --git a/commands/drawLine.js b/commands/drawLine.js index 7fd9742..1374dea 100644 --- a/commands/drawLine.js +++ b/commands/drawLine.js @@ -1,5 +1,5 @@ import constants from "../util/constants" -import { trace } from "../util/renderUtil" +import { trace, drawEspBox } from "../util/renderUtil" const PREFIX = constants.PREFIX let x = 0, @@ -39,4 +39,5 @@ register("renderWorld", () => { if(x == 0 && y == 0 && z == 0) return trace(x, y, z, 0, 0, 1, 0.86) + drawEspBox(x, y, z, 0, 0, 1, 0.86) // y no work })
\ No newline at end of file diff --git a/commands/findColeweight.js b/commands/findColeweight.js index ace0ec6..a2c5156 100644 --- a/commands/findColeweight.js +++ b/commands/findColeweight.js @@ -1,4 +1,6 @@ import axios from "../../axios" +import { findGriefer } from "../chat/grieferTrack" +import settings from "../settings" import constants from "../util/constants" const PREFIX = constants.PREFIX @@ -12,11 +14,17 @@ export function findColeweight(arg) username = arg axios.get(`https://ninjune.dev/api/coleweight?username=${username}`) .then(res => { - let coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`) - .setHoverValue(`&fExperience&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fPowder&f: &a${Math.round(res.data.powder.total*100) / 100}\n&fCollection&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fMiscellaneous&f: &a${Math.round(res.data.miscellaneous.total*100) / 100}`) + let griefer = findGriefer(username), coleweightMessage + console.log(griefer.offenses) + if(griefer.found) + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%) &c&lGriefed ${griefer.offences} time(s) &c(last grief: &a${griefer.dateObj.toString().slice(4, 15)}&c)`) + else + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`) + coleweightMessage.setHoverValue(`&fExperience&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fPowder&f: &a${Math.round(res.data.powder.total*100) / 100}\n&fCollection&f: &a${Math.round(res.data.collection.total*100) / 100}\n&fMiscellaneous&f: &a${Math.round(res.data.miscellaneous.total*100) / 100}`) ChatLib.chat(coleweightMessage) }) .catch(err => { - ChatLib.chat(`${PREFIX}&eError. (api may be down)`) + if(settings.debug) ChatLib.chat(`${PREFIX}&eError. (api may be down) ${err}`) + else ChatLib.chat(`${PREFIX}&eError. (api may be down)`) }) }
\ No newline at end of file diff --git a/commands/help.js b/commands/help.js index f46cc2c..69abcee 100644 --- a/commands/help.js +++ b/commands/help.js @@ -13,7 +13,6 @@ export function help() helpCommand("info", "Prints coleweight info.", "") ChatLib.chat(ChatLib.getCenteredText("&a&lSettings")) helpCommand("settings", "Opens settings.", "") - helpCommand("claim", "Claims a chollows sapphire structure in a lobby.", "(throne || spiral)") helpCommand("setkey", "Sets API key (can also use /api new)", "(key)") helpCommand("reload", "Reloads the gui.", "") helpCommand("track", "Sets tracked collection for collection tracker.", "(collection)") @@ -23,6 +22,7 @@ export function help() helpCommand("spiral", "Guide for setting up waypoints for spiral", "[toggle]") helpCommand("yog", "Shows instructions for yog waypoints.", "[toggle]") helpCommand("divans", "Guide for setting up waypoints for Mines of Divan treasures.", "[toggle]") + helpCommand("jungle", "Guide for setting up temple clip waypoint (nuc runs).", "[toggle]") ChatLib.chat(ChatLib.getCenteredText("&a&lMiscellaneous")) helpCommand("drawline", "Draws a line to coords. (y defaults to the player's y)", "(x) [y] (z)") ChatLib.chat(`&a${PREFIX} /fetchdiscord (username) => &bGets discord of username (if linked)`) diff --git a/data/collections.json b/data/collections.json index e61a942..db90b8f 100644 --- a/data/collections.json +++ b/data/collections.json @@ -54,7 +54,7 @@ "collectionToTrack": "EMERALD", "collectionStringed": "Emerald" }, - "endstone": + "end": { "collectionToTrack": "ENDER_STONE", "collectionStringed": "Endstone" @@ -77,11 +77,31 @@ "quartz": { "collectionToTrack": "QUARTZ", - "collectionStringed": "Endstone" + "collectionStringed": "Quartz" }, "cobblestone": { "collectionToTrack": "COBBLESTONE", "collectionStringed": "Cobblestone" - } + }, + "hard": + { + "collectionToTrack": "HARD_STONE", + "collectionStringed": "Hard Stone" + }, + "red": + { + "collectionToTrack": "SAND:1", + "collectionStringed": "Red Sand" + }, + "sand": + { + "collectionToTrack": "SAND", + "collectionStringed": "Sand" + }, + "gravel": + { + "collectionToTrack": "GRAVEL", + "collectionStringed": "Gravel" + } }
\ No newline at end of file diff --git a/data/hotm.json b/data/hotm.json index 8d27a20..d0c31e8 100644 --- a/data/hotm.json +++ b/data/hotm.json @@ -25,8 +25,8 @@ "powderType": "mithril" }, { - "costFormula": "200+((currentLevel-1)*18)", - "rewardFormula": "(200+((Level-1)*18))*2", + "costFormula": "Math.pow((currentLevel+1), 3.1)", + "rewardFormula": "2+(Level*0.1)", "nameStringed": "Titanium Insanium", "names": ["titaniuminsanium", "titanium", "tita"], "maxLevel": 50, @@ -35,7 +35,7 @@ { "costFormula": "200+((currentLevel-1)*18)", "rewardFormula": "(200+((Level-1)*18))*2", - "nameStringed": "Titanium Insanium", + "nameStringed": "Daily powder", "names": ["dailypowder"], "maxLevel": 100, "powderType": "mithril" @@ -1,5 +1,6 @@ import './render/naturals' import './render/tabList' +import './render/efficientMinerOverlay' import './render/gemstoneMiningStats' import './render/dwarvenNotifier' import './render/treecapTimer' diff --git a/metadata.json b/metadata.json index e87d02a..84a02ed 100644 --- a/metadata.json +++ b/metadata.json @@ -3,6 +3,6 @@ "creator": "Ninjune", "entry": "index.js", "description": "Mining utilities.", - "version": "1.8.3", + "version": "1.8.7", "requires": ["axios", "PogData", "Vigilance", "Elementa"] }
\ No newline at end of file diff --git a/render/efficientMinerOverlay.js b/render/efficientMinerOverlay.js new file mode 100644 index 0000000..cd6468d --- /dev/null +++ b/render/efficientMinerOverlay.js @@ -0,0 +1,189 @@ +import { drawEspBox, trace } from "../util/renderUtil" +import settings from "../settings" + +let blockStatesToFind = [ + {name: "minecraft:wool[color=light_blue]", prio: 2}, + {name: "minecraft:obsidian", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine_bricks]", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine_bricks]", prio: 0}, + {name: "minecraft:prismarine[variant=prismarine]", prio: 0}] +let threadActive = false, + maxPrio = -10000000, + drawBlocks = [], + lookingAt + +let thread = new Thread(() => { + threadActive = true + let tempPrio, tempMax = { prio: -100000 }, tempSecondMax = { prio: -100000 }, block, blockState, tempBlocks = [] + + const playerX = Player.getX(), + playerY = Player.getY(), + playerZ = Player.getZ(), + playerReach = 4 + + if(playerX == undefined || playerY == undefined || playerZ == undefined || !World.isLoaded()) { threadActive = false; return thread.stop() } + + + for(let x = Math.round(playerX-playerReach); x < Math.ceil(playerX+playerReach); x++) + { + for(let y = Math.round(playerY-playerReach); y < Math.ceil(playerY+playerReach); y++) + { + for(let z = Math.round(playerZ-playerReach); z < Math.ceil(playerZ+playerReach); z++) + { + block = World.getBlockAt(x, y, z) + blockState = block.getState().toString() + + if(blockStatesToFind.some(obj => obj.name === blockState) && isVisible(x, y, z)) + { + tempPrio = findPrio(x, y, z, blockState, blockStatesToFind[blockStatesToFind.findIndex(obj => obj.name === blockState)].prio) + tempBlocks.push({x: Math.round(x) + 0.5, y: y, z: Math.round(z) + 0.5, prio: tempPrio}) + } + } + } + } + for(let i = 0; i < tempBlocks.length; i++) + { + if(tempBlocks[i].prio > tempMax.prio) + { + tempMax = tempBlocks[i] + } + if(tempBlocks[i].prio > tempSecondMax.prio && tempBlocks[i].prio < tempMax.prio) + { + tempSecondMax = tempBlocks[i] + } + } + + if(tempMax == undefined || tempSecondMax == undefined) drawBlocks = [] + else if(drawBlocks[0] != undefined && drawBlocks[1] != undefined && drawBlocks[0].x != undefined && drawBlocks[1].x != undefined && + World.getBlockAt(drawBlocks[0].x, drawBlocks[0].y, drawBlocks[0].z).type.getRegistryName() === "minecraft:bedrock") // if player just mined block + { + drawBlocks[0] = drawBlocks[1] + threadActive = false + drawBlocks[1] = tempSecondMax + } + else + { + drawBlocks[0] = tempMax + drawBlocks[1] = tempSecondMax + maxPrio = tempMax.prio + } + + threadActive = false +}) + + +register("renderWorld", () => { + if(!settings.efficientMinerOverlay || drawBlocks.length < 2 || drawBlocks[0] == undefined || drawBlocks[1] == undefined + || drawBlocks[0].x == undefined || drawBlocks[1].x == undefined) return + + try{ + trace(drawBlocks[0].x, drawBlocks[0].y + 5/10, drawBlocks[0].z, 1, 0, 0.3, 0.7, true) + drawEspBox(drawBlocks[0].x, drawBlocks[0].y, drawBlocks[0].z, 1, 0, 0.3, 0.7, true) + drawEspBox(drawBlocks[1].x, drawBlocks[1].y, drawBlocks[1].z, 1, 0.5, 0.3, 0.7, true) + } catch(err) {if(settings.debug) console.log(err)} + +}) + +/*register("step", () => { // debug, comment when done + +}).setFps(1)*/ + +register("step", () => { + if(!threadActive) + thread.start() +}).setFps(20) + +register("gameUnload", () => { + thread.stop() +}) + + +function findPrio(originX, originY, originZ, blockStateToFind, prio) +{ + let radius = 2 + 1/2, + blockCount = 0, + rayTraceX, rayTraceY, rayTraceZ + if(Player.lookingAt() != undefined && Player.lookingAt()?.getRegistryName() != "minecraft:air") + lookingAt = Player.lookingAt() + + if(lookingAt != undefined) + { + rayTraceX = lookingAt.getX() + rayTraceY = lookingAt.getY() + rayTraceZ = lookingAt.getZ() + } + + + for(let x = Math.round(originX-radius); x < Math.round(originX+radius); x++) // second cube + { + for(let y = Math.round(originY-radius); y < Math.round(originY+radius); y++) + { + for(let z = Math.round(originZ-radius); z < Math.round(originZ+radius); z++) + { + if(World.getBlockAt(x, y, z)?.getState()?.toString() === blockStateToFind) + { + if(checkConnectedBlocks(x, y, z, originX, originY, originZ, blockStateToFind, 2.5)) + blockCount++ + } + else if (World.getBlockAt(x, y, z)?.getState()?.toString() === "minecraft:stone[variant=smooth_diorite]") + { + if(prio > 0) + prio = 0 + else + prio += 2/10 + } + + // RAYTRACE + if(lookingAt != undefined) + { + prio -= Math.abs(rayTraceX - x)/100 // = 0.01 per block of distance + prio -= Math.abs(rayTraceY - y)/100 + prio -= Math.abs(rayTraceZ - z)/100 + } + + } + } + } + if(blockCount > 6) + blockCount = 6 + prio += blockCount*3/10 + + return Math.round(prio*100)/100 +} + +function isVisible(x, y, z) +{ + if(World.getBlockAt(x, y, z).type.getRegistryName() === "minecraft:bedrock") return false + if (World.getBlockAt(x, y+1, z).type.getRegistryName() === "minecraft:air") return true // above + if (World.getBlockAt(x, y-1, z).type.getRegistryName() === "minecraft:air") return true // below + if (World.getBlockAt(x+1, y, z).type.getRegistryName() === "minecraft:air") return true // east + if (World.getBlockAt(x-1, y, z).type.getRegistryName() === "minecraft:air") return true // west + if (World.getBlockAt(x, y, z+1).type.getRegistryName() === "minecraft:air") return true // north + if (World.getBlockAt(x, y, z-1).type.getRegistryName() === "minecraft:air") return true // south + + return false +} + + +function checkConnectedBlocks(x, y, z, originX, originY, originZ, blockStateToFind, distance) { + if (World.getBlockAt(x, y, z).getState().toString() !== blockStateToFind) { + return false; + } + if (Math.abs(x - originX) + Math.abs(y - originY) + Math.abs(z - originZ) > distance) { + return false; + } + + for (let dx = -1; dx <= 1; dx++) { + for (let dy = -1; dy <= 1; dy++) { + for (let dz = -1; dz <= 1; dz++) { + if (dx === 0 && dy === 0 && dz === 0) { + continue; + } + if (!checkConnectedBlocks(x + dx, y + dy, z + dz, distance)) { + return false; + } + } + } + } + return true; +}
\ No newline at end of file diff --git a/render/gemstoneMiningStats.js b/render/gemstoneMiningStats.js index b0bf4b8..40eed1a 100644 --- a/render/gemstoneMiningStats.js +++ b/render/gemstoneMiningStats.js @@ -5,7 +5,7 @@ import { addCommas, getSelectedProfile } from "../util/helperFunctions" import axios from "../../axios" import { findCost, findHotmObject } from "../commands/calculate/hotmCalc" const NBTTagString = Java.type("net.minecraft.nbt.NBTTagString") - +let powderTotals = {} register("itemTooltip", (lore, item) => { // this is so bad 💀 if(!item.getLore()[0].startsWith("§o§aYour SkyBlock Profile") || !settings.gemstoneMiningStats) return @@ -62,8 +62,17 @@ register("itemTooltip", (lore, item) => { // this is so bad 💀 register("gameLoad", () => { axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${Player.getUUID()}`) .then(res => { - let professional = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.professional, - fortunate = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.fortunate + let + selected = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")] + professional = selected?.mining_core?.nodes?.professional, + fortunate = selected?.mining_core?.nodes?.fortunate + + powderTotals = { + gemstone: (selected?.mining_core?.powder_gemstone_total ?? 0) + + (selected?.mining_core?.powder_spent_gemstone ?? 0), + mithril: (selected?.mining_core?.powder_mithril_total ?? 0) + + (selected?.mining_core?.powder_spent_mithril ?? 0) + } if(professional != undefined) constants.data.professional = professional @@ -106,16 +115,16 @@ register("itemTooltip", (lore, item) => { // powder put into each perk let perk = item.getLore()[0].replace(/§.|\(.+\)/g, "").replace(/ /g, "") let level = /Level (\d+)/g.exec(item.getLore()[1])[1] let hotmObjectToFind = findHotmObject(perk) - if(hotmObjectToFind == undefined) return + if(hotmObjectToFind == undefined || (hotmObjectToFind.costFormula == undefined && perk != "Fortunate")) return let powderSum if(perk == "Fortunate") - powderSum = findCost(undefined, 1, parseInt(level), true) + powderSum = findCost(undefined, 2, parseInt(level), true) else - powderSum = findCost(hotmObjectToFind.costFormula, 1, parseInt(level)) + powderSum = findCost(hotmObjectToFind.costFormula, 2, parseInt(level)) if(item.getLore()[1].includes("💀")) return - list.set(0, new NBTTagString(item.getLore()[1] + ` §7(§b${addCommas(Math.round(powderSum))}§7)💀`)) // this is a perfect solution no cap + list.set(0, new NBTTagString(item.getLore()[1] + ` §7(§b${addCommas(Math.round(powderSum))} §l${Math.round(powderSum/powderTotals[hotmObjectToFind.powderType]*100)}%§7)💀`)) // this is a perfect solution no cap }).start() })
\ No newline at end of file diff --git a/render/guis/collectionGui.js b/render/guis/collectionGui.js index 8f96d4a..3764fcf 100644 --- a/render/guis/collectionGui.js +++ b/render/guis/collectionGui.js @@ -2,7 +2,6 @@ import constants from "../../util/constants" import settings from "../../settings" import { trackerGui } from "../../util/helperFunctions" const PREFIX = constants.PREFIX -const collectionMoveGui = new Gui() const collectionGui = new trackerGui("", "Collection Not set! /cw track", settings.collectionNotation) @@ -37,7 +36,7 @@ register("dragged", (dx, dy, x, y) => { }) register("renderOverlay", () => { - collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionNotation, settings.collectionTracker) + collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionTracker, settings.collectionNotation, settings.showCollectionTrackerAlways) }) register("step", () => { diff --git a/render/guis/efficientMinerOverlayGui.js b/render/guis/efficientMinerOverlayGui.js new file mode 100644 index 0000000..8c2f609 --- /dev/null +++ b/render/guis/efficientMinerOverlayGui.js @@ -0,0 +1,113 @@ +/*import { // after careful consideration I have decided not to make this with elementa, if anyone wants to make it for me (be it with elementa or Renderer) make https://imgur.com/a/D0XpIUx, dm Ninjune#0670 if need help + AdditiveConstraint, + CenterConstraint, + ConstantColorConstraint, + UIBlock, + UIImage, + UIWrappedText, + UIText, + WindowScreen, + } from "../../../Elementa" + +const Color = Java.type("java.awt.Color"), + URL = Java.type("java.net.URL"), + COORDS_WIDTH = 3.5, // not actually width more like reverse of width lmao, bigger = smaller + COORDS_HEIGHT = 2.877 // ^ + ITEM_WIDTH = 3.5, + ITEM_HEIGHT = 2.877 +let ScreenW = Renderer.screen.getWidth(), + ScreenH = Renderer.screen.getHeight(), + itemCount = 0 + + class itemGui + { + constructor(item) + { + this.item = item + itemCount++ + + const textWindow = new UIBlock(new Color(0, 0, 0, 0.5)) // 320 960 + .setX(new CenterConstraint()) + .setY((ScreenH/2*itemCount + ScreenH/10.8).pixels()) |
