diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/constants.js | 8 | ||||
-rw-r--r-- | util/grieferTrack.js | 47 | ||||
-rw-r--r-- | util/helperFunctions.js | 49 | ||||
-rw-r--r-- | util/updater.js | 35 | ||||
-rw-r--r-- | util/waypoints.js | 7 |
5 files changed, 45 insertions, 101 deletions
diff --git a/util/constants.js b/util/constants.js index 51345fe..95664dd 100644 --- a/util/constants.js +++ b/util/constants.js @@ -35,16 +35,8 @@ export default powderdata: PowderData, timerdata: TimerData, downtimedata: DowntimeData, - cwValues: [], - calcCwPerHr: false, - upTimeTrack: false, - uptime: 0, - baseColeweight: 0, - stepsSinceLast: 0, throneValues: [], spiralValues: [], - coleweightHr: 0, - cwValuesSum: 0, beta: false, serverData: {} }
\ No newline at end of file diff --git a/util/grieferTrack.js b/util/grieferTrack.js deleted file mode 100644 index a21653b..0000000 --- a/util/grieferTrack.js +++ /dev/null @@ -1,47 +0,0 @@ -import axios from "../../axios" -import Settings from "../settings" -import constants from "./constants" -const PREFIX = constants.PREFIX -let players = [] // global variable moment - - -function checkMMiners() -{ - if (!Settings.trackGriefers) return - const NetHandlerPlayClient = Client.getConnection(), - PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap - - PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => { - let player = PlayerMP.func_178845_a().name - - if(players.indexOf(player) == -1) - { - axios.get(`https://ninjune.dev/api/mminers?username=${player}`) - .then(res => { - if(res.data.found == true && res.data.type == "griefer") - ChatLib.chat(`${PREFIX}&e'${res.data.name}' is a griefer!`) - }) - players.push(player) - } - }) - - return players -} - - -register("step", () => { - let date_ob = new Date(), - seconds = date_ob.getSeconds() - - if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45) - checkMMiners() -}).setFps(1) - - -register("worldLoad", () => { - players = [] - checkMMiners() -}) - - -export default ""
\ No newline at end of file diff --git a/util/helperFunctions.js b/util/helperFunctions.js index 2bea5d0..7a3927d 100644 --- a/util/helperFunctions.js +++ b/util/helperFunctions.js @@ -1,10 +1,51 @@ -/* -Created 11/11/2022 by Ninjune. -*/ export function addCommas(num) { try { return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } catch (error) { return 0; } -}// credit to senither for the regex, just don't care to make my own lol
\ No newline at end of file +}// credit to senither for the regex, just don't care to make my own lol + + +export function waypointRender(waypoints, yellow=false) +{ + if(waypoints.length < 1) return + waypoints.forEach((waypoint) => { + if(yellow) + Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2], 0xFAFD01) + else + Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2]) + }) +} + + +export class textGui // first class I've made, gonna be dog +// guiObject format: { leftValues: [], rightValues: [] } (must have same amount of each or error). +{ + constructor(guiObject, x, y) + { + this.guiObject = guiObject + this.x = x + this.y = y + } + + + renderGui() + { + let string = "" + this.guiObject.leftValues.forEach((leftValue, index) => { + if(leftValue == "Uptime") + { + let uptime = this.guiObject.rightValues[index], + uptimeHr = Math.floor(uptime/60/60) + + if(uptimeHr >= 1) + string += `&aUptime: &b${uptimeHr}h ${Math.floor(uptime/60) - uptimeHr*60}m\n` + else + string += `&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n` + } + else + string += `&a${leftValue}: &b${this.guiObject.rightValues[index]}\n` + }) + Renderer.drawStringWithShadow(string, this.x, this.y) } +}
\ No newline at end of file diff --git a/util/updater.js b/util/updater.js deleted file mode 100644 index ea8fa2c..0000000 --- a/util/updater.js +++ /dev/null @@ -1,35 +0,0 @@ -import axios from "../../axios" -import constants from "./constants" - -const PREFIX = constants.PREFIX, - VERSION = constants.VERSION - -register("worldLoad", () => { - axios.get(`https://chattriggers.com/api/modules/1367`) - .then(res => { - let ctVersionArray = (res.data.releases[0].releaseVersion).split('.'), - currentVersionArray = VERSION.split('.'), - newVersion = false - - for(let i = ctVersionArray.length; i >= 0; i--) - { - if (ctVersionArray[i] > currentVersionArray[i]) - newVersion = true - else if (currentVersionArray[i] > ctVersionArray[i]) - newVersion = false - } - - if(newVersion) - { - ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`) - new TextComponent(`${PREFIX}&eClick &3here&e to update!`) - .setClickAction("run_command") - .setClickValue(`/ct load`) - .chat() - ChatLib.chat("") - } - }) - -}) - -export default ""
\ No newline at end of file diff --git a/util/waypoints.js b/util/waypoints.js deleted file mode 100644 index eb7dad8..0000000 --- a/util/waypoints.js +++ /dev/null @@ -1,7 +0,0 @@ -export function waypointRender(waypoints) -{ - if(waypoints.length < 1) return - waypoints.forEach((waypoint) => { - Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2]) - }) -}
\ No newline at end of file |