diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-22 12:35:39 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-22 12:35:39 +0800 |
commit | a7dcf231cc43c9ef73d6a969203c2dafd2ce8caf (patch) | |
tree | 41139270236804382713b4e451c609c9751c7ce2 | |
parent | dd72504a0581380ad44fd1988f943abd01ca25c2 (diff) | |
download | SoopyV2-a7dcf231cc43c9ef73d6a969203c2dafd2ce8caf.tar.gz SoopyV2-a7dcf231cc43c9ef73d6a969203c2dafd2ce8caf.tar.bz2 SoopyV2-a7dcf231cc43c9ef73d6a969203c2dafd2ce8caf.zip |
changes
-rw-r--r-- | features/bestiary/index.js | 37 | ||||
-rw-r--r-- | features/bestiary/metadata.json | 8 | ||||
-rw-r--r-- | features/eventsGUI/index.js | 51 | ||||
-rw-r--r-- | features/eventsGUI/metadata.json | 8 | ||||
-rw-r--r-- | features/globalSettings/index.js | 4 | ||||
-rw-r--r-- | features/performance/index.js | 50 | ||||
-rw-r--r-- | socketConnection.js | 28 | ||||
-rw-r--r-- | utils/networkUtils.js | 1 |
8 files changed, 159 insertions, 28 deletions
diff --git a/features/bestiary/index.js b/features/bestiary/index.js new file mode 100644 index 0000000..3888ffb --- /dev/null +++ b/features/bestiary/index.js @@ -0,0 +1,37 @@ +/// <reference types="../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import { m } from "../../../mappings/mappings"; +import Feature from "../../featureClass/class"; +import { drawCoolWaypoint } from "../../utils/renderUtils"; +import SettingBase from "../settings/settingThings/settingBase"; +import ToggleSetting from "../settings/settingThings/toggle"; + + +class Waypoints extends Feature { + constructor() { + super() + } + + onEnable() { + this.initVariables() + + this.bestiaryData = JSON.parse(FileLib.read("soopyAddonsData", "bestiaryData.json") || "{}") + this.bestiaryChanged = false + } + + initVariables() { + + } + + onDisable() { + if (this.bestiaryChanged) { + FileLib.write("soopyAddonsData", "bestiaryData.json", JSON.stringify(this.bestiaryData)) + } + + this.initVariables() + } +} + +module.exports = { + class: new Waypoints() +} diff --git a/features/bestiary/metadata.json b/features/bestiary/metadata.json new file mode 100644 index 0000000..3ff9383 --- /dev/null +++ b/features/bestiary/metadata.json @@ -0,0 +1,8 @@ +{ + "name": "Bestiary", + "description": "Bestiary trackers", + "isHidden": false, + "isTogglable": true, + "defaultEnabled": true, + "sortA": 0 +}
\ No newline at end of file diff --git a/features/eventsGUI/index.js b/features/eventsGUI/index.js new file mode 100644 index 0000000..c828f85 --- /dev/null +++ b/features/eventsGUI/index.js @@ -0,0 +1,51 @@ +/// <reference types="../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import BoxWithLoading from "../../../guimanager/GuiElement/BoxWithLoading"; +import Feature from "../../featureClass/class"; +import GuiPage from "../soopyGui/GuiPage"; + +class EventsGui extends Feature { + constructor() { + super() + } + + onEnable() { + this.initVariables() + + // this.GuiPage = new EventsPage() //TODO: SOON(tm) + + // this.registerChat("&9&m-----------------------------------------------------&r&9${*}&r&9 ${*} &6Friends (Page ${pagenum} of ${maxpages})${friendslist}&r&9&m-----------------------------------------------------&r", (...args) => { this.GuiPage.friendListMessageEvent.call(this.GuiPage, ...args) }) + // this.registerStep(true, 5, () => { this.GuiPage.regenGuiElements.call(this.GuiPage) }) + } + + initVariables() { + this.GuiPage = undefined + } + + onDisable() { + this.initVariables() + } +} + + +class EventsPage extends GuiPage { + constructor() { + super(8) + + this.name = "Guild Events" + + this.pages = [this.newPage()] + + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + + this.finaliseLoading() + } + + onOpen() { + + } +} + +module.exports = { + class: new EventsGui() +}
\ No newline at end of file diff --git a/features/eventsGUI/metadata.json b/features/eventsGUI/metadata.json new file mode 100644 index 0000000..b7b1f6f --- /dev/null +++ b/features/eventsGUI/metadata.json @@ -0,0 +1,8 @@ +{ + "name": "Friends gui", + "description": "Gui for friends", + "isHidden": true, + "isTogglable": false, + "defaultEnabled": true, + "sortA": 0 +}
\ No newline at end of file diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index b77fd0e..39a2714 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -73,6 +73,10 @@ 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/performance/index.js b/features/performance/index.js index a80240a..22a37fc 100644 --- a/features/performance/index.js +++ b/features/performance/index.js @@ -9,7 +9,7 @@ class Performance extends Feature { super() } - onEnable(){ + onEnable() { return; new SettingBase("NOTE: If you dont use any of the features, disable this", "Having performance enabled will decrease performance if no features are used\n(this is due to it using the render entity event)", true, "hide_performance_description", this) @@ -46,17 +46,17 @@ class Performance extends Feature { // } // } - renderWorld(){ - if(!this.armourStandCapSetting.getValue()) return + renderWorld() { + if (!this.armourStandCapSetting.getValue()) return this.entitysRendering = {} - Object.keys(this.entitysRenderingTemp).forEach(a=>{ + Object.keys(this.entitysRenderingTemp).forEach(a => { this.entitysRendering[a] = true }) this.entitysRenderingTemp = {} } - updateDontRender(){ - if(!this.armourStandCapSetting.getValue()) return + updateDontRender() { + if (!this.armourStandCapSetting.getValue()) return // this.removeHiddenEnts = this.removeHiddenEnts.filter(([uuid, time])=>{ // if(Date.now()<time) return true @@ -65,18 +65,18 @@ class Performance extends Feature { // }) // try{ let start = Date.now() - if(start < this.nextUpdateDontRender) return + if (start < this.nextUpdateDontRender) return let entities = World.getAllEntitiesOfType(this.armourstandClass) let Ents = new Array(100) - for(let i = 0; i < entities.length; i++){ + for (let i = 0; i < entities.length; i++) { // if(this.dontRender[entities[i].getUUID().toString()] === "hit") continue - if(!this.entitysRendering[entities[i].getUUID().toString()]){ + if (!this.entitysRendering[entities[i].getUUID().toString()]) { delete this.dontRender[entities[i].getUUID().toString()] continue //not rendering } - let dist = (Player.getX()-entities[i].getX())**2+(Player.getY()-entities[i].getY())**2+(Player.getZ()-entities[i].getZ())**2 - if(dist > 100**2){ + let dist = (Player.getX() - entities[i].getX()) ** 2 + (Player.getY() - entities[i].getY()) ** 2 + (Player.getZ() - entities[i].getZ()) ** 2 + if (dist > 100 ** 2) { this.dontRender[entities[i].getUUID().toString()] = true continue } @@ -86,12 +86,12 @@ class Performance extends Feature { } let entsNumber = 0 - for(let i = 0; i < Ents.length; i++){ + for (let i = 0; i < Ents.length; i++) { let entsNumberTemp = entsNumber - while(Ents[i]){ - if(entsNumber > this.maxEntsRender){ + while (Ents[i]) { + if (entsNumber > this.maxEntsRender) { this.dontRender[Ents[i][0].getUUID().toString()] = true - }else{ + } else { delete this.dontRender[Ents[i][0].getUUID().toString()] } @@ -100,25 +100,25 @@ class Performance extends Feature { } entsNumber = entsNumberTemp } - let timeTook = Date.now()-start + let timeTook = Date.now() - start // console.log(`Update took ${timeTook}ms | ${entsNumber} ents`) - this.nextUpdateDontRender = Date.now()+100+10*timeTook - // }catch(e){ - // //cucurrent modification - // } + this.nextUpdateDontRender = Date.now() + 100 + 10 * timeTook + // }catch(e){ + // //cucurrent modification + // } } - renderEntity(e, pos, ticks, event){ - if(!this.armourStandCapSetting.getValue()) return - if(!e.getEntity().class.toString()===this.armourstandClassString) return + renderEntity(e, pos, ticks, event) { + if (!this.armourStandCapSetting.getValue()) return + if (!e.getEntity().class.toString() === this.armourstandClassString) return this.entitysRenderingTemp[e.getUUID().toString()] = true - if(this.dontRender[e.getUUID().toString()]){ + if (this.dontRender[e.getUUID().toString()]) { cancel(event) return } } - onDisable(){ + onDisable() { this.running = false } } diff --git a/socketConnection.js b/socketConnection.js index 70b596e..b032d39 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -73,6 +73,12 @@ class SoopyV2Server extends WebsiteCommunicator { this.cookieDataUpdated = Date.now() } + if (data.type === "joinEventResult") { + console.log(JSON.stringify(data, undefined, 2)) + } + if (data.type === "eventData") { + console.log(JSON.stringify(data, undefined, 2)) + } } onConnect() { @@ -152,20 +158,23 @@ class SoopyV2Server extends WebsiteCommunicator { sendSlayerSpawnData(data) { this.sendData({ type: "slayerSpawnData", - data: data + data: data, + name: Player.getDisplayName().text }) } sendInquisData(data) { this.sendData({ type: "inquisData", - data: data + data: data, + name: Player.getDisplayName().text }) } sendVancData(data) { this.sendData({ type: "vancData", - data: data + data: data, + name: Player.getDisplayName().text }) } @@ -184,6 +193,19 @@ class SoopyV2Server extends WebsiteCommunicator { amount: amount }) } + + joinEvent(code) { + this.sendData({ + type: "joinEvent", + code + }) + } + + pollEventData() { + this.sendData({ + type: "eventData" + }) + } } if (!global.soopyV2Server) { diff --git a/utils/networkUtils.js b/utils/networkUtils.js index 4fad0aa..372ab06 100644 --- a/utils/networkUtils.js +++ b/utils/networkUtils.js @@ -174,6 +174,7 @@ if (!global.networkUtilsThingSoopy) { } } catch (e) { console.log(JSON.stringify(e, undefined, 2)) + console.log(e.stack) } if (pendingRequests.length > 0 && !runningThread) { |