diff options
| author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-06 18:15:47 +0800 |
|---|---|---|
| committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-06 18:15:47 +0800 |
| commit | b33a75b2eba88c60280fcd441a5dd974cf763ab4 (patch) | |
| tree | 53bd51697f69596fdcc388cdc71cc91b745f8f67 /features | |
| parent | bae481562a9186cafebdde2be9ac53b93cb98885 (diff) | |
| download | SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.tar.gz SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.tar.bz2 SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.zip | |
Added update notif, cosmetics, and unfinished museum overlay
Diffstat (limited to 'features')
| -rw-r--r-- | features/betterGuis/index.js | 16 | ||||
| -rw-r--r-- | features/betterGuis/museumGui.js | 393 | ||||
| -rw-r--r-- | features/changeLogGUI/index.js | 48 | ||||
| -rw-r--r-- | features/cosmetics/cosmetic.js | 20 | ||||
| -rw-r--r-- | features/cosmetics/dragonWings.js | 291 | ||||
| -rw-r--r-- | features/cosmetics/hiddenRequirement.js | 5 | ||||
| -rw-r--r-- | features/cosmetics/index.js | 146 | ||||
| -rw-r--r-- | features/cosmetics/metadata.json | 8 | ||||
| -rw-r--r-- | features/globalSettings/index.js | 3 | ||||
| -rw-r--r-- | features/soopyGui/index.js | 14 |
10 files changed, 934 insertions, 10 deletions
diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index 8600499..9648a9a 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -1,8 +1,8 @@ /// <reference types="../../../CTAutocomplete" /> /// <reference lib="es2015" /> import Feature from "../../featureClass/class"; -import { drawBoxAtBlockNotVisThruWalls } from "../../utils/renderUtils"; import ToggleSetting from "../settings/settingThings/toggle"; +import MuseumGui from "./museumGui"; class BetterGuis extends Feature { constructor() { @@ -12,8 +12,12 @@ class BetterGuis extends Feature { onEnable(){ this.initVariables() + this.museumGui = new MuseumGui() + this.replaceSbMenuClicks = new ToggleSetting("Improve Clicks on SBMENU", "This will change clicks to middle clicks, AND use commands where possible (eg /pets)", true, "sbmenu_clicks", this) this.reliableSbMenuClicks = {getValue: ()=>false}//removed because hypixel fixed may add back later //new ToggleSetting("Make SBMENU clicks reliable", "This will delay clicks on sbmenu to time them so they dont get canceled", true, "sbmenu_time", this) + + this.museumGuiEnabled = {getValue: ()=>false} //Removed because not finished yet new ToggleSetting("Custom Museum GUI", "Custom gui for the Museum", true, "custom_museum_enabled", this) this.lastWindowId = 0 this.shouldHold = 10 @@ -89,6 +93,12 @@ class BetterGuis extends Feature { ] this.registerEvent("guiMouseClick", this.guiClicked) + this.registerEvent("guiOpened", (event)=>{ + if(this.museumGuiEnabled.getValue()) this.museumGui.guiOpened.call(this.museumGui, event) + }) + this.registerEvent("tick", ()=>{ + if(this.museumGuiEnabled.getValue()) this.museumGui.tick.call(this.museumGui) + }) this.registerStep(true, 10, this.step) } @@ -99,7 +109,7 @@ class BetterGuis extends Feature { if(!hoveredSlot) return let hoveredSlotId = hoveredSlot.field_75222_d - // console.log(hoveredSlotId) + console.log(hoveredSlotId) if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getOpenedInventory().getName()), hoveredSlotId)){ cancel(event) } @@ -185,6 +195,8 @@ class BetterGuis extends Feature { this.middleClickGuis = undefined this.middleClickStartsWith = undefined this.middleClickEndsWith = undefined + + this.museumGui = undefined } onDisable(){ diff --git a/features/betterGuis/museumGui.js b/features/betterGuis/museumGui.js new file mode 100644 index 0000000..c3c47d0 --- /dev/null +++ b/features/betterGuis/museumGui.js @@ -0,0 +1,393 @@ +import { SoopyGui, SoopyRenderEvent } from "../../../guimanager" +import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent" +import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent" +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow" +import ProgressBar from "../../../guimanager/GuiElement/ProgressBar" +import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement" +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement" +import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement" +import renderLibs from "../../../guimanager/renderLibs" +import utils from "../../utils/utils" + +class MuseumGui { + constructor(){ + this.checkMenu = false + + this.isInMuseum = false + this.guiOpenTickThing = false + this.dontOpen = 0 + this.lastClosed = 0 + this.itemsInPages = {} + + this.soopyGui = new SoopyGui() + + this.soopyGui.element.addEvent(new SoopyKeyPressEvent().setHandler((...args)=>{ + this.keyPress(...args) + })) + + this.mainPage = new SoopyGuiElement().setLocation(0,0,1,1) + this.soopyGui.element.addChild(this.mainPage) + + let widthPer = 0.2 + let leftOffset = (1-widthPer*3-widthPer*4/5)/2 + + this.weaponsIndicator = new SoopyBoxElement().setLocation(leftOffset, 0.05, widthPer*4/5, 0.15) + this.weaponsIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ + if(this.weaponsIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Weapons"){ + this.weaponText.location.location.x.set(0.05, 500) + this.weaponText.location.size.x.set(0.9, 500) + this.weaponText.location.location.y.set(0.025, 500) + this.weaponText.location.size.y.set(0.35, 500) + + this.weaponsIndicator.setColorOffset(-20, -20, -20, 100) + + Renderer.translate(0,0,100) + Renderer.drawRect(Renderer.color(0,0,0,100), this.weaponsIndicator.location.getXExact(), this.weaponsIndicator.location.getYExact(), this.weaponsIndicator.location.getWidthExact(), this.weaponsIndicator.location.getHeightExact()) + let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2" + Renderer.translate(0,0,100) + renderLibs.drawStringCenteredFull(clicks, this.weaponsIndicator.location.getXExact()+this.weaponsIndicator.location.getWidthExact()/2, this.weaponsIndicator.location.getYExact()+this.weaponsIndicator.location.getHeightExact()/2, Math.min(this.weaponsIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.weaponsIndicator.location.getHeightExact()/4/2)) + }else{ + this.weaponText.location.location.x.set(0.1, 500) + this.weaponText.location.size.x.set(0.8, 500) + this.weaponText.location.location.y.set(0.05, 500) + this.weaponText.location.size.y.set(0.3, 500) + + this.weaponsIndicator.setColorOffset(0, 0, 0, 100) + } + })).addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.clickedTopButton("Weapons") + })) + + this.weaponText = new SoopyTextElement().setText("§5Weapons").setMaxTextScale(10).setLocation(0.1,0.05,0.8,0.3) + this.weaponsIndicator.addChild(this.weaponText) + this.weaponsPercentageText = new SoopyTextElement().setLocation(0.1,0.4,0.8,0.2).setText("§0Items Donated: §7Loading...").setMaxTextScale(10) + this.weaponsIndicator.addChild(this.weaponsPercentageText) + this.weaponsProgressBar = new ProgressBar().setLocation(0.1,0.6,0.8,0.35).showPercentage(true) + this.weaponsIndicator.addChild(this.weaponsProgressBar) + this.mainPage.addChild(this.weaponsIndicator) + + this.armourIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer, 0.05, widthPer*4/5, 0.15) + this.armourIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ + if(this.armourIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Armor Sets"){ + this.armourText.location.location.x.set(0.05, 500) + this.armourText.location.size.x.set(0.9, 500) + this.armourText.location.location.y.set(0.025, 500) + this.armourText.location.size.y.set(0.35, 500) + + this.armourIndicator.setColorOffset(-20, -20, -20, 100) + + Renderer.translate(0,0,100) + Renderer.drawRect(Renderer.color(0,0,0,100), this.armourIndicator.location.getXExact(), this.armourIndicator.location.getYExact(), this.armourIndicator.location.getWidthExact(), this.armourIndicator.location.getHeightExact()) + let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2" + Renderer.translate(0,0,100) + renderLibs.drawStringCenteredFull(clicks, this.armourIndicator.location.getXExact()+this.armourIndicator.location.getWidthExact()/2, this.armourIndicator.location.getYExact()+this.armourIndicator.location.getHeightExact()/2, Math.min(this.armourIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.armourIndicator.location.getHeightExact()/4/2)) + }else{ + this.armourText.location.location.x.set(0.1, 500) + this.armourText.location.size.x.set(0.8, 500) + this.armourText.location.location.y.set(0.05, 500) + this.armourText.location.size.y.set(0.3, 500) + + this.armourIndicator.setColorOffset(0, 0, 0, 100)} + })).addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.clickedTopButton("Armor Sets") + })) + + this.armourText = new SoopyTextElement().setText("§5Armor Sets").setMaxTextScale(10).setLocation(0.1,0.05,0.8,0.3) + this.armourIndicator.addChild(this.armourText) + this.armourPercentageText = new SoopyTextElement().setLocation(0.1,0.4,0.8,0.2).setText("§0Items Donated: §7Loading...").setMaxTextScale(10) + this.armourIndicator.addChild(this.armourPercentageText) + this.armourProgressBar = new ProgressBar().setLocation(0.1,0.6,0.8,0.35).showPercentage(true) + this.armourIndicator.addChild(this.armourProgressBar) + this.mainPage.addChild(this.armourIndicator) + + this.raritiesIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer*2, 0.05, widthPer*4/5, 0.15) + this.raritiesIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ + if(this.raritiesIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Rarities"){ + this.raritiesText.location.location.x.set(0.05, 500) + this.raritiesText.location.size.x.set(0.9, 500) + this.raritiesText.location.location.y.set(0.025, 500) + this.raritiesText.location.size.y.set(0.35, 500) + + this.raritiesIndicator.setColorOffset(-20, -20, -20, 100) + + Renderer.translate(0,0,100) + Renderer.drawRect(Renderer.color(0,0,0,100), this.raritiesIndicator.location.getXExact(), this.raritiesIndicator.location.getYExact(), this.raritiesIndicator.location.getWidthExact(), this.raritiesIndicator.location.getHeightExact()) + let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2" + Renderer.translate(0,0,100) + renderLibs.drawStringCenteredFull(clicks, this.raritiesIndicator.location.getXExact()+this.raritiesIndicator.location.getWidthExact()/2, this.raritiesIndicator.location.getYExact()+this.raritiesIndicator.location.getHeightExact()/2, Math.min(this.raritiesIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.raritiesIndicator.location.getHeightExact()/4/2)) + }else{ + this.raritiesText.location.location.x.set(0.1, 500) + this.raritiesText.location.size.x.set(0.8, 500) + this.raritiesText.location.location.y.set(0.05, 500) + this.raritiesText.location.size.y.set(0.3, 500) + + this.raritiesIndicator.setColorOffset(0, 0, 0, 100) + } + })).addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.clickedTopButton("Rarities") + })) + + this.raritiesText = new SoopyTextElement().setText("§5Rarities").setMaxTextScale(10).setLocation(0.1,0.05,0.8,0.3) + this.raritiesIndicator.addChild(this.raritiesText) + this.raritiesPercentageText = new SoopyTextElement().setLocation(0.1,0.4,0.8,0.2).setText("§0Items Donated: §7Loading...").setMaxTextScale(10) + this.raritiesIndicator.addChild(this.raritiesPercentageText) + this.raritiesProgressBar = new ProgressBar().setLocation(0.1,0.6,0.8,0.35).showPercentage(true) + this.raritiesIndicator.addChild(this.raritiesProgressBar) + this.mainPage.addChild(this.raritiesIndicator) + + this.specialIndicator = new SoopyBoxElement().setLocation(leftOffset+widthPer*3, 0.05, widthPer*4/5, 0.15) + this.specialIndicator.addEvent(new SoopyRenderEvent().setHandler(()=>{ + if(this.specialIndicator.hovered && ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) !== "Special Items"){ + this.specialText.location.location.x.set(0.05, 500) + this.specialText.location.size.x.set(0.9, 500) + this.specialText.location.location.y.set(0.025, 500) + this.specialText.location.size.y.set(0.35, 500) + + this.specialIndicator.setColorOffset(-20, -20, -20, 100) + + Renderer.translate(0,0,100) + Renderer.drawRect(Renderer.color(0,0,0,100), this.specialIndicator.location.getXExact(), this.specialIndicator.location.getYExact(), this.specialIndicator.location.getWidthExact(), this.specialIndicator.location.getHeightExact()) + let clicks = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"?"1":"2" + Renderer.translate(0,0,100) + renderLibs.drawStringCenteredFull(clicks, this.specialIndicator.location.getXExact()+this.specialIndicator.location.getWidthExact()/2, this.specialIndicator.location.getYExact()+this.specialIndicator.location.getHeightExact()/2, Math.min(this.specialIndicator.location.getWidthExact()/Renderer.getStringWidth(clicks)/4, this.specialIndicator.location.getHeightExact()/4/2)) + + }else{ + this.specialText.location.location.x.set(0.1, 500) + this.specialText.location.size.x.set(0.8, 500) + this.specialText.location.location.y.set(0.05, 500) + this.specialText.location.size.y.set(0.3, 500) + + this.specialIndicator.setColorOffset(0, 0, 0, 100) + } + })).addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.clickedTopButton("Special Items") + })) + + this.specialText = new SoopyTextElement().setText("§5Special Items").setMaxTextScale(10).setLocation(0.1,0.05,0.8,0.3) + this.specialIndicator.addChild(this.specialText) + this.specialPercentageText = new SoopyTextElement().setLocation(0.1,0.4,0.8,0.6).setText("§0Items Donated: §7Loading...").setMaxTextScale(10) + this.specialIndicator.addChild(this.specialPercentageText) + this.mainPage.addChild(this.specialIndicator) + + let box = new SoopyBoxElement().setLocation(0.5-widthPer/2, 0.25, widthPer, 0.075) + this.pageTitle = new SoopyTextElement().setText("§5Museum").setMaxTextScale(10).setLocation(0,0,1,1) + box.addChild(this.pageTitle) + this.mainPage.addChild(box) + + this.itemsBox = new SoopyBoxElement().setLocation(0.5-widthPer*3/2, 0.35, widthPer*3, 0.6).setScrollable(true) + this.mainPage.addChild(this.itemsBox) + } + + clickedTopButton(type){ + if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())===type) return + + if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"){ + //if on main page can just directly click on it + switch(type){ + case "Weapons": + Player.getOpenedInventory().click(19, false, "MIDDLE") + break + case "Armor Sets": + Player.getOpenedInventory().click(21, false, "MIDDLE") + break + case "Rarities": + Player.getOpenedInventory().click(23, false, "MIDDLE") + break + case "Special Items": + Player.getOpenedInventory().click(25, false, "MIDDLE") + break + } + }else{ + Player.getOpenedInventory().click(48, false, "MIDDLE") + } + } + + tickMenu(){ + this.pageTitle.setText("§5"+ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())) + if(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName())==="Museum"){ + if(!Player.getOpenedInventory().getStackInSlot(19)) return + + let lore = Player.getOpenedInventory().getStackInSlot(19).getLore() + lore.forEach((line, i)=>{ + if(i===0) return + + if(line.split(" ")?.[1]?.includes("/")){ + let data = ChatLib.removeFormatting(line).split(" ")[1].split("/") + + this.weaponsProgressBar.setProgress(parseInt(data[0])/parseInt(data[1])) + this.weaponsPercentageText.setText("§0Items Donated: §7"+data[0]+"/"+data[1]) + } + }) + this.weaponsIndicator.setLore(lore) + + lore = Player.getOpenedInventory().getStackInSlot(21).getLore() + lore.forEach((line, i)=>{ + if(i===0) return + + if(line.split(" ")?.[1]?.includes("/")){ + let data = ChatLib.removeFormatting(line).split(" ")[1].split("/") + + this.armourProgressBar.setProgress(parseInt(data[0])/parseInt(data[1])) + this.armourPercentageText.setText("§0Items Donated: §7"+data[0]+"/"+data[1]) + } + }) + this.armourIndicator.setLore(lore) + + lore = Player.getOpenedInventory().getStackInSlot(23).getLore() + lore.forEach((line, i)=>{ + if(i===0) return + + if(line.split(" ")?.[1]?.includes("/")){ + let data = ChatLib.removeFormatting(line).split(" ")[1].split("/") + + this.raritiesProgressBar.setProgress(parseInt(data[0])/parseInt(data[1])) + this.raritiesPercentageText.setText("§0Items Donated: §7"+data[0]+"/"+data[1]) + } + }) + this.raritiesIndicator.setLore(lore) + + lore = Player.getOpenedInventory().getStackInSlot(25).getLore() + lore.forEach((line, i)=>{ + if(i===0) return + + if(ChatLib.removeFormatting(line).startsWith("Items Donated: ")){ + this.specialPercentageText.setText("§0Items Donated: §7"+ChatLib.removeFormatting(line).split(": ")[1]) + } + }) + this.specialIndicator.setLore(lore) + } + + let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"] + if(itempages.includes(ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()))){ + let page = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) + let pageNum = 0 + Player.getOpenedInventory().getStackInSlot(45).getLore().forEach(line=>{ + if(ChatLib.removeFormatting(line).startsWith("Page ")) pageNum = parseInt(ChatLib.removeFormatting(line).split(" ")[1])+1 + }) + Player.getOpenedInventory().getStackInSlot(53).getLore().forEach(line=>{ + if(ChatLib.removeFormatting(line).startsWith("Page ")) pageNum = parseInt(ChatLib.removeFormatting(line).split(" ")[1])-1 + }) + + if(!this.itemsInPages[page]) this.itemsInPages[page] = [] + + //10-16 43 + let changed = false + for(let i = 0;i<3;i++){ + for(let j = 10;j<16;j++){ + let slot = i*9+j + let item = Player.getOpenedInventory().getStackInSlot(slot) + let sb_id = utils.getSBID(item) + if(sb_id){ + if(!this.itemsInPages[page][pageNum]) this.itemsInPages[page][pageNum] = [] + if(!this.itemsInPages[page][pageNum][i]) this.itemsInPages[page][pageNum][i] = [] + + let itemData = { + sb_id: sb_id, + name: item.getName(), + lore: item.getLore() + } + + if(JSON.stringify(this.itemsInPages[page][pageNum][i][j]) !== JSON.stringify(itemData)){ + this.itemsInPages[page][pageNum][i][j] = itemData + + changed = true + } + } + } + } + if(changed) this.regenItems() + } + } + + regenItems(){ + this.itemsBox.clearChildren() + + let page = ChatLib.removeFormatting(Player.getOpenedInventory().getStackInSlot(4).getName()) + + let y = 0.1 + let itemNum = 0 + let width = 2 + let widthPer = 0.9/(width+1) + let offset = 0.0125 + + this.itemsInPages[page].forEach(page=>{ + if(page === null) return + page.forEach(row=>{ + if(row === null) return + row.forEach(slot=>{ + if(slot === null) return + + let child = new ButtonWithArrow().setText(slot.name.startsWith("§f")?"&7"+slot.name.substr(2):slot.name).setLore(slot.lore).setLocation(0.05+offset+widthPer*itemNum,y,widthPer*9/10,0.15) + this.itemsBox.addChild(child) + + itemNum++ + if(itemNum>width){ + itemNum = 0 + y+=0.175 + } + }) + }) + }) + } + + guiOpened(event){ + if(this.dontOpen > 0){ + this.dontOpen-- + return + } + if(this.soopyGui.ctGui.isOpen()){ + cancel(event) + // this.soopyGui.ctGui.open() + return + } + if(this.isInMuseum){ + this.soopyGui.ctGui.open() + }else{ + this.checkMenu = true + } + } + + keyPress(key, keyId){ + if(keyId === 1){ //escape key + this.isInMuseum = false + this.dontOpen = 3 + } + } + + tick(){ + if(this.isInMuseum){ + if(this.soopyGui.ctGui.isOpen() || this.guiOpenTickThing){ + this.tickMenu() + + this.guiOpenTickThing = false + }else{ + // Client.currentGui.close() + this.isInMuseum = false + + this.lastClosed = Date.now() + } + } + + if(!(this.soopyGui.ctGui.isOpen() || this.guiOpenTickThing) && Date.now()-this.lastClosed > 1000){ + this.weaponsProgressBar.setProgress(0) + this.armourProgressBar.setProgress(0) + this.raritiesProgressBar.setProgress(0) + } + + if(this.checkMenu){ + if(Player.getOpenedInventory().getName() === "Your Museum" && !this.isInMuseum){ + this.isInMuseum = true + + this.soopyGui.open() + this.guiOpenTickThing = true + } + this.checkMenu = false + } + + if(this.dontOpen > 0){ + Client.currentGui.close() + } + } +} + +export default MuseumGui;
\ No newline at end of file diff --git a/features/changeLogGUI/index.js b/features/changeLogGUI/index.js index f6595b0..daecf96 100644 --- a/features/changeLogGUI/index.js +++ b/features/changeLogGUI/index.js @@ -24,6 +24,34 @@ class ChangeLogGui extends Feature { this.initVariables() this.ChangelogPage = new ChangelogPage() + + this.latestAnnouncedVersion = this.ChangelogPage.currVersionId + + this.registerEvent("worldLoad", this.worldLoad) + } + + worldLoad(){ + if(!this.FeatureManager.features["globalSettings"]) return + if(!this.FeatureManager.features["globalSettings"].class.notifyNewVersion.getValue()) return + if(this.ChangelogPage.downloadableVersion === -1) return + if(this.latestAnnouncedVersion < this.ChangelogPage.downloadableVersion){ + let version = "" + this.ChangelogPage.changelogData.forEach(data=>{ + + if(this.ChangelogPage.downloadableVersion === data.versionId && this.ChangelogPage.downloadableVersion > this.ChangelogPage.currVersionId){ + //add button to download this version + version = data.version + } + }) + + ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) + ChatLib.chat(" &6New Soopyaddons Version is avalible (" + version + ")") + ChatLib.chat("") + new TextComponent(" &e[CLICK] &7- View changelog and download update").setHover("show_text", "&2Open changelog").setClick("run_command", "/soopyv2 changelog").chat() + ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) + + this.latestAnnouncedVersion = this.ChangelogPage.downloadableVersion + } } initVariables(){ @@ -45,7 +73,7 @@ class ChangelogPage extends GuiPage { this.pages = [this.newPage()] this.changelogData = [] - this.downloadableVersion = 0 + this.downloadableVersion = -1 let changelogTitle = new SoopyTextElement().setText("§0Changelog").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) this.pages[0].addChild(changelogTitle) @@ -92,15 +120,21 @@ This is fine if you trust me to not put a virus in it, but if you dont you shoul this.currVersionId = metadata.versionId this.finaliseLoading() + + this.loadChangeLog() } - onOpen(){ - new Thread(()=>{ - let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/changelog.json")) + loadChangeLog(){ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/changelog.json")) + + this.changelogData = data.changelog.reverse() - this.changelogData = data.changelog.reverse() + this.downloadableVersion = data.downloadableVersion + } - this.downloadableVersion = data.downloadableVersion + onOpen(){ + new Thread(()=>{ + this.loadChangeLog() this.updateText() }).start() @@ -140,7 +174,7 @@ This is fine if you trust me to not put a virus in it, but if you dont you shoul this.progressBar.setProgress(0.75) FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2")) - + this.progressBar.setProgress(0.9) new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/SoopyV2").renameTo(new File("./config/ChatTriggers/modules/SoopyV2")) diff --git a/features/cosmetics/cosmetic.js b/features/cosmetics/cosmetic.js new file mode 100644 index 0000000..4b52fa8 --- /dev/null +++ b/features/cosmetics/cosmetic.js @@ -0,0 +1,20 @@ +class Cosmetic{ + constructor(player, parent){ + /** + * @type {PlayerMP | Player} + */ + this.player = player + + this.parent = parent + } + + onRender(){ + //override + } + + onTick(){ + //override + } +} + +export default Cosmetic;
\ No newline at end of file diff --git a/features/cosmetics/dragonWings.js b/features/cosmetics/dragonWings.js new file mode 100644 index 0000000..d9e8a1c --- /dev/null +++ b/features/cosmetics/dragonWings.js @@ -0,0 +1,291 @@ +import Cosmetic from "./cosmetic"; + +const ModelDragon = Java.type("net.minecraft.client.model.ModelDragon") +const ResourceLocation = Java.type("net.minecraft.util.ResourceLocation") + +const GlStateManager = Java.type("net.minecraft.client.renderer.GlStateManager"); + +const FACING = Java.type("net.minecraft.block.BlockDirectional").field_176387_N +let dragon = new ModelDragon(0) //too lazy to make my own model so i just yoink it from modelDragon lmfao +let textures = new ResourceLocation("textures/entity/enderdragon/dragon.png") +let wing = getField(dragon, "field_78225_k") +let wingTip = getField(dragon, "field_78222_l") + +class DragonWings extends Cosmetic { + constructor(player, parent) { + super(player, parent); + + this.settings = this.parent.getPlayerCosmeticSettings(this.player, "dragon_wings") + + this.animOffset = Math.random()*20*Math.PI + this.lastRender = Date.now() + + this.lastFlapSound = this.animOffset + } + onRender(ticks){ + + if(this.settings.disableWithNoChestplate && this.player.getPlayer().func_82169_q(2) === null && !(this.player === Player && Client.getMinecraft().field_71474_y.field_74320_O === 0)){ + return + } + + if(this.player.getPlayer().func_98034_c(Player.getPlayer())){ + return + } + + if(!this.parent.firstPersonVisable.getValue() && this.player === Player && Client.getMinecraft().field_71474_y.field_74320_O === 0){ + return + } + + // return; + // wing.func_78785_a(1) + + let timeSince = (Date.now()-this.lastRender)/1000 + this.lastRender = Date.now() + + let rotation = this.player.getPlayer().field_70761_aq+(this.player.getPlayer().field_70761_aq-this.player.getPlayer().field_70760_ar)*ticks + + let horisontalSpeed = Math.sqrt((this.player.getPlayer().field_70165_t-this.player.getPlayer().field_70142_S)**2+(this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U)**2) + + let verticleSpeed = this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T + + this.animOffset += Math.min(1, horisontalSpeed)*10*timeSince+1*timeSince + + let flapAmountMultiplyerNoEnd = 1 + let flapAmountMultiplyer = 1 + + let wingEndOffsetThing = 0 + + flapAmountMultiplyerNoEnd += Math.min(5, (horisontalSpeed*5)) + let flapMainOffsetThing = 0 + + let wingBackAmount = 0 + + if(this.player.getPlayer().field_70172_ad > 0){ //damage tick + this.animOffset += 5*timeSince + } + + + // if((this.player === Player &&this.player.getPlayer().field_71075_bZ.field_75100_b) || (this.player !== Player && Math.abs(verticleSpeed)<0.2 && !this.player.getPlayer().field_70122_E)){//playerCapabilities.isFlying + if((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E){ //flying + + if(this.animOffset-this.lastFlapSound > 2*Math.PI){ + + let dist = Math.sqrt((Player.getX()-this.player.getX())**2+(Player.getY()-this.player.getY())**2+(Player.getZ()-this.player.getZ())**2)+1 + + World.playSound("mob.enderdragon.wings", (this.settings.scale*15)*Math.min(1, 50/(dist*dist)), 1) + this.lastFlapSound = this.animOffset-this.animOffset%(Math.PI*2) + } + + this.animOffset += 5*timeSince //flap in mid air + + flapAmountMultiplyer *= 1.75 //flap harder + + if(this.player === Player && Client.getMinecraft().field_71474_y.field_74320_O === 0){ + if(!this.parent.lessFirstPersonVisable.getValue()){ + flapAmountMultiplyerNoEnd += 0.4 + flapMainOffsetThing = 0.3 + } + }else{ + flapAmountMultiplyer *= 1.25 + flapAmountMultiplyer *= 0.9 + flapMainOffsetThing = 0.1 + wingEndOffsetThing+= -0.1 + } + + wingEndOffsetThing += -0.75 + + if(verticleSpeed > 0){ + this.animOffset += verticleSpeed*25*timeSince //flap when flying upwards + } + }else{ + if(this.lastFlapSound < this.animOffset-this.animOffset%(Math.PI*2)){ + this.lastFlapSound = this.animOffset-this.animOffset%(Math.PI*2) + } + } + if(verticleSpeed < -0.5){ + wingBackAmount = Math.min(1, (verticleSpeed+0.5)*-1.5) //lift wings back further ur falling + + this.animOffset += (verticleSpeed+0.5)*-3*timeSince + } + + GlStateManager.func_179094_E(); // pushMatrix + + if(this.player !== Player){ + Tessellator.translate( + (this.player.getPlayer().field_70142_S + (this.player.getPlayer().field_70165_t-this.player.getPlayer().field_70142_S) * ticks) - (Player.getPlayer().field_70142_S + (Player.getPlayer().field_70165_t-Player.getPlayer().field_70142_S) * ticks), + (this.player.getPlayer().field_70137_T + (this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T) * ticks) - (Player.getPlayer().field_70137_T + (Player.getPlayer().field_70163_u-Player.getPlayer().field_70137_T) * ticks), + (this.player.getPlayer().field_70136_U + (this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U) * ticks) - (Player.getPlayer().field_70136_U + (Player.getPlayer().field_70161_v-Player.getPlayer().field_70136_U) * ticks)) + } + + Client.getMinecraft().field_71446_o.func_110577_a(textures) //bind texture + + if(this.player.getPlayer().field_70154_o){ + rotation = this.player.getPlayer().field_70759_as+(this.player.getPlayer().field_70759_as-this.player.getPlayer().field_70758_at)*ticks + } + if(!this.player.getPlayer().func_70608_bn()){ //dont rotate when in bed + Tessellator.rotate((180-rotation),0,1,0) + + Tessellator.translate(0,1.2,0.1) + + if(this.player.getPlayer().func_70093_af()){ //isSneaking + Tessellator.translate(0, -0.125,0) + Tessellator.rotate(-20, 1,0,0) + if(this.player === Player && Client.getMinecraft().field_71474_y.field_74320_O === 0){}else{ + Tessellator.translate(0, -0.125,0) + } + } + + if(this.player === Player && Client.getMinecraft().field_71474_y.field_74320_O === 0){ + //Make wings less scuffed when in first person looking down/up + Tessellator.translate(0, 0.25, 0.003*(this.player.getPitch())) + } + } + + + //Higher = more elytra like + wing.field_78796_g = 0.25; //rotateAngleY + + let shouldStandingStillWingThing = false + + let changeStandingStillWingThing = 0 + + if(horisontalSpeed < 0.01){ + if(!((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E)){ //not flying + let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) + if(amt < 1*Math.PI){ + if(amt > 0.65*Math.PI && (2*Math.PI+this.animOffset)-this.lastFlapSound > 2*Math.PI){ + + let dist = Math.sqrt((Player.getX()-this.player.getX())**2+(Player.getY()-this.player.getY())**2+(Player.getZ()-this.player.getZ())**2)+1 + + World.playSound("mob.enderdragon.wings", (this.settings.scale*15)*Math.min(1, 50/(dist*dist)), 1) + this.lastFlapSound = 2*Math.PI+(this.animOffset)-this.animOffset%(Math.PI*2) + } + this.animOffset += 2*timeSince*Math.min(1,(amt/(1*Math.PI))*2) + + flapAmountMultiplyer += (amt/(1*Math.PI))/2 + }else if(amt < 2*Math.PI){ + this.animOffset += 2*timeSince*Math.min(1,(1-(amt/(1*Math.PI)-1))*2) + + flapAmountMultiplyer += (1-(amt/(1*Math.PI)-1))/2 + } + } + if(this.player.getPlayer().func_70093_af()){ //isSneaking + if(this.player.getPlayer().field_70125_A > 20){ + shouldStandingStillWingThing = true + Tessellator.translate(0, 0,0.1) + changeStandingStillWingThing = Math.max(0,this.player.getPlayer().field_70125_A/600) + } + } + } + + if(shouldStandingStillWingThing){ + wing.field_78796_g = 0.25+(changeStandingStillWingThing)*3 + } + + if(this.player.getPlayer().func_70608_bn()){ //player in bed + + try{ //try catch incase no bed at that location + let facing = World.getWorld().func_180495_p(this.player.getPlayer().field_71081_bT).func_177229_b(FACING).func_176736_b() //0-3 is S-W-N-E + + let rotation = 0 + switch(facing){ + case 0: + rotation = 180 + Tessellator.translate(0, 0,-0.5) + break + case 1: + rotation = 90 + Tessellator.translate(0.5, 0,0 |
