diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-04-09 18:20:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 18:20:58 +0200 |
commit | 85138c09082541e0b9c8b9b50c9e7afce2e03101 (patch) | |
tree | 6327639d292c2b870ae7e92c86b9f61b545bfb85 /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 6767e9ed500526f931b5bd19da11c7631ca19b6b (diff) | |
download | skyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.tar.gz skyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.tar.bz2 skyhanni-85138c09082541e0b9c8b9b50c9e7afce2e03101.zip |
Fix: Item Render in Next Contest Overlay (#1403)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 4e8f41757..6aa9c5479 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned import at.hannibal2.skyhanni.utils.shader.ShaderManager -import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils import io.github.moulberry.notenoughupdates.util.Utils +import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer import net.minecraft.client.gui.Gui @@ -558,12 +558,15 @@ object RenderUtils { */ fun Position.renderSingleLineWithItems( list: List<Any?>, - itemScale: Double = NEUItems.itemFontSize, posLabel: String ) { if (list.isEmpty()) return - val longestX = renderLine(list, 0, itemScale) - GuiEditManager.add(this, posLabel, longestX, 10) + renderRenderables( + listOf( + Renderable.horizontalContainer( + list.mapNotNull { Renderable.fromAny(it) } + )), posLabel = posLabel) + // TODO Future write that better } private fun Position.renderLine(line: List<Any?>, offsetY: Int, itemScale: Double = NEUItems.itemFontSize): Int { @@ -584,13 +587,17 @@ object RenderUtils { return offsetX } - fun MutableList<Any>.addItemIcon(item: ItemStack, highlight: Boolean = false) { + fun MutableList<Any>.addItemIcon( + item: ItemStack, + highlight: Boolean = false, + scale: Double = NEUItems.itemFontSize + ) { try { if (highlight) { // Hack to add enchant glint, like Hypixel does it item.addEnchantment(Enchantment.protection, 0) } - add(item) + add(Renderable.itemStack(item, scale)) } catch (e: NullPointerException) { ErrorManager.logErrorWithData( e, "Add item icon to renderable list", |