From efbb108b505714ffe64bbf9a2d81d24aa95ab66b Mon Sep 17 00:00:00 2001 From: Julian Chang Date: Tue, 1 Dec 2026 13:44:58 -0500 Subject: [PATCH 1/3] fix(api): restore PolyItemIcon for binary compatibility --- .../oneconfig/api/ui/v1/item/PolyItemIcon.kt | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt diff --git a/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt new file mode 100644 index 000000000..d8e8f11bc --- /dev/null +++ b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt @@ -0,0 +1,58 @@ +package org.polyfrost.oneconfig.api.ui.v1.item + +import androidx.compose.runtime.Composable +import net.minecraft.world.item.Item +import net.minecraft.world.item.ItemStack +import org.polyfrost.compose.composables.NodeCanvas +import org.polyfrost.compose.composables.PolyModifier +import org.polyfrost.compose.composables.size +import org.polyfrost.compose.minecraft.mc.NodeMcItemIcon +import org.polyfrost.compose.render.PolyColor +import org.polyfrost.oneconfig.internal.ui.components.item.MinecraftItemCatalogService + +/** Draws the item identified by its registry ID, or a placeholder while it is unavailable. */ +@Deprecated("Use NodeMcItemIcon from PolyCompose") +@Composable +fun PolyItemIcon( + id: String, + size: Float = 16f, + modifier: PolyModifier = PolyModifier, + placeholderColor: PolyColor = PolyColor(0xFFAAAAAA.toInt()), +) { + val item = MinecraftItemCatalogService.item(id) + if (item != null) { + NodeMcItemIcon(item, size, modifier) + return + } + NodeCanvas(modifier.size(size, size)) { x, y, w, h -> + rectStroke(x, y, w, h, placeholderColor, strokeWidth = 1f, radius = 1f) + line(x, y, x + w, y + h, placeholderColor, strokeWidth = 1f) + } +} + +/** Draws the default icon for [item]. */ +@Deprecated("Use NodeMcItemIcon from PolyCompose", ReplaceWith("NodeMcItemIcon(item, size, modifier)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon")) +@Composable +fun PolyItemIcon(item: Item, size: Float = 16f, modifier: PolyModifier = PolyModifier) { + NodeMcItemIcon(item, size, modifier) +} + +/** + * Draws a live stack including its optional count, durability, and cooldown decorations. + * + * @param countOverride text shown instead of the stack count, or `null` to show the normal vanilla count + */ +@Deprecated( + "Use NodeMcItemIcon from PolyCompose", + ReplaceWith("NodeMcItemIcon(stack, size, modifier, decorations, countOverride)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon"), +) +@Composable +fun PolyItemIcon( + stack: ItemStack, + size: Float = 16f, + modifier: PolyModifier = PolyModifier, + decorations: Boolean = true, + countOverride: String? = null, +) { + NodeMcItemIcon(stack, size, modifier, decorations, countOverride) +} From 7c28b66ab97ae8ada71a73adbe8e077698146bae Mon Sep 17 00:00:00 2001 From: Julian Chang Date: Tue, 1 Dec 2026 13:49:50 -0500 Subject: [PATCH 2/3] fix(api): hide restored PolyItemIcon overloads, add changelog entry --- CHANGELOG.md | 5 +++++ .../polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f35a699c2..d741faf9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to OneConfig are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- The mod menu no longer closes with a rendering error when a mod made for an older OneConfig draws item icons, such as Mint + ## [1.10.1] - 2026-12-01 ### Fixed diff --git a/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt index d8e8f11bc..8fd92b344 100644 --- a/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt +++ b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt @@ -11,7 +11,7 @@ import org.polyfrost.compose.render.PolyColor import org.polyfrost.oneconfig.internal.ui.components.item.MinecraftItemCatalogService /** Draws the item identified by its registry ID, or a placeholder while it is unavailable. */ -@Deprecated("Use NodeMcItemIcon from PolyCompose") +@Deprecated("Use NodeMcItemIcon from PolyCompose", level = DeprecationLevel.HIDDEN) @Composable fun PolyItemIcon( id: String, @@ -31,7 +31,11 @@ fun PolyItemIcon( } /** Draws the default icon for [item]. */ -@Deprecated("Use NodeMcItemIcon from PolyCompose", ReplaceWith("NodeMcItemIcon(item, size, modifier)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon")) +@Deprecated( + "Use NodeMcItemIcon from PolyCompose", + ReplaceWith("NodeMcItemIcon(item, size, modifier)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon"), + DeprecationLevel.HIDDEN, +) @Composable fun PolyItemIcon(item: Item, size: Float = 16f, modifier: PolyModifier = PolyModifier) { NodeMcItemIcon(item, size, modifier) @@ -45,6 +49,7 @@ fun PolyItemIcon(item: Item, size: Float = 16f, modifier: PolyModifier = PolyMod @Deprecated( "Use NodeMcItemIcon from PolyCompose", ReplaceWith("NodeMcItemIcon(stack, size, modifier, decorations, countOverride)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon"), + DeprecationLevel.HIDDEN, ) @Composable fun PolyItemIcon( From 39f1d8f1f13e6c976631230a3e480bf20228727b Mon Sep 17 00:00:00 2001 From: Julian Chang Date: Tue, 1 Dec 2026 15:19:24 -0500 Subject: [PATCH 3/3] Remove doc comments from PolyItemIcon shim --- .../org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt index 8fd92b344..e45997a5a 100644 --- a/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt +++ b/minecraft/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/item/PolyItemIcon.kt @@ -10,7 +10,6 @@ import org.polyfrost.compose.minecraft.mc.NodeMcItemIcon import org.polyfrost.compose.render.PolyColor import org.polyfrost.oneconfig.internal.ui.components.item.MinecraftItemCatalogService -/** Draws the item identified by its registry ID, or a placeholder while it is unavailable. */ @Deprecated("Use NodeMcItemIcon from PolyCompose", level = DeprecationLevel.HIDDEN) @Composable fun PolyItemIcon( @@ -30,7 +29,6 @@ fun PolyItemIcon( } } -/** Draws the default icon for [item]. */ @Deprecated( "Use NodeMcItemIcon from PolyCompose", ReplaceWith("NodeMcItemIcon(item, size, modifier)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon"), @@ -41,11 +39,6 @@ fun PolyItemIcon(item: Item, size: Float = 16f, modifier: PolyModifier = PolyMod NodeMcItemIcon(item, size, modifier) } -/** - * Draws a live stack including its optional count, durability, and cooldown decorations. - * - * @param countOverride text shown instead of the stack count, or `null` to show the normal vanilla count - */ @Deprecated( "Use NodeMcItemIcon from PolyCompose", ReplaceWith("NodeMcItemIcon(stack, size, modifier, decorations, countOverride)", "org.polyfrost.compose.minecraft.mc.NodeMcItemIcon"),