import { SoopyGui, SoopyRenderEvent } from "../../../guimanager"
import SoopyContentChangeEvent from "../../../guimanager/EventListener/SoopyContentChangeEvent"
import SoopyHoverChangeEvent from "../../../guimanager/EventListener/SoopyHoverChangeEvent"
import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent"
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"
import SoopyOpenGuiEvent from "../../../guimanager/EventListener/SoopyOpenGuiEvent"
import BoxWithText from "../../../guimanager/GuiElement/BoxWithText"
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 SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownElement"
import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"
import TextBox from "../../../guimanager/GuiElement/TextBox"
import Notification from "../../../guimanager/Notification"
import renderLibs from "../../../guimanager/renderLibs"
import * as utils from "../../utils/utils"
const ContainerChest = Java.type("net.minecraft.inventory.ContainerChest")
class MuseumGui {
constructor(){
this.checkMenu = false
this.isInMuseum = false
this.guiOpenTickThing = false
this.dontOpen = 0
this.lastClosed = 0
this.itemsInPages = JSON.parse(FileLib.read("soopyAddonsData","museumItemsCache.json") || "{}") || {}
this.itemsInPagesSaved = true
this.soopyGui = new SoopyGui()
this.soopyGui.optimisedLocations = true
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 = Player.getOpenedInventory().getName() === "Your 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 = ne