diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/ColorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/ColorConfig.java index 2e28488e82ed..20f9282542b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/ColorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/ColorConfig.java @@ -7,37 +7,37 @@ public class ColorConfig { @Expose - @ConfigOption(name = "bg colr", desc = "") + @ConfigOption(name = "Background", desc = "Color of the GUI background.") @ConfigEditorColour public String backgroundColor = "0:127:0:0:0"; @Expose - @ConfigOption(name = "equip colr", desc = "") + @ConfigOption(name = "Equipped", desc = "Color of the currently equipped wardrobe slot.") @ConfigEditorColour public String equippedColor = "0:127:85:255:85"; @Expose - @ConfigOption(name = "fav colr", desc = "") + @ConfigOption(name = "Favorite", desc = "Color of the wardrobe slots that have been added as favorites.") @ConfigEditorColour public String favoriteColor = "0:127:255:85:85"; @Expose - @ConfigOption(name = "sam pag colr", desc = "") + @ConfigOption(name = "Same Page", desc = "Color of wardrobe slots in the same page.") @ConfigEditorColour public String samePageColor = "0:127:94:108:255"; @Expose - @ConfigOption(name = "othr pge colr", desc = "") + @ConfigOption(name = "Other Page", desc = "Color of wardrobe slots in another page.") @ConfigEditorColour public String otherPageColor = "0:127:0:0:0"; @Expose - @ConfigOption(name = "top bordr colr", desc = "") + @ConfigOption(name = "Top Outline", desc = "Color of the top of the outline when hovered.") @ConfigEditorColour public String topBorderColor = "0:255:255:200:0"; @Expose - @ConfigOption(name = "botm bordr colr", desc = "") + @ConfigOption(name = "Bottom Outline", desc = "Color of the bottom of the outline when hovered.") @ConfigEditorColour public String bottomBorderColor = "0:255:255:0:0"; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/CustomWardrobeConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/CustomWardrobeConfig.java index ead30839ba5c..d991f4c4fb89 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/CustomWardrobeConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/CustomWardrobeConfig.java @@ -9,38 +9,40 @@ public class CustomWardrobeConfig { @Expose - @ConfigOption(name = "enble", desc = "") + @ConfigOption(name = "Enable", desc = "Enables the Custom Wardrobe GUI.") @ConfigEditorBoolean @FeatureToggle public boolean enabled = true; @Expose - @ConfigOption(name = "is lok mose", desc = "") + @ConfigOption(name = "Follow mouse", desc = "Players follow the movement of the mouse.") @ConfigEditorBoolean public boolean eyesFollowMouse = true; @Expose - @ConfigOption(name = "no emty", desc = "") + @ConfigOption(name = "Hide Empty Slots", desc = "Hides wardrobe slots with no armor.") @ConfigEditorBoolean public boolean hideEmptySlots = false; @Expose - @ConfigOption(name = "onli favs", desc = "") + @ConfigOption(name = "Hide Locked Slots", desc = "Hides locked wardrobe slots.") @ConfigEditorBoolean + public boolean hideLockedSlots = false; + public boolean onlyFavorites = false; @Expose - @ConfigOption(name = "estimdtaded valu", desc = "") + @ConfigOption(name = "Estimated Value", desc = "Show a §2$ §7sign you can hover to see the wardrobe slot value.") @ConfigEditorBoolean public boolean estimatedValue = true; @Expose - @ConfigOption(name = "colr", desc = "") + @ConfigOption(name = "Colors", desc = "Change the color settings.") @Accordion public ColorConfig color = new ColorConfig(); @Expose - @ConfigOption(name = "spac", desc = "") + @ConfigOption(name = "Spacing", desc = "") @Accordion public SpacingConfig spacing = new SpacingConfig(); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/SpacingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/SpacingConfig.java index 53b3d38eb72f..c970fac17e53 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/SpacingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/customwardrobe/SpacingConfig.java @@ -7,7 +7,7 @@ public class SpacingConfig { @Expose - @ConfigOption(name = "globl skal", desc = "") + @ConfigOption(name = "Global Scale", desc = "Controls the scale of the entirety of the wardrobe.") @ConfigEditorSlider( minValue = 30, maxValue = 200, @@ -16,7 +16,7 @@ public class SpacingConfig { public int globalScale = 100; @Expose - @ConfigOption(name = "bordr thicc", desc = "") + @ConfigOption(name = "Outline Thickness", desc = "How thick the outline of the hovered slot is.") @ConfigEditorSlider( minValue = 1, maxValue = 15, @@ -25,7 +25,7 @@ public class SpacingConfig { public int outlineThickness = 5; @Expose - @ConfigOption(name = "bordr blrrr", desc = "") + @ConfigOption(name = "Outline Blur", desc = "Amount of blur of the outline.") @ConfigEditorSlider( minValue = 0f, maxValue = 1f, @@ -34,7 +34,7 @@ public class SpacingConfig { public float outlineBlur = 0.5f; @Expose - @ConfigOption(name = "slot widt", desc = "") + @ConfigOption(name = "Slot Width", desc = "Width of the wardrobe slots.") @ConfigEditorSlider( minValue = 30, maxValue = 100, @@ -43,7 +43,7 @@ public class SpacingConfig { public int slotWidth = 75; @Expose - @ConfigOption(name = "slot haiiight", desc = "") + @ConfigOption(name = "Slot Height", desc = "Height of the wardrobe slots.") @ConfigEditorSlider( minValue = 60, maxValue = 200, @@ -52,7 +52,7 @@ public class SpacingConfig { public int slotHeight = 140; @Expose - @ConfigOption(name = "people big or nuhuh", desc = "") + @ConfigOption(name = "Player Scale", desc = "Scale of the players.") @ConfigEditorSlider( minValue = 0, maxValue = 100, @@ -61,7 +61,7 @@ public class SpacingConfig { public int playerScale = 75; @Expose - @ConfigOption(name = "no mor people in ma row >:(", desc = "") + @ConfigOption(name = "Slots per Row", desc = "Max amount of wardrobe slots per row.") @ConfigEditorSlider( minValue = 5, maxValue = 18, @@ -70,7 +70,7 @@ public class SpacingConfig { public int maxPlayersPerRow = 9; @Expose - @ConfigOption(name = "how wide bwetween pweopole", desc = "") + @ConfigOption(name = "Slots Horizontal Spacing", desc = "How much space horizontally between wardrobe slots.") @ConfigEditorSlider( minValue = 1, maxValue = 20, @@ -79,7 +79,7 @@ public class SpacingConfig { public int horizontalSpacing = 3; @Expose - @ConfigOption(name = "how tall bwetween pweopole", desc = "") + @ConfigOption(name = "Slots Vertical Spacing", desc = "How much space vertically between wardrobe slots.") @ConfigEditorSlider( minValue = 1, maxValue = 20, @@ -88,7 +88,7 @@ public class SpacingConfig { public int verticalSpacing = 3; @Expose - @ConfigOption(name = "how tall between people and button!", desc = "") + @ConfigOption(name = "Slots & Buttons Spacing", desc = "How much vertical space there is between wardrobe slots and the buttons.") @ConfigEditorSlider( minValue = 1, maxValue = 40, @@ -97,7 +97,7 @@ public class SpacingConfig { public int buttonSlotsVerticalSpacing = 10; @Expose - @ConfigOption(name = "how wide between button!", desc = "") + @ConfigOption(name = "Button Horizontal Spacing", desc = "How much space horizontally between buttons.") @ConfigEditorSlider( minValue = 1, maxValue = 40, @@ -106,7 +106,7 @@ public class SpacingConfig { public int buttonHorizontalSpacing = 10; @Expose - @ConfigOption(name = "how tall between button!", desc = "") + @ConfigOption(name = "Button Vertical Spacing", desc = "How much space vertically between buttons.") @ConfigEditorSlider( minValue = 1, maxValue = 40, @@ -115,7 +115,7 @@ public class SpacingConfig { public int buttonVerticalSpacing = 10; @Expose - @ConfigOption(name = "how thicc button?", desc = "") + @ConfigOption(name = "Button Width", desc = "Width of the buttons.") @ConfigEditorSlider( minValue = 1, maxValue = 60, @@ -124,7 +124,7 @@ public class SpacingConfig { public int buttonWidth = 50; @Expose - @ConfigOption(name = "how tal button?", desc = "") + @ConfigOption(name = "Button Height", desc = "Height of the buttons.") @ConfigEditorSlider( minValue = 1, maxValue = 60, diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt index bd3217717a9d..31f65bcc4117 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/CustomWardrobe.kt @@ -48,23 +48,19 @@ class CustomWardrobe { private val config get() = SkyHanniMod.feature.inventory.customWardrobe - private var display = emptyList>() private var displayRenderable: Renderable? = null private var buttonsRenderable: Renderable? = null - private var tempToggleShowOverlay = true - - private var hoveredSlot: Int? = null + private var editMode = false @SubscribeEvent fun onGuiRender(event: GuiContainerEvent.BeforeDraw) { if (!isEnabled()) return - if (tempToggleShowOverlay) event.cancel() + event.cancel() } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { if (!isEnabled()) return - if (!tempToggleShowOverlay) return if (displayRenderable == null) { update() @@ -81,10 +77,14 @@ class CustomWardrobe { config.spacing.buttonSlotsVerticalSpacing, horizontalAlign = HorizontalAlignment.CENTER ), - Renderable.string( - "§7SkyHanni", - horizontalAlign = HorizontalAlignment.RIGHT, - verticalAlign = VerticalAlignment.BOTTOM + Renderable.clickable( + Renderable.string( + "§7SkyHanni", + horizontalAlign = HorizontalAlignment.RIGHT, + verticalAlign = VerticalAlignment.BOTTOM, + scale = 1.0 * (config.spacing.globalScale / 100.0) + ), + onClick = { config::spacing.jumpToEditor() } ), blockBottomHover = false ), @@ -101,7 +101,7 @@ class CustomWardrobe { ))).toInt() config.spacing.globalScale = newScale ChatUtils.clickableUserError( - "Auto-set your Global Scale in custom wardrobe, as it was too tall/wide", + "Auto-set your Global Scale in custom wardrobe, as it was too tall/wide.", onClick = { config::spacing.jumpToEditor() } ) update() @@ -111,7 +111,8 @@ class CustomWardrobe { val (width, height) = fullRenderable.width to fullRenderable.height val pos = Position((gui.width - width) / 2, (gui.height - height) / 2) - pos.renderRenderables(listOf(fullRenderable), posLabel = "Wardrobe Overlay", addToGuiManager = false) + pos.renderRenderables(listOf(fullRenderable), posLabel = "Custom Wardrobe", addToGuiManager = false) + //pos.renderRenderable(fullRenderable, posLabel = "Wardrobe Overlay", addToGuiManager = false) } @SubscribeEvent @@ -142,29 +143,24 @@ class CustomWardrobe { } private fun createRenderables(): Renderable { - var list = WardrobeAPI.wardrobeSlots.filter { !it.locked } + var list = WardrobeAPI.wardrobeSlots + + var wardrobeWarning = "" - var wardrobeWarning = false - var wardrobeWarningText = "" + if (list.isEmpty()) wardrobeWarning = "§cYour wardrobe is empty :(" - if (list.isEmpty()) { - wardrobeWarning = true - wardrobeWarningText = "§cYour wardrobe is empty :(" + if (config.hideLockedSlots) { + list = list.filter { !it.locked } + if (list.isEmpty()) wardrobeWarning = "§cAll your slots are locked? Somehow" } if (config.hideEmptySlots) { list = list.filter { !it.isEmpty() } - if (list.isEmpty()) { - wardrobeWarning = true - wardrobeWarningText = "§cAll slots are empty :(" - } + if (list.isEmpty()) wardrobeWarning = "§cAll slots are empty :(" } if (config.onlyFavorites) { list = list.filter { it.favorite || it.isCurrentSlot() } - if (list.isEmpty()) { - wardrobeWarning = true - wardrobeWarningText = "§cDidn't set any favorites" - } + if (list.isEmpty()) wardrobeWarning = "§cDidn't set any favorites" } val totalPlayers = list.size @@ -174,13 +170,14 @@ class CustomWardrobe { val playerWidth = (containerWidth * config.spacing.playerScale) / 100.0 val horizontalSpacing = (config.spacing.horizontalSpacing * (config.spacing.globalScale / 100.0)).toInt() val verticalSpacing = (config.spacing.verticalSpacing * (config.spacing.globalScale / 100.0)).toInt() + val wardrobeWarningScale = 3.0 * (config.spacing.globalScale / 100.0) val rows = ceil(totalPlayers.toDouble() / maxPlayersPerRow).toInt() - if (wardrobeWarning) { + if (wardrobeWarning.isNotEmpty()) { val warningRenderable = Renderable.string( - wardrobeWarningText, - 3 * (config.spacing.globalScale / 100.0), + wardrobeWarning, + wardrobeWarningScale, horizontalAlign = HorizontalAlignment.CENTER ) return warningRenderable @@ -235,9 +232,6 @@ class CustomWardrobe { borderOutlineBlur = config.spacing.outlineBlur, onClick = { clickWardrobeSlot(wardrobeSlot) - }, - onHover = { - hoveredSlot = wardrobeSlot.id } ) @@ -283,8 +277,7 @@ class CustomWardrobe { private fun reset() { inCustomWardrobe = false - tempToggleShowOverlay = true - display = mutableListOf() + editMode = false displayRenderable = null buttonsRenderable = null } @@ -315,7 +308,7 @@ class CustomWardrobe { val onlyFavoriteButton = createLabeledButton( "§eFavorite", - color = if (config.onlyFavorites) greenColor else redColor, + hoveredColor = if (config.onlyFavorites) greenColor else redColor, onClick = { config.onlyFavorites = !config.onlyFavorites update() @@ -326,7 +319,7 @@ class CustomWardrobe { "§bEdit", onClick = { reset() - tempToggleShowOverlay = false + editMode = true } ) @@ -348,18 +341,19 @@ class CustomWardrobe { private fun addSlotHoverableButtons(wardrobeSlot: WardrobeAPI.WardrobeSlot): Renderable { val list = mutableListOf() + val textScale = 1.5 * (config.spacing.globalScale / 100.0) list.add( Renderable.clickable( Renderable.hoverable( Renderable.string( (if (wardrobeSlot.favorite) "§c" else "§7") + "❤", - 1.5, + scale = textScale, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER ), Renderable.string( (if (wardrobeSlot.favorite) "§4" else "§8") + "❤", - 1.5, + scale = textScale, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER ) @@ -371,21 +365,17 @@ class CustomWardrobe { ) ) - if (config.estimatedValue) { + if (config.estimatedValue && !wardrobeSlot.isEmpty()) { + val lore = createWardrobePriceLore(wardrobeSlot) list.add( - if (wardrobeSlot.getArmor().any { it != null }) { - val lore = createWardrobePriceLore(wardrobeSlot) - Renderable.hoverTips( - Renderable.string( - "§2$", - 1.5, - horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER - ), lore - ) - } else { - Renderable.placeholder(0, 0) - } + Renderable.hoverTips( + Renderable.string( + "§2$", + scale = textScale, + horizontalAlign = HorizontalAlignment.CENTER, + verticalAlign = VerticalAlignment.CENTER + ), lore + ) ) } @@ -394,11 +384,13 @@ class CustomWardrobe { private fun createLabeledButton( text: String, - color: Color = Color(130, 130, 130, 200), + hoveredColor: Color = Color(130, 130, 130, 200), + unhoveredColor: Color = hoveredColor.darker(0.57), onClick: () -> Unit ): Renderable { val buttonWidth = (config.spacing.buttonWidth * (config.spacing.globalScale / 100.0)).toInt() val buttonHeight = (config.spacing.buttonHeight * (config.spacing.globalScale / 100.0)).toInt() + val textScale = 1.0 * (config.spacing.globalScale / 100.0) val renderable = Renderable.hoverable( Renderable.drawInsideRoundedRectWithOutline( @@ -410,16 +402,16 @@ class CustomWardrobe { Renderable.string( text, horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER + verticalAlign = VerticalAlignment.CENTER, + scale = textScale ), false, ), - color, + hoveredColor, padding = 0, topOutlineColor = config.color.topBorderColor.toChromaColorInt(), bottomOutlineColor = config.color.bottomBorderColor.toChromaColorInt(), borderOutlineThickness = 2, - blur = 0.5f, horizontalAlign = HorizontalAlignment.CENTER ), Renderable.drawInsideRoundedRect( @@ -428,10 +420,11 @@ class CustomWardrobe { Renderable.string( text, horizontalAlign = HorizontalAlignment.CENTER, - verticalAlign = VerticalAlignment.CENTER + verticalAlign = VerticalAlignment.CENTER, + scale = textScale ), ), - color.darker(0.57), + unhoveredColor.darker(0.57), padding = 0, horizontalAlign = HorizontalAlignment.CENTER ) @@ -533,5 +526,5 @@ class CustomWardrobe { return Color(color.withAlpha(170), true) } - fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && inWardrobe() + fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && inWardrobe() && !editMode } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt index 5c4fc1bc9129..8c881a178307 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/EstimatedWardrobePrice.kt @@ -33,7 +33,6 @@ class EstimatedWardrobePrice { var index = 3 tooltip.add(index++, "") - tooltip.add(index++, "§aEstimated Armor Value:") lore.forEach { tooltip.add(index++, it) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt index f4afd0515823..f68f39d3790d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt @@ -22,6 +22,7 @@ import net.minecraft.init.Items import net.minecraft.item.EnumDyeColor import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.min import kotlin.time.Duration.Companion.milliseconds object WardrobeAPI { @@ -59,7 +60,7 @@ object WardrobeAPI { WardrobeData( id, (1..4).associateWith { null }.toMutableMap(), - locked = false, + locked = true, favorite = false, ) } @@ -148,7 +149,7 @@ object WardrobeAPI { } private fun getWardrobeItem(itemStack: ItemStack?) = - if (itemStack?.item == ItemStack(Blocks.stained_glass_pane).item) null else itemStack + if (itemStack?.item == ItemStack(Blocks.stained_glass_pane).item || itemStack == null) null else itemStack private fun getWardrobeSlotFromId(id: Int?) = wardrobeSlots.find { it.id == currentWardrobeSlot } @@ -180,36 +181,61 @@ object WardrobeAPI { } if (!inWardrobe) return if (currentPage == null) return - var foundCurrentSlot = false val itemsList = event.inventoryItems - val oldData = wardrobeSlots.map { it.getData() } - lastWardrobeUpdate = SimpleTimeMark.now() - DelayedRun.runDelayed(500.milliseconds) { - if (lastWardrobeUpdate.passedSince() < 550.milliseconds) return@runDelayed - - for (slot in wardrobeSlots.filter { it.isInCurrentPage() }) { - slot.helmet = getWardrobeItem(itemsList[slot.helmetSlot]) - slot.chestplate = getWardrobeItem(itemsList[slot.chestplateSlot]) - slot.leggings = getWardrobeItem(itemsList[slot.leggingsSlot]) - slot.boots = getWardrobeItem(itemsList[slot.bootsSlot]) - if (equippedSlotPattern.matches(itemsList[slot.inventorySlot]?.name)) { - currentWardrobeSlot = slot.id - foundCurrentSlot = true + val allGrayDye = wardrobeSlots.filter { it.isInCurrentPage() }.all { + itemsList[it.inventorySlot]?.itemDamage == EnumDyeColor.GRAY.dyeDamage + } + + val allSlotsEmpty = wardrobeSlots.filter { it.isInCurrentPage() }.all { + getWardrobeItem(itemsList[it.helmetSlot]) == null && getWardrobeItem(itemsList[it.chestplateSlot]) == null && + getWardrobeItem(itemsList[it.leggingsSlot]) == null && getWardrobeItem(itemsList[it.bootsSlot]) == null + } + + if (allGrayDye) { + if (allSlotsEmpty) { + wardrobeSlots.filter { it.isInCurrentPage() }.forEach { + it.helmet = null + it.chestplate = null + it.leggings = null + it.boots = null } - slot.locked = (itemsList[slot.inventorySlot] == ItemStack(Items.dye, EnumDyeColor.RED.dyeDamage)) - if (slot.locked) wardrobeSlots.forEach { if (it.id > slot.id) it.locked = true } + } else return + } + + var foundCurrentSlot = false + val oldData = wardrobeSlots.map { it.getData() } + for (slot in wardrobeSlots.filter { it.isInCurrentPage() }) { + slot.helmet = getWardrobeItem(itemsList[slot.helmetSlot]) + slot.chestplate = getWardrobeItem(itemsList[slot.chestplateSlot]) + slot.leggings = getWardrobeItem(itemsList[slot.leggingsSlot]) + slot.boots = getWardrobeItem(itemsList[slot.bootsSlot]) + if (equippedSlotPattern.matches(itemsList[slot.inventorySlot]?.name)) { + currentWardrobeSlot = slot.id + foundCurrentSlot = true } - if (!foundCurrentSlot && getWardrobeSlotFromId(currentWardrobeSlot)?.page == currentPage) - currentWardrobeSlot = null + slot.locked = (itemsList[slot.inventorySlot] == ItemStack(Items.dye, EnumDyeColor.RED.dyeDamage)) + if (slot.locked) wardrobeSlots.forEach { if (it.id > slot.id) it.locked = true } + } + if (!foundCurrentSlot && getWardrobeSlotFromId(currentWardrobeSlot)?.page == currentPage) { + currentWardrobeSlot = null + } - val newData = wardrobeSlots.map { it.getData() } - if (newData != oldData) { - WardrobeUpdateEvent(newData, oldData).postAndCatch() - ChatUtils.chat("UPDATEDDDD") + val newData = wardrobeSlots.map { it.getData() } + val size = min(oldData.size, newData.size) + + for (i in 0 until size) { + if (i != 0) println("") + println("Wardrobe Slot $i") + for (j in 1 until 5) { + println(" ${oldData[i]?.armor?.get(j)?.name} --> ${newData[i]?.armor?.get(j)?.name}") } } + if (newData != oldData) { + WardrobeUpdateEvent(newData, oldData).postAndCatch() + ChatUtils.chat("UPDATEDDDD") + } } @SubscribeEvent @@ -226,15 +252,24 @@ object WardrobeAPI { add("Current wardrobe slot: $currentWardrobeSlot") wardrobeSlots.forEach { slot -> if (slot.locked) { - add("Slot ${slot.id} is locked") + add( + "Slot ${slot.id} is locked" + + if (slot.favorite) " - Favorite: true" else "" + ) + } else if (slot.isEmpty()) { + add( + "Slot ${slot.id} is empty" + + if (slot.favorite) " - Favorite: true" else "" + ) } else { add( - "Slot ${slot.id} - " + - "Helmet: ${slot.helmet?.name} - " + - "Chestplate: ${slot.chestplate?.name} - " + - "Leggings: ${slot.leggings?.name} - " + - "Boots: ${slot.boots?.name}" + "Slot ${slot.id}" + + if (slot.favorite) " - Favorite: true" else "" ) + if (slot.helmet != null) add(" Helmet: ${slot.helmet?.name}") + if (slot.chestplate != null) add(" Chestplate: ${slot.chestplate?.name}") + if (slot.leggings != null) add(" Leggings: ${slot.leggings?.name}") + if (slot.boots != null) add(" Boots: ${slot.boots?.name}") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index fbfea619350c..ad3eef517ffa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -568,6 +568,20 @@ object RenderUtils { if (addToGuiManager) GuiEditManager.add(this, posLabel, longestX, longestY) } + fun Position.renderRenderable( + renderable: Renderable, + posLabel: String, + addToGuiManager: Boolean = true, + ) { + GlStateManager.pushMatrix() + val (x, y) = transform() + Renderable.withMousePosition(x, y) { + renderable.renderXAligned(0, 0, renderable.width) + } + GlStateManager.popMatrix() + if (addToGuiManager) GuiEditManager.add(this, posLabel, renderable.width, 0) + } + /** * Accepts a list of lines to print. * Each line is a list of things to print. Can print String or ItemStack objects.