diff options
-rw-r--r-- | features/betterGuis/index.js | 10 | ||||
-rw-r--r-- | features/betterGuis/museumGui.js | 39 | ||||
-rw-r--r-- | features/globalSettings/index.js | 2 |
3 files changed, 39 insertions, 12 deletions
diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index d0e7802..ff94c91 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -217,12 +217,12 @@ class BetterGuis extends Feature { Renderer.drawRect(Renderer.color(50, 50, 50), 2, 2, 76, 6); Renderer.drawRect(Renderer.color(255, 0, 0), 2, 2, hpPercent * 76, 6); Renderer.drawRect(Renderer.color(255, 255, 0), 2 + hpPercent * 76, 2, abPercent * 76, 6); - + Renderer.retainTransforms(false); } postGuiRender(x, y, gui) { - if (gui instanceof class net.minecraft.client.gui.inventory.GuiChest) + if (gui instanceof net.minecraft.client.gui.inventory.GuiChest) this.invSearchSoopyGui._render(x, y, 0); } guiMouseClick(x, y, button, gui) { @@ -244,7 +244,7 @@ class BetterGuis extends Feature { } renderSlot(slot, gui, event) { - if (!(gui instanceof class net.minecraft.client.gui.inventory.GuiChest)) return; + if (!(gui instanceof net.minecraft.client.gui.inventory.GuiChest)) return; if (!this.invSearchTextBox.getText()) return; let searchText = this.invSearchTextBox.getText().toLowerCase(); @@ -278,7 +278,7 @@ class BetterGuis extends Feature { } guiClicked(mouseX, mouseY, button, gui, event) { - if (!(gui instanceof class net.minecraft.client.gui.inventory) || button !== 0 || !this.replaceSbMenuClicks.getValue()) return; + if (!(gui instanceof net.minecraft.client.gui.inventory) || button !== 0 || !this.replaceSbMenuClicks.getValue()) return; let hoveredSlot = gui.getSlotUnderMouse(); if (!hoveredSlot) return; @@ -297,7 +297,7 @@ class BetterGuis extends Feature { if (!this.replaceSbMenuClicks.getValue()) return if (Player.getContainer() && Player.getContainer().getName() !== "SkyBlock Menu") { - this.lastWindowId = 0; + this.lastWindowId = 0; return; } if (this.lastWindowId === 0) { diff --git a/features/betterGuis/museumGui.js b/features/betterGuis/museumGui.js index 2e6fb79..06497af 100644 --- a/features/betterGuis/museumGui.js +++ b/features/betterGuis/museumGui.js @@ -14,6 +14,7 @@ import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement" import TextBox from "../../../guimanager/GuiElement/TextBox" import Notification from "../../../guimanager/Notification" import renderLibs from "../../../guimanager/renderLibs" +import { m } from "../../../mappings/mappings" import * as utils from "../../utils/utils" @@ -432,7 +433,28 @@ class MuseumGui { let itempages = ["Weapons", "Armor Sets", "Rarities", "Special Items"] if (itempages.includes(this.replacePage[Player.getContainer().getName().split("➜").pop()])) { let page = this.replacePage[Player.getContainer().getName().split("➜").pop()] - let [currPage, pageNum] = Player.getContainer().getName().includes("/") ? Player.getContainer().getName().split(")")[0].split("(")[1].split("/").map(a => parseInt(a)) : [1, 1] + let currPage = 0 + let pageNum = Player.getContainer().getStackInSlot(4) ? Math.ceil(ChatLib.removeFormatting(Player.getContainer().getStackInSlot(4).getLore().pop().split("/").pop()) / 28) : 0 + + // { + // let item = Player.getContainer().getStackInSlot(45) + // if (item) { + // let lore = item.getLore() + // let lastLine = ChatLib.removeFormatting(lore[lore.length - 1]).trim() + // let num = lastLine.match(/(\d+)$/g) + // currPage = parseInt(num) + 1 + // } + // } + // { + // let item = Player.getContainer().getStackInSlot(53) + // if (item) { + // let lore = item.getLore() + // let lastLine = ChatLib.removeFormatting(lore[lore.length - 1]).trim() + // let num = lastLine.match(/(\d+)$/g) + // currPage = parseInt(num) - 1 + // } + // } + console.log(currPage, pageNum) if (!this.searchText) { if (currPage > 1) { @@ -450,10 +472,12 @@ class MuseumGui { let oldDonateItems = JSON.stringify(this.donateItems) this.donateItems = [] let donateArmorSets = {} - Player.getContainer().getItems().forEach((item, slot) => { - if (!item) return - if (item.getID() === -1) return - item.getLore().forEach(line => { + let slot = 0 + for (let item of Player.getContainer().getItems()) { + if (!item) continue + if (item.getID() === -1) continue + let lore = item.itemStack[m.getTooltip](Player.getPlayer(), false) + for (let line of lore) { if (ChatLib.removeFormatting(line) === "Click to donate item!") { let sb_id = utils.getSBID(item) @@ -483,8 +507,9 @@ class MuseumGui { } } - }) - }) + } + slot++ + } if (oldDonateItems !== JSON.stringify(this.donateItems)) { this.regenDonateItems() } diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index d97da1b..a31631e 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -535,6 +535,8 @@ class GlobalSettings extends Feature { updateItemLores() { if (!this.itemWorth.getValue()) return; + if (!Player.getInventory()) return + let items = [...Player.getInventory().getItems(), ...Player.getContainer().getItems()] items.forEach(i => { |