From dc2b265de4e18c2809b797783d69c1fc43d214e8 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Sun, 30 Nov 2025 15:21:56 +0000 Subject: [PATCH 01/34] Revert "revert gl renderer thing" This reverts commit 896a95769a476388fea779c25439f3ac4c7b0dd3. --- .../ui/v1/internal/wrappers/PolyUIScreen.java | 67 +++++++------------ 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index 56da7a8f5..f43950880 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -26,25 +26,20 @@ package org.polyfrost.oneconfig.api.ui.v1.internal.wrappers; -import dev.deftu.omnicore.api.client.framebuffer.ManagedFramebuffer; -import dev.deftu.omnicore.api.client.framebuffer.OmniFramebuffer; import dev.deftu.omnicore.api.client.input.KeyboardModifiers; import dev.deftu.omnicore.api.client.input.OmniKey; import dev.deftu.omnicore.api.client.input.OmniKeys; import dev.deftu.omnicore.api.client.input.OmniMouseButton; import dev.deftu.omnicore.api.client.render.OmniRenderingContext; -import dev.deftu.omnicore.api.client.render.OmniResolution; import dev.deftu.omnicore.api.client.screen.KeyPressEvent; import dev.deftu.omnicore.api.client.screen.OmniScreen; import dev.deftu.textile.Text; -import dev.deftu.omnicore.api.client.textures.OmniTextureFormat; -import dev.deftu.omnicore.api.color.OmniColors; -import kotlin.Unit; import net.minecraft.client.Minecraft; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.NotNull; +import org.lwjgl.BufferUtils; import org.polyfrost.oneconfig.api.platform.v1.Platform; import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.oneconfig.api.ui.v1.UIManager; @@ -53,8 +48,11 @@ import org.polyfrost.polyui.component.Drawable; import org.polyfrost.polyui.data.Cursor; +import java.nio.Buffer; +import java.nio.IntBuffer; import java.util.function.Consumer; +import static org.lwjgl.opengl.GL11.*; import static org.polyfrost.oneconfig.api.ui.v1.keybind.KeybindManager.translateKey; @SuppressWarnings("unused") @@ -64,11 +62,16 @@ public class PolyUIScreen extends OmniScreen implements BlurScreen { @NotNull public final PolyUI polyUI; - private OmniFramebuffer framebuffer; - private final float designedWidth, designedHeight, initialWidth, initialHeight; private final boolean pauses, blurs; private final Consumer close; + private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer( + //#if MC >= 1.13 + //$$ 4 + //#else + 16 + //#endif + ); //#if MC < 1.13 private int mx, my; @@ -118,42 +121,28 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, } //#endif - if (framebuffer == null || polyUI == UIManager.INSTANCE.getDefaultInstance()) { + if (polyUI == UIManager.INSTANCE.getDefaultInstance()) { return; } - Drawable master = polyUI.getMaster(); - try { - framebuffer.clearColor(0f, 0f, 0f, 0f); // Clear to transparent black - if (framebuffer instanceof ManagedFramebuffer) { - ((ManagedFramebuffer) framebuffer).clearDepthStencil(1.0, 0); - } - - framebuffer.usingToRender((matrixStack, w, h) -> { - matrixStack.runReplacingGlobalState(polyUI::render); - return Unit.INSTANCE; - }); + ((Buffer) VIEWPORT).clear(); + //#if MC >= 1.13 + //$$ glGetIntegerv(GL_VIEWPORT, VIEWPORT); + //#else + glGetInteger(GL_VIEWPORT, VIEWPORT); + //#endif + int w = (int) polyUI.getMaster().getWidth(); + int h = (int) polyUI.getMaster().getHeight(); + int x = Platform.screen().windowWidth() / 2 - w / 2; + int y = Platform.screen().windowHeight() / 2 - h / 2; + glViewport(x, y, w, h); + polyUI.render(); + glViewport(VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get()); } catch (Exception e) { polyUI.getRenderer().endFrame(); death(e); } - - float ratio = Platform.screen().pixelRatio(); - float scalingFactor = 1f / (float) OmniResolution.getScaleFactor(); - - float scaledX = (Platform.screen().viewportWidth() / 2f - master.getWidth() * ratio / 2f) * scalingFactor; - float scaledY = (Platform.screen().viewportHeight() / 2f - master.getHeight() * ratio / 2f) * scalingFactor; - float scaledWidth = master.getWidth() * scalingFactor * ratio; - float scaledHeight = master.getHeight() * scalingFactor * ratio; - - framebuffer.drawColorTexture( - UIManager.INSTANCE.getRenderPipeline(), - ctx.pose(), - scaledX, scaledY, - scaledWidth, scaledHeight, - OmniColors.WHITE - ); } @Override @@ -283,11 +272,6 @@ public void onScreenClose() { } protected final void adjustResolution(float w, float h, boolean force) { - if (this.framebuffer == null) { - int width = Platform.screen().viewportWidth(); - int height = Platform.screen().viewportHeight(); - this.framebuffer = new ManagedFramebuffer(width, height, OmniTextureFormat.RGBA8, OmniTextureFormat.DEPTH24_STENCIL8); - } // asm: normally, a polyui instance is as big as its window and that is it. // however, inside minecraft, the actual content is smaller than the window size, so resizing it directly would just fuck it up. @@ -307,7 +291,6 @@ protected final void adjustResolution(float w, float h, boolean force) { // framebuffer should you know probably be the correct larger size because.. well yeah of course it does // didn't anyone think of that? polyUI.resize(initialWidth * sx, initialHeight * sy, force); - framebuffer.resize((int) (polyUI.getMaster().getWidth() * ratio), (int) (polyUI.getMaster().getHeight() * ratio)); polyUI.getWindow().setPixelRatio(ratio); } catch (Exception e) { death(e); From 7ed6a9d74bd975be8c279d82c3d6e93cab606e45 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Sun, 30 Nov 2025 15:22:02 +0000 Subject: [PATCH 02/34] Reapply "it works!" This reverts commit 93a2d59035feb3c81dd912009de19d8965766549. --- .../api/ui/v1/internal/wrappers/PolyUIScreen.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index f43950880..bc589927a 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -126,6 +126,10 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, } try { + // asm: we need to bind the main framebuffer on 1.21.5+ because for some reason mc unbinds it right before... whatever + //#if MC >= 1.21.5 + //$$ kotlin.jvm.functions.Function0 unbind = dev.deftu.omnicore.api.client.framebuffer.OmniFramebuffers.getMain().bind(); + //#endif ((Buffer) VIEWPORT).clear(); //#if MC >= 1.13 //$$ glGetIntegerv(GL_VIEWPORT, VIEWPORT); @@ -139,6 +143,9 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, glViewport(x, y, w, h); polyUI.render(); glViewport(VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get()); + //#if MC >= 1.21.5 + //$$ unbind.invoke(); + //#endif } catch (Exception e) { polyUI.getRenderer().endFrame(); death(e); From c3d4efa7f57e2021daac8974c3b277bc30e29140 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:30:09 +0000 Subject: [PATCH 03/34] polyui state v2 + GLRenderer fixes --- gradle/libs.versions.toml | 2 +- .../api/ui/v1/internal/UIManagerImpl.java | 4 +- .../ui/v1/internal/wrappers/PolyUIScreen.java | 9 +- .../oneconfig/api/config/v1/Visualizer.kt | 251 +++++++++--------- .../config/v1/internal/ConfigVisualizer.kt | 21 +- .../oneconfig/api/config/v1/Property.java | 29 +- .../oneconfig/api/event/v1/EventManager.java | 2 +- .../oneconfig/api/hud/v1/internal/hudpages.kt | 186 +++++++------ .../oneconfig/internal/ui/OneConfigUI.kt | 63 +++-- .../api/ui/v1/internal/GLRendererImpl.kt | 7 +- 10 files changed, 305 insertions(+), 269 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 56b81b393..2255ec277 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" fabric-language-kotlin = "1.13.5+kotlin.2.2.10" google-ksp = "2.2.10-2.0.2" -polyui = "1.15.2" +polyui = "2.0.4" annotations = "24.1.0" hypixel-modapi = "1.0.1" hypixel-data = "0.2.0" # Dep of hypixel-modapi diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java index 439d14db7..d4aa2029d 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java @@ -127,8 +127,8 @@ public UIManagerImpl() throws Throwable { tinyFD = Lwjgl3Manager.getIsolated(TinyFdApi.class, LWJGL_IMPL_PACKAGE + "TinyFdImpl"); //#endif - renderer = new NVGRendererImpl(isGl3, nanoVg, nanoSvg, stb); -// renderer = new GLRendererImpl(nanoSvg, stb); +// renderer = new NVGRendererImpl(isGl3, nanoVg, nanoSvg, stb); + renderer = new GLRendererImpl(nanoSvg, stb); } catch (Exception e) { throw new RuntimeException("Failed to get valid rendering implementation", e); } diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index bc589927a..287c7b36a 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -136,10 +136,11 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, //#else glGetInteger(GL_VIEWPORT, VIEWPORT); //#endif - int w = (int) polyUI.getMaster().getWidth(); - int h = (int) polyUI.getMaster().getHeight(); - int x = Platform.screen().windowWidth() / 2 - w / 2; - int y = Platform.screen().windowHeight() / 2 - h / 2; + float factor = Platform.screen().pixelRatio(); + int w = (int) (polyUI.getMaster().getWidth() * factor); + int h = (int) (polyUI.getMaster().getHeight() * factor); + int x = Platform.screen().viewportWidth() / 2 - w / 2; + int y = Platform.screen().viewportHeight() / 2 - h / 2; glViewport(x, y, w, h); polyUI.render(); glViewport(VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get()); diff --git a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt index fb75c589f..6a7e613ae 100644 --- a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt +++ b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt @@ -33,7 +33,6 @@ import org.polyfrost.polyui.color.asMutable import org.polyfrost.polyui.component.Drawable import org.polyfrost.polyui.component.extensions.* import org.polyfrost.polyui.component.impl.* -import org.polyfrost.polyui.event.Event import org.polyfrost.polyui.event.State import org.polyfrost.polyui.input.PolyBind import org.polyfrost.polyui.unit.Align @@ -41,15 +40,80 @@ import org.polyfrost.polyui.unit.Align.Wrap import org.polyfrost.polyui.unit.Vec2 import org.polyfrost.polyui.utils.image import org.polyfrost.polyui.utils.mapToArray +import org.polyfrost.polyui.utils.setNumber +import org.polyfrost.polyui.utils.toString +import java.lang.ref.WeakReference import java.util.function.Predicate import kotlin.math.roundToInt /** * Visualizers are procedures that take a property, and return a drawable that represents it. */ +@Suppress("UNCHECKED_CAST") fun interface Visualizer { fun visualize(prop: Property<*>): Drawable + fun Property.toState(): State { + val state = State(getAs()) + var dodge = false + + val stateRef = WeakReference(state) + var callback: Predicate? = null + callback = Predicate { + if (!dodge) { + dodge = true + val ret = stateRef.get()?.set(it) ?: run { + removeCallback(callback!!) + false + } + dodge = false + ret + } else false + } + addCallback(callback) + + state.weaklyListen(this) { + if (!dodge) { + dodge = true + setAs(it) + dodge = false + } + } + return state + } + + fun Property>.toEnumState(): State { + val state = State(get()?.ordinal ?: 0) + var dodge = false + + val stateRef = WeakReference(state) + var callback: Predicate>? = null + callback = Predicate> { + if (!dodge) { + val st = stateRef.get() + if (st == null) { + removeCallback(callback!!) + false + } else { + dodge = true + val ret = st.set(it.ordinal) + dodge = false + ret + } + } else false + } + addCallback(callback) + + state.weaklyListen(this) { + if (!dodge) { + dodge = true + setAs(this.type.enumConstants[it] as Enum<*>) + dodge = false + } + } + return state + } + class ButtonVisualizer : Visualizer { override fun visualize(prop: Property<*>): Drawable { val text = prop.getMetadata("text")?.strv() @@ -68,49 +132,39 @@ fun interface Visualizer { if (p !is PolyColor.Mutable) { prop.setAsReferential(p.asMutable()) } - val state = State(prop.getAs()) + prop as Property + val state = prop.toState() val out = Block(color = state.value, size = Vec2(58f, 32f)).withBorder(3f, color = { page.border20 }) out.onClick { ColorPicker(state, polyUI, attachedDrawable = out); true } - prop.addCallback { - state.value = (it as PolyColor).asMutable() - false - } return out } } class DropdownVisualizer : Visualizer { override fun visualize(prop: Property<*>): Drawable { - val options: Array = prop.getMetadata("options") ?: emptyArray() - if (prop.type.isEnum || prop.type.superclass?.isEnum == true) { - require(options.isEmpty()) { "Dropdowns should not have options when used with enums (offender=${prop.id})" } + val options = prop.getMetadata>("options") + return if (prop.type.isEnum || prop.type.superclass?.isEnum == true) { + require(options.isNullOrEmpty()) { "Dropdowns should not have options when used with enums (offender=${prop.id})" } val constants = if (prop.type.isEnum) prop.type.enumConstants else prop.type.superclass.enumConstants - val index = constants.indexOf(prop.get()) - val s = Dropdown( + prop as Property> + Dropdown( optPadding = 24f, - initial = index, + state = prop.toEnumState(), entries = constants.mapToArray { it as Enum<*> null to (it::class.java.fields[0].get(it) as? String ?: it.name) }, - ).onChange { i: Int -> - prop.setAs(constants[i]) - false - } - // todo setback not supported currently on dropdowns - return s + ) } else { require(prop.type == Int::class.java) { "Dropdowns can only be used with enums or integers (offender=${prop.id}, type=${prop.type})" } + require(options != null) { "Dropdown integer properties must have options specified in their metadata (offender=${prop.id})" } require(options.size >= 2) { "Dropdowns must have at least two options (offender=${prop.id})" } - val s = Dropdown( + prop as Property + Dropdown( optPadding = 24f, - initial = prop.getAs(), + state = prop.toState(), entries = options.mapToArray { null to it }, - ).onChange { i: Int -> - prop.setAs(i) - false - } - return s + ) } } } @@ -169,76 +223,48 @@ fun interface Visualizer { val unit = prop.getMetadata("unit") val min = prop.getMetadata("min") ?: 0f val max = prop.getMetadata("max") ?: 100f - val integral = prop.type == Int::class.java || prop.type == Long::class.java - val placeholder = prop.getMetadata("placeholder") ?: if (integral) "${min.toInt()}-${max.toInt()}" else "$min-$max" - var dodge = false + val placeholder = prop.getMetadata("placeholder") ?: "${min.toString(dps = 2)}-${max.toString(dps = 2)}" + prop as Property + val state = prop.toState() val s = BoxedTextInput( placeholder = placeholder, image = "assets/oneconfig/ico/text.svg".image(), size = Vec2(200f, 32f), - initialValue = prop.getAs().toString(), + value = state, post = unit - ).apply { - (this[1][0] as TextInput).numeric(min, max, integral).on(Event.Change.Number) { - dodge = true - prop.setAs(if (integral) it.amount.toInt() else it.amount.toFloat()) - } - } - prop.addCallback { - if (!dodge) (s[1][0] as TextInput).text = it.toString() - dodge = false - false - } + ) + s.getTextFromBoxedTextInput().numeric(min, max, state) return s } } class RadioVisualizer : Visualizer { override fun visualize(prop: Property<*>): Drawable { - val options: Array = prop.getMetadata("options") ?: emptyArray() - var dodge = false + val options: Array? = prop.getMetadata("options") if (prop.type.isEnum) { val values = prop.type.enumConstants var field = prop.type::class.java.fields.firstOrNull() if (field?.type == String::class.java) field = null - require(options.isEmpty()) { "Radio button ${prop.id} cannot have options when used with enums" } - val r = - Radiobutton( + require(options.isNullOrEmpty()) { "Radio button ${prop.id} cannot have options when used with enums" } + prop as Property> + return Radiobutton( entries = values.mapToArray { it as Enum<*> null to (field?.get(it) as? String ?: it.name) }, - initial = values.indexOf(prop.get()), + state = prop.toEnumState(), optionLateralPadding = 20f, - ).onChange { amount: Int -> - dodge = true - prop.setAs(values[amount]) - false - } - prop.addCallback { - if (!dodge) r.setRadiobuttonEntry(values.indexOf(it as Enum<*>)) - dodge = false - false - } - return r + ) } else { require(prop.type == Int::class.java) { "Radio buttons ${prop.id} can only be used with enum or integer types (type=${prop.type}" } + require(options != null) { "Radio button ${prop.id} integer properties must have options specified in their metadata" } require(options.size >= 2) { "Radio button ${prop.id} must have at least two options" } - val r = Radiobutton( + prop as Property + return Radiobutton( entries = options.mapToArray { null to it }, - initial = prop.getAs(), + state = prop.toState(), optionLateralPadding = 20f, - ).onChange { amount: Int -> - dodge = true - prop.setAs(amount) - false - } - prop.addCallback { - if (!dodge) r.setRadiobuttonEntry(it as Int) - dodge = false - false - } - return r + ) } } } @@ -249,75 +275,44 @@ fun interface Visualizer { val max = prop.getMetadata("max") ?: 100f val stepAmount = prop.getMetadata("step") ?: 0f val nsteps = if (stepAmount > 0f) ((max - min) / stepAmount).roundToInt() else 0 - var dodge = false - val value = prop.getAs().toFloat() - if (value.isNaN() || value.isInfinite()) { - println("Warning: Slider property ${prop.id} has invalid value $value, resetting to $min") - } + prop as Property + val state = prop.toState() - val initialValue = value.coerceIn(min, max) - // todo stepped - val s = - Slider( + val f = state.value.toFloat() + if (f.isNaN() || f.isInfinite()) { + println("Warning: Slider property ${prop.id} has invalid value $f, resetting to $min") + state.setNumber(min) + } else state.setNumber(f.coerceIn(min, max)) + + return Slider( min = min, max = max, length = 200f, steps = nsteps, - initialValue = initialValue, - integral = prop.type == Int::class.java || prop.type == Long::class.java, - ).onChange { amount: Float -> - dodge = true - if (prop.type == Int::class.java) prop.setAs(amount.toInt()) else prop.setAs(amount) - false - } - prop.addCallback { - if (!dodge) s.setSliderValue((it as Number).toFloat(), min, max, false) - dodge = false - false - } - return s + state = state + ) } } class SwitchVisualizer : Visualizer { override fun visualize(prop: Property<*>): Drawable { - val state = prop.getAs() - var dodge = false + prop as Property val s = Switch( lateralStretch = 2f, size = 21f, - state = state, - ).onChange { new: Boolean -> - dodge = true - prop.setAs(new) - false - } - prop.addCallback { - if (!dodge) s.toggle(it as Boolean) - dodge = false - false - } + state = prop.toState(), + ) return s } } class CheckboxVisualizer : Visualizer { override fun visualize(prop: Property<*>): Drawable { - val state = prop.getAs() - var dodge = false + prop as Property val s = Checkbox( size = 24f, - state = state, - ).onChange { new: Boolean -> - dodge = true - prop.setAs(new) - false - } - prop.addCallback { - if (!dodge) s.toggle(it as Boolean) - dodge = false - false - } + state = prop.toState(), + ) return s } } @@ -328,31 +323,23 @@ fun interface Visualizer { val regexString = prop.getMetadata("regex") val regex = regexString?.let { Regex(it) } val validate = prop.getMetadata>("validate") - var dodge = false + prop as Property + val state = prop.toState() val s = BoxedTextInput( image = "assets/oneconfig/ico/text.svg".image(), placeholder = placeholder, //size = Vec2(200f, 32f), - initialValue = prop.getAs(), - ).onChange { text: String -> + value = state, + ).onChange(state) { text: String -> if (validate != null && !validate.test(text)) { - shake() - return@onChange true + shake(); return@onChange true } if (regex != null && !regex.matches(text)) { - shake() - return@onChange true + shake(); return@onChange true } - dodge = true - prop.setAs(text) false } if (regexString != null) s.addHoverInfo(Text("Must match regex: $regexString")) - prop.addCallback { - if (!dodge) (s[1][0] as TextInput).text = it as String - dodge = false - false - } return s } } diff --git a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt index 3ccb5836a..3beca1711 100644 --- a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt +++ b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt @@ -38,6 +38,7 @@ import org.polyfrost.polyui.component.extensions.* import org.polyfrost.polyui.component.impl.* import org.polyfrost.polyui.data.PolyImage import org.polyfrost.polyui.event.Event +import org.polyfrost.polyui.event.State import org.polyfrost.polyui.operations.Resize import org.polyfrost.polyui.operations.Rotate import org.polyfrost.polyui.unit.* @@ -261,43 +262,43 @@ open class ConfigVisualizer { wrapForAccordion(vis.visualize(node), node.title ?: return@map null, node.description).addHideHandler(node).addResetMenu(root, node).linkTo(node) } - var open = true + var open = State(true) val e: Property<*>? = tree.getProp("enabled") val toWrap: Drawable var enabled: Property? = null var contentHeight = -1f // asm: signature as it prevents re-wrapping of function val openInsn: Drawable.(Any?) -> Unit = { - open = !open + open.value = !open.value val arrow = if (enabled != null) this[1][1] else this[1] val anim = Animations.Default.create(0.6.seconds) - Rotate(arrow, if (!open) PI else 0.0, false, anim).add() + Rotate(arrow, if (!open.value) PI else 0.0, false, anim).add() val content = parent[1] if (contentHeight == -1f) contentHeight = content.height - Resize(parent, width = 0f, height = if (open) -contentHeight else contentHeight, add = true, animation = anim).add() - Resize(content, width = 0f, height = if (open) -contentHeight else contentHeight, add = true, animation = anim).add() + Resize(parent, width = 0f, height = if (open.value) -contentHeight else contentHeight, add = true, animation = anim).add() + Resize(content, width = 0f, height = if (open.value) -contentHeight else contentHeight, add = true, animation = anim).add() // won't ever open properly unless it renders at least once (tee hee) :) - if (!open) { + if (!open.value) { content.height = 1f content.renders = true } } if (e != null && e.type == Boolean::class.java && e.getVisualizer() == null) { - open = e.getAs() + open.value = e.getAs() toWrap = Group( Switch( lateralStretch = 2f, size = 21f, state = open - ).onToggle { + ).onChange(open) { enabled?.setAs(it) - if (open != it) (parent.parent as Drawable).openInsn(null) + if (open.value != it) (parent.parent as Drawable).openInsn(null) }, Image("polyui/chevron-down.svg").also { it.rotation = PI } ) // lmao - open = !open + open.value = !open.value @Suppress("UNCHECKED_CAST") // reason: #already-type-checked enabled = e as Property } else { diff --git a/modules/config/src/main/java/org/polyfrost/oneconfig/api/config/v1/Property.java b/modules/config/src/main/java/org/polyfrost/oneconfig/api/config/v1/Property.java index 3de52aedc..9b1be0b0e 100644 --- a/modules/config/src/main/java/org/polyfrost/oneconfig/api/config/v1/Property.java +++ b/modules/config/src/main/java/org/polyfrost/oneconfig/api/config/v1/Property.java @@ -179,6 +179,13 @@ public final Property addCallback(@NotNull Collection> callbacks return this; } + public final boolean removeCallback(@NotNull Predicate callback) { + if (callbacks != null) { + return callbacks.remove(callback); + } + return false; + } + @Override @SuppressWarnings({"unchecked", "rawtypes"}) public void overwrite(Node with, boolean preserveMissingOptions) { @@ -204,9 +211,9 @@ protected final void clearCallbacks() { *
* The value (and callbacks) are only set/called if the value is different from the previous value (using {@link Objects#equals(Object)}). */ - public final void set(@Nullable T value) { - if (Objects.equals(this.get(), value)) return; - setReferential(value); + public final boolean set(@Nullable T value) { + if (Objects.equals(this.get(), value)) return false; + return setReferential(value); } /** @@ -215,7 +222,7 @@ public final void set(@Nullable T value) { * Unlike {@link #set(Object)}, this will always set the value, regardless of if it is the same as the previous value. * Use this method with caution. */ - public void setReferential(@Nullable T value) { + public boolean setReferential(@Nullable T value) { if (callbacks != null) { T prev = get(); set0(value); @@ -224,13 +231,14 @@ public void setReferential(@Nullable T value) { if (p.test(value)) { LOGGER.info("property {} set cancelled by {}", this.getID(), p); set0(prev); - return; + return true; } } catch (Throwable t) { LOGGER.error("failed to call cancellable callback {} on property {}", p, this.getID(), t); } } } else set0(value); + return false; } protected abstract void set0(@Nullable T value); @@ -260,8 +268,8 @@ public final V getAs() { * This method is unsafe, and will throw a {@link ClassCastException} if the value is not of the correct type. */ @SuppressWarnings("unchecked") - public final void setAs(V value) { - set((T) WrappingUtils.richCast(value, type)); + public final boolean setAs(V value) { + return set((T) WrappingUtils.richCast(value, type)); } /** @@ -271,8 +279,8 @@ public final void setAs(V value) { * Use this method with caution. */ @SuppressWarnings("unchecked") - public final void setAsReferential(V value) { - setReferential((T) WrappingUtils.richCast(value, type)); + public final boolean setAsReferential(V value) { + return setReferential((T) WrappingUtils.richCast(value, type)); } /** @@ -440,7 +448,8 @@ static final class Dummy extends Property { @Override @Deprecated - public void setReferential(@Nullable Void value) { + public boolean setReferential(@Nullable Void value) { + return false; } @Override diff --git a/modules/events/src/main/java/org/polyfrost/oneconfig/api/event/v1/EventManager.java b/modules/events/src/main/java/org/polyfrost/oneconfig/api/event/v1/EventManager.java index 0a155bdce..03d830cbd 100644 --- a/modules/events/src/main/java/org/polyfrost/oneconfig/api/event/v1/EventManager.java +++ b/modules/events/src/main/java/org/polyfrost/oneconfig/api/event/v1/EventManager.java @@ -218,7 +218,7 @@ public void post(E event) { //noinspection StringConcatenationArgumentToLogCall LOGGER.error("Failed to invoke event handler for " + event.getClass().getName(), throwable); if (OmniLoader.isDevelopment()) { - throw new EventException("Event handler " + handler.getEventClass().getName() + " for " + handler.getEventClass().getName() + " failed", throwable); + throw new EventException("Event handler " + handler.getClass().getName() + " for " + handler.getEventClass().getName() + " failed", throwable); } if (handler.onError()) { LOGGER.error("removing {} registered to {} as it has failed too many times ({})", handler, event.getClass().getName(), EventHandler.ERROR_THRESHOLD); diff --git a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/internal/hudpages.kt b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/internal/hudpages.kt index 4372526b1..23e33cd20 100644 --- a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/internal/hudpages.kt +++ b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/internal/hudpages.kt @@ -49,7 +49,6 @@ import org.polyfrost.polyui.unit.seconds import org.polyfrost.polyui.utils.image import kotlin.experimental.or import kotlin.math.PI -import kotlin.math.roundToInt val alignC = Align(main = Align.Content.Center, cross = Align.Content.Center, line = Align.Line.Center) val alignNoPad = Align(pad = Vec2.ZERO) @@ -141,11 +140,13 @@ private fun HudButton(text: String): Block { } fun HudSettingsPage(hud: Hud<*>): Drawable { + val state = State(0) return Group( Radiobutton( "assets/oneconfig/ico/cog.svg".image() to "oneconfig.hudeditor.settings.title", "assets/oneconfig/ico/paintbrush.svg".image() to "oneconfig.hudeditor.designer.title", - ).onInit { color = polyUI.colors.component.bgDeselected }.onChange { index: Int -> + state = state + ).onInit { color = polyUI.colors.component.bgDeselected }.onChange(state) { index: Int -> if (index == 0) { parent[1] = HudVisualizer.get(hud.tree) } else { @@ -163,37 +164,53 @@ private fun makeHudDesigner(hud: Hud<*>): Drawable { val theHud = hud.get() val bg = hud.getBackground() val receiver = bg ?: theHud + + val padState = State(receiver.alignment.padBetween.x).listen { + receiver.alignment = receiver.alignment.copy(padBetween = Vec2(it, it)) + receiver.recalculate(false) + false + } + val radiusState = State((receiver as? Block)?.radii?.getOrNull(0) ?: 0f).listen { + (receiver as? Block)?.radius(it) + receiver.recalculate(false) + false + } + + val xPadState = State(receiver.padding.x).listen { + receiver.padding = receiver.padding.copy(x = it) + receiver.recalculate(false) + false + } + val yPadState = State(receiver.padding.y).listen { + receiver.padding = receiver.padding.copy(y = it) + receiver.recalculate(false) + false + } + val wPadState = State(receiver.padding.w).listen { + receiver.padding = receiver.padding.copy(w = it) + receiver.recalculate(false) + false + } + val hPadState = State(receiver.padding.h).listen { + receiver.padding = receiver.padding.copy(h = it) + receiver.recalculate(false) + false + } + + val staticWidth = State(false) + return Group( Text("oneconfig.hudeditor.general.title", fontSize = 16f).setFont { medium }, subheading("oneconfig.hudeditor.padding.title", "oneconfig.hudeditor.padding.info"), interactiveAlignment(receiver), Group( - DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", max = 30f, size = Vec2(120f, 32f)).also { - it[0].onChange { value: Float -> - receiver.alignment = receiver.alignment.copy(padBetween = Vec2(value, value)) - receiver.recalculate(false) - false - } - }.titled("oneconfig.hudeditor.padding.between"), - DraggingNumericTextInput(icon = "assets/oneconfig/ico/maximise.svg".image(), suffix = "px", max = 10f, size = Vec2(120f, 32f)).also { - it[0].onChange { value: Float -> - (receiver as? Block)?.radius(value) - false - } - }.titled("oneconfig.hudeditor.corner.radius"), + DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", max = 30f, size = Vec2(120f, 32f), state = padState).titled("oneconfig.hudeditor.padding.between"), + DraggingNumericTextInput(icon = "assets/oneconfig/ico/maximise.svg".image(), suffix = "px", max = 10f, size = Vec2(120f, 32f), state = radiusState).titled("oneconfig.hudeditor.corner.radius"), Group( - DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", initialValue = receiver.padding.x, max = 30f, size = Vec2(68f, 32f)).onChange { value: Float -> - receiver.padding = receiver.padding.copy(x = value) - }, - DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", initialValue = receiver.padding.y, max = 30f, size = Vec2(68f, 32f)).onChange { value: Float -> - receiver.padding = receiver.padding.copy(y = value) - }.also { it[0].rotation = PI / 2 }, - DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", initialValue = receiver.padding.w, max = 30f, size = Vec2(68f, 32f)).onChange { value: Float -> - receiver.padding = receiver.padding.copy(w = value) - }.also { it[0].rotation = PI }, - DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", initialValue = receiver.padding.h, max = 30f, size = Vec2(68f, 32f)).onChange { value: Float -> - receiver.padding = receiver.padding.copy(h = value) - }.also { it[0].rotation = PI * 1.5 }, + DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", state = xPadState, max = 30f, size = Vec2(68f, 32f)), + DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", state = yPadState, max = 30f, size = Vec2(68f, 32f)).also { it[0].rotation = PI / 2 }, + DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", state = wPadState, max = 30f, size = Vec2(68f, 32f)).also { it[0].rotation = PI }, + DraggingNumericTextInput(icon = "assets/oneconfig/ico/align.svg".image(), suffix = "px", state = hPadState, max = 30f, size = Vec2(68f, 32f)).also { it[0].rotation = PI * 1.5 }, alignment = Align(main = Align.Content.SpaceBetween, wrap = Align.Wrap.NEVER, padEdges = Vec2.ZERO), size = Vec2(308f, 32f) ).titled("oneconfig.hudeditor.padding.edges"),//.padded(16f, 12f, 0f, 0f), @@ -201,15 +218,15 @@ private fun makeHudDesigner(hud: Hud<*>): Drawable { size = Vec2(320f, 126f), ), Group( - Checkbox(size = 18f).onToggle { + Checkbox(size = 18f, state = staticWidth).onChange(staticWidth) { hud.staticWidth = it val siblings = siblings siblings[2].isEnabled = !it siblings[3].isEnabled = !it }, Text("oneconfig.hudeditor.staticwidth"), - DraggingNumericTextInput(pre = "oneconfig.width", suffix = "px", initialValue = receiver.width.roundToInt().toFloat(), max = 1000f, size = Vec2(128f, 32f)), - DraggingNumericTextInput(pre = "oneconfig.height", suffix = "px", initialValue = receiver.height.roundToInt().toFloat(), max = 1000f, size = Vec2(128f, 32f)), + DraggingNumericTextInput(pre = "oneconfig.width", suffix = "px", state = State.of(receiver::width), max = 1000f, size = Vec2(128f, 32f)), + DraggingNumericTextInput(pre = "oneconfig.height", suffix = "px", state = State.of(receiver::height), max = 1000f, size = Vec2(128f, 32f)), alignment = Align(padBetween = Vec2(12f, 6f)) ), *(if (bg != null) colorOptions(bg) else arrayOf()), @@ -316,68 +333,81 @@ fun interactiveAlignment(recv: Drawable): Block { fun textOptions(text: Text): Drawable { var prevWeight: Font.Weight = Font.Weight.Regular + var example: Text? = null + + val fontState = State(0).listen { + text.font = when (it) { + 1 -> PolyUI.monospaceFont + 2 -> mcFont.get(text.fontWeight, text.italic) + else -> text.polyUI.fonts.get(text.fontWeight, text.italic) + } + text._parent?.recalculate(false) + example?.run { + font = text.font + parent.recalculate() + } + false + } + val fontSize = State(text.fontSize).listen { + text.fontSize = it + text._parent?.recalculate(false) + example?.run { + fontSize = text.fontSize + parent.recalculate() + } + false + } + + val fontWeight = State(text.fontWeight.value / 100 - 1).listen { + text.fontWeight = Font.byWeight((it + 1) * 100) + text._parent?.recalculate(false) + example?.run { + fontWeight = text.fontWeight + parent.recalculate() + } + false + } + + val boldState = State(text.fontWeight.value > 500).listen { + if (it) { + prevWeight = text.fontWeight + text.fontWeight = when (text.fontWeight) { + Font.Weight.Thin, Font.Weight.ExtraLight, Font.Weight.Light -> Font.Weight.SemiBold + Font.Weight.Regular -> Font.Weight.Bold + Font.Weight.Medium -> Font.Weight.ExtraBold + else -> text.fontWeight + } + } else { + text.fontWeight = prevWeight + } + false + } + return Group( subheading("oneconfig.hudeditor.text.title", "oneconfig.hudeditor.text.info"), Block( - Text("oneconfig.hudeditor.text.example", fontSize = 16f), + Text("oneconfig.hudeditor.text.example", fontSize = 16f).also { example = it }, size = Vec2(476f, 58f), alignment = alignC, ).withBorder(), Dropdown( - "Poppins", "JetBrains Mono", "Minecraft" - ).onChange { it: Int -> - text.font = when (it) { - 1 -> PolyUI.monospaceFont - 2 -> mcFont.get(text.fontWeight, text.italic) - else -> polyUI.fonts.get(text.fontWeight, text.italic) - } - text._parent?.recalculate(false) - val ex = (parent.parent[1][0] as? Text) ?: return@onChange false - ex.font = text.font - ex.parent.recalculate() - false - }.titled("oneconfig.hudeditor.text.font"), - DraggingNumericTextInput("assets/oneconfig/ico/text-input.svg".image(), initialValue = text.fontSize.roundToInt().toFloat(), min = 1f, size = Vec2(72f, 0f), suffix = "px").also { - it[0].onChange { value: Float -> - text.fontSize = value - text._parent?.recalculate(false) - val ex = (parent.parent.parent[1][0] as? Text) ?: return@onChange false - ex.fontSize = text.fontSize - ex.parent.recalculate() - false - } - }.titled("oneconfig.hudeditor.text.size"), + "Poppins", "JetBrains Mono", "Minecraft", + state = fontState + ).titled("oneconfig.hudeditor.text.font"), + DraggingNumericTextInput("assets/oneconfig/ico/text-input.svg".image(), state = fontSize, min = 1f, size = Vec2(72f, 0f), suffix = "px").titled("oneconfig.hudeditor.text.size"), Dropdown( "oneconfig.fweight.100", "oneconfig.fweight.200", "oneconfig.fweight.300", "oneconfig.fweight.400", "oneconfig.fweight.500", - ).onChange { it: Int -> - text.fontWeight = Font.byWeight((it + 1) * 100) - text._parent?.recalculate(false) - val ex = (parent.parent[1][0] as? Text) ?: return@onChange false - ex.fontWeight = text.fontWeight - ex.parent.recalculate() - false - }.titled("oneconfig.hudeditor.text.weight"), + state = fontWeight, + ).titled("oneconfig.hudeditor.text.weight"), Group( - Block(Image("assets/oneconfig/ico/bold.svg"), alignment = alignNoPad).radius(2f).toggleable(text.fontWeight.value > 500).onToggle { - if (it) { - prevWeight = text.fontWeight - text.fontWeight = when (text.fontWeight) { - Font.Weight.Thin, Font.Weight.ExtraLight, Font.Weight.Light -> Font.Weight.SemiBold - Font.Weight.Regular -> Font.Weight.Bold - Font.Weight.Medium -> Font.Weight.ExtraBold - else -> text.fontWeight - } - } else { - text.fontWeight = prevWeight - } - }, - Block(Image("assets/oneconfig/ico/italic.svg"), alignment = alignNoPad).radius(2f).toggleable(text.italic).onToggle { text.italic = it }, - Block(Image("assets/oneconfig/ico/underline.svg"), alignment = alignNoPad).radius(2f).toggleable(text.underline).onToggle { text.underline = it }, - Block(Image("assets/oneconfig/ico/strikethrough.svg"), alignment = alignNoPad).radius(2f).toggleable(text.strikethrough).onToggle { text.strikethrough = it }, + Block(Image("assets/oneconfig/ico/bold.svg"), alignment = alignNoPad).radius(2f).toggleable(boldState), + Block(Image("assets/oneconfig/ico/italic.svg"), alignment = alignNoPad).radius(2f).toggleable(State.of(text::italic)), + Block(Image("assets/oneconfig/ico/underline.svg"), alignment = alignNoPad).radius(2f).toggleable(State.of(text::underline)), + Block(Image("assets/oneconfig/ico/strikethrough.svg"), alignment = alignNoPad).radius(2f).toggleable(State.of(text::strikethrough)), ).titled("oneconfig.hudeditor.text.effects"), *colorOptions(text), size = Vec2(476f, 0f), diff --git a/modules/internal/src/main/kotlin/org/polyfrost/oneconfig/internal/ui/OneConfigUI.kt b/modules/internal/src/main/kotlin/org/polyfrost/oneconfig/internal/ui/OneConfigUI.kt index f54945347..f33e66275 100644 --- a/modules/internal/src/main/kotlin/org/polyfrost/oneconfig/internal/ui/OneConfigUI.kt +++ b/modules/internal/src/main/kotlin/org/polyfrost/oneconfig/internal/ui/OneConfigUI.kt @@ -25,6 +25,7 @@ */ @file:JvmName("OneConfigUI") +@file:Suppress("FunctionName") package org.polyfrost.oneconfig.internal.ui @@ -55,6 +56,7 @@ import org.polyfrost.polyui.data.Cursor import org.polyfrost.polyui.data.Font import org.polyfrost.polyui.data.PolyImage import org.polyfrost.polyui.event.Event +import org.polyfrost.polyui.event.State import org.polyfrost.polyui.operations.Move import org.polyfrost.polyui.operations.Recolor import org.polyfrost.polyui.unit.Align @@ -132,6 +134,32 @@ object OneConfigUI { } if (!OmniLoader.isDevelopment) builder.pauses() + val searchState = State("").listen { text: String -> + if (text.length > 2) { + if(current?.name != "oneconfig.search") { + val search = Group(children = ConfigVisualizer.INSTANCE.getMatching(text).toTypedArray(), visibleSize = Vec2(1130f, 635f)).named("oneconfig.search") + if (search.children.isNullOrEmpty()) search.addChild(searchNoneFound, recalculate = false) + openPage(search, SetAnimation.Fade) + } else { + val search = current as Group + search.children?.clear() + ConfigVisualizer.INSTANCE.getMatching(text).fastEach { + search.addChild(it, recalculate = false) + } + if (search.children.isNullOrEmpty()) search.addChild(searchNoneFound, recalculate = false) + // search.at = search.screenAt + search.recalculate(false) + search.resetScroll() + search.visibleSize = Vec2(1130f, 635f).rescaleToPolyUIInstance(search.polyUI) + search.clipChildren() + } + } else { + openPage(ModsPage(collectTrees()), SetAnimation.Fade) + } + + false + } + val (polyUI, win) = builder.makeAndOpenWithRef( Block( Block( @@ -210,31 +238,8 @@ object OneConfigUI { TextInput( placeholder = "oneconfig.search.placeholder", visibleSize = Vec2(210f, 12f), - ).onChange { text: String -> - if (text.length > 2) { - if(current?.name != "oneconfig.search") { - val search = Group(children = ConfigVisualizer.INSTANCE.getMatching(text).toTypedArray(), visibleSize = Vec2(1130f, 635f)).named("oneconfig.search") - if (search.children.isNullOrEmpty()) search.addChild(searchNoneFound, recalculate = false) - openPage(search, SetAnimation.Fade) - } else { - val search = current as Group - search.children?.clear() - ConfigVisualizer.INSTANCE.getMatching(text).fastEach { - search.addChild(it, recalculate = false) - } - if (search.children.isNullOrEmpty()) search.addChild(searchNoneFound, recalculate = false) - // search.at = search.screenAt - search.recalculate(false) - search.resetScroll() - search.visibleSize = Vec2(1130f, 635f).rescaleToPolyUIInstance(polyUI) - search.clipChildren() - } - } else { - openPage(ModsPage(collectTrees()), SetAnimation.Fade) - } - - false - }, + text = searchState, + ), size = Vec2(256f, 32f), alignment = Align(pad = Vec2(10f, 8f)), ).withBorder(1f) { page.border5 }.named("SearchField").onRightClick { @@ -293,9 +298,11 @@ object OneConfigUI { prevArrow?.disable(false) } current = page - val translated = ui.polyUI.translator.translate(page.name) - val title = ui[1][0][0][2] as Text - title._text = translated + // todo expose _theText or do this in a better way +// val translated = ui.polyUI.translator.translate(page.name) +// val title = ui[1][0][0][2] as Text +// @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "UnstableApiUsage") +// title._theText = translated val prev = ui[1][1] ui[1].set(prev, page, animation) } diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 2e1571a83..f42e6e333 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -597,7 +597,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (count >= MAX_BATCH) { flush() } - val glyph = fAtlas.get(c) + val glyph = fAtlas.get(c) ?: continue buffer.put(penX + glyph.xOff * scaleFactor).put(penY + glyph.yOff * scaleFactor) .put(glyph.width * scaleFactor).put(glyph.height * scaleFactor) buffer.put(EMPTY_ROW) // zero radii @@ -1006,7 +1006,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re // var height = 0f val scaleFactor = fontSize / this.renderedSize for (c in text) { - width += get(c).xAdvance * scaleFactor + val g = get(c) ?: continue + width += g.xAdvance * scaleFactor // height = maxOf(height, g.height + g.offsetY) } return Vec2.of(width, fontSize) @@ -1014,7 +1015,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re @Suppress("DEPRECATION") @kotlin.internal.InlineOnly - inline fun get(char: Char) = glyphs[(char.toInt() - 32) /* .coerceIn(0, glyphs.size - 1) */] + inline fun get(char: Char) = if (char.toInt() in 32..32+95) glyphs[(char.toInt() - 32)] else null } @kotlin.internal.InlineOnly From 7ef695f2943ac71726d5c2b3e11c1ca8182beadf Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:08:39 +0000 Subject: [PATCH 04/34] getting there! --- gradle/libs.versions.toml | 2 +- .../api/ui/v1/internal/UIManagerImpl.java | 11 ++++-- .../oneconfig/internal/OneConfig.java | 18 +++++++-- .../oneconfig/api/ui/v1/UIManager.java | 13 +++++-- .../oneconfig/api/ui/v1/api/RendererExt.java | 5 +++ .../oneconfig/api/ui/v1/api/StbApi.java | 10 ++--- .../api/ui/v1/internal/GLRendererImpl.kt | 38 ++++++++++--------- .../oneconfig/api/ui/v1/internal/StbImpl.kt | 10 ++--- 8 files changed, 67 insertions(+), 40 deletions(-) create mode 100644 modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/RendererExt.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2255ec277..3b391217d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" fabric-language-kotlin = "1.13.5+kotlin.2.2.10" google-ksp = "2.2.10-2.0.2" -polyui = "2.0.4" +polyui = "2.0.5" annotations = "24.1.0" hypixel-modapi = "1.0.1" hypixel-data = "0.2.0" # Dep of hypixel-modapi diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java index d4aa2029d..eaa539c46 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java @@ -47,11 +47,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.polyfrost.oneconfig.api.ClassHasOverwrites; -import org.polyfrost.oneconfig.api.ui.v1.api.NanoSvgApi; -import org.polyfrost.oneconfig.api.ui.v1.api.NanoVgApi; -import org.polyfrost.oneconfig.api.ui.v1.api.StbApi; -import org.polyfrost.oneconfig.api.ui.v1.api.TinyFdApi; +import org.polyfrost.oneconfig.api.ui.v1.api.*; import org.polyfrost.oneconfig.api.ui.v1.UIManager; import org.polyfrost.oneconfig.api.ui.v1.internal.wrappers.MCWindow; import org.polyfrost.oneconfig.api.ui.v1.internal.wrappers.PolyUIScreen; @@ -134,6 +132,11 @@ public UIManagerImpl() throws Throwable { } } + @Override + public @Nullable RendererExt getRendererExt() { + return (renderer instanceof RendererExt ? (RendererExt) renderer : null); + } + @Override public Renderer getRenderer() { return renderer; diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/internal/OneConfig.java b/minecraft/src/main/java/org/polyfrost/oneconfig/internal/OneConfig.java index 2b91497f8..e8d04780e 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/internal/OneConfig.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/internal/OneConfig.java @@ -53,6 +53,7 @@ import org.polyfrost.oneconfig.api.hypixel.v1.HypixelUtils; import org.polyfrost.oneconfig.api.platform.v1.Platform; import org.polyfrost.oneconfig.api.ui.v1.UIManager; +import org.polyfrost.oneconfig.api.ui.v1.api.RendererExt; import org.polyfrost.oneconfig.api.ui.v1.internal.BlurHandler; import org.polyfrost.oneconfig.api.ui.v1.keybind.OCKeybindHelper; import org.polyfrost.oneconfig.internal.ui.OneConfigUI; @@ -132,8 +133,8 @@ private void init() { if (Boolean.getBoolean("oneconfig.test")) { try { TestMod_Test.initialize(); - } catch (Throwable ignored) { - ignored.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); } } @@ -155,7 +156,7 @@ private void init() { LOGGER.info("OneConfig initialization took {}ms", (System.nanoTime() - t1) / 1_000_000.0); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked", "rawtypes", "UnstableApiUsage"}) private static void registerCommands() { ClientCommandInternals.initialize(); // //#if MC > 1.16 @@ -201,7 +202,16 @@ private static void registerCommands() { return ctx.getSource().replyChat("OK"); }) ) - .build(); + .then(OmniClientCommands.literal("dumpAtlas") + .executes((ctx) -> { + RendererExt ext = UIManager.INSTANCE.getRendererExt(); + if (ext == null) { + return ctx.getSource().replyChat("RendererExt is not available on this platform."); + } + ext.dumpAtlas(); + return ctx.getSource().replyChat("OK"); + }) + ).build(); OmniClientCommands.register(node); OmniClientCommands.register(OmniClientCommands.literal("ocfg").executes(executor).redirect(node)); } diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java index 265ddf2aa..77f941472 100644 --- a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java @@ -47,10 +47,10 @@ import org.polyfrost.oneconfig.api.event.v1.EventDelay; import org.polyfrost.oneconfig.api.event.v1.EventManager; import org.polyfrost.oneconfig.api.event.v1.events.HudRenderEvent; -import org.polyfrost.oneconfig.api.event.v1.events.RenderEvent; import org.polyfrost.oneconfig.api.event.v1.events.ResizeEvent; import org.polyfrost.oneconfig.api.event.v1.events.WorldEvent; import org.polyfrost.oneconfig.api.platform.v1.Platform; +import org.polyfrost.oneconfig.api.ui.v1.api.RendererExt; import org.polyfrost.oneconfig.api.ui.v1.api.TinyFdApi; import org.polyfrost.polyui.PolyUI; import org.polyfrost.polyui.Settings; @@ -76,6 +76,12 @@ public interface UIManager { */ Renderer getRenderer(); + /** + * Return the renderer extension instance. This interface specifies additional (debug) operations for the renderer. + */ + @Nullable + RendererExt getRendererExt(); + /** * Return the TinyFD implementation instance. This interface specifies operations for opening native * file dialogs, and showing notifications. @@ -157,9 +163,8 @@ default PolyUI createDefault() { }); }; - EventManager.register(RenderEvent.Post.class, event -> { - renderer.accept(event.ctx); - }); + // todo temporary reversion: on RenderEvent it just renders nothing (see #592, #579) + EventManager.register(HudRenderEvent.class, event -> renderer.accept(event.ctx)); EventManager.register(ResizeEvent.class, event -> { float ratio = Platform.screen().pixelRatio(); diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/RendererExt.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/RendererExt.java new file mode 100644 index 000000000..f4812bc91 --- /dev/null +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/RendererExt.java @@ -0,0 +1,5 @@ +package org.polyfrost.oneconfig.api.ui.v1.api; + +public interface RendererExt { + void dumpAtlas(); +} diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/StbApi.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/StbApi.java index 838d65894..29443a217 100644 --- a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/StbApi.java +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/StbApi.java @@ -12,15 +12,15 @@ public interface StbApi { void image_write_png(String filename, int w, int h, int comp, ByteBuffer data, int strideInBytes); - long createFontInfo(); + long font_CreateFontInfo(); - long createPackRange(); + long font_CreatePackRange(); - long createPackedCharArray(int capacity); + long font_CreatePackedCharArray(int capacity); - long createPackContext(); + long font_CreatePackContext(); - boolean initFont(long info, ByteBuffer data); + boolean font_InitFont(long info, ByteBuffer data); float font_ScaleForMappingEmToPixels(long info, float pixels); diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index f42e6e333..e4b778841 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* import org.polyfrost.oneconfig.api.ui.v1.api.NanoSvgApi +import org.polyfrost.oneconfig.api.ui.v1.api.RendererExt import org.polyfrost.oneconfig.api.ui.v1.api.StbApi import org.polyfrost.polyui.PolyUI import org.polyfrost.polyui.color.Color @@ -42,10 +43,9 @@ private val EMPTY_ROW = floatArrayOf(0f, 0f, 0f, 0f) private val NO_UV = floatArrayOf(-1f, -1f, 1f, 1f) @Suppress("UnstableApiUsage", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Renderer { +class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Renderer, RendererExt { private val buffer = BufferUtils.createFloatBuffer(MAX_BATCH * STRIDE) - private val transformBuffer = BufferUtils.createFloatBuffer(9) private val scissorStack = IntArray(MAX_UI_DEPTH * 4) private val transformStack = ArrayList(MAX_UI_DEPTH) private val fonts = HashMap() @@ -81,11 +81,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re 0f, 1f, 0f, 0f, 0f, 1f ) - set(value) { - field = value - transformBuffer.clear() - transformBuffer.put(value).flip() - } private var viewportWidth = 0f private var viewportHeight = 0f private var pixelRatio = 1f @@ -284,8 +279,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re @Suppress("SameParameterValue") - private fun glUniformMatrix3fv(location: Int, transpose: Boolean, buf: FloatBuffer) { - ShaderInternals.uniformMatrix3(location, transpose, buf) + private fun glUniformMatrix3fv(location: Int, transpose: Boolean, array: FloatArray) { + ShaderInternals.uniformMatrix3(location, transpose, array) } override fun init() { @@ -387,7 +382,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val prevProg = glGetInteger(GL_CURRENT_PROGRAM) glUseProgram(program) glUniform2f(uWindow, width, height) - glUniformMatrix3fv(uTransform, false, transformBuffer) + glUniformMatrix3fv(uTransform, false, transform) glUseProgram(prevProg) glDisable(GL_SCISSOR_TEST) viewportWidth = width * pixelRatio @@ -430,7 +425,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re glUseProgram(program) if (popFlushNeeded) { - glUniformMatrix3fv(uTransform, false, transformBuffer) + glUniformMatrix3fv(uTransform, false, transform) popFlushNeeded = false } @@ -851,19 +846,25 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } } + private var i = 0 fun dumpTexture(texId: Int = atlas) { val buf = BufferUtils.createByteBuffer(ATLAS_SIZE * ATLAS_SIZE * 4) glBindTexture(GL_TEXTURE_2D, texId) glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf) glBindTexture(GL_TEXTURE_2D, 0) stb.image_write_png( - "debug_texture$texId.png", + "debug_texture$texId($i).png", ATLAS_SIZE, ATLAS_SIZE, 4, buf, ATLAS_SIZE * 4 ) + i++ + } + + override fun dumpAtlas() { + dumpTexture(atlas) } override fun cleanup() { @@ -891,8 +892,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val lineGap: Float init { - val fontInfo = stb.createFontInfo() - if (!stb.initFont(fontInfo, data)) { + val stb = stb + val fontInfo = stb.font_CreateFontInfo() + if (!stb.font_InitFont(fontInfo, data)) { throw IllegalStateException("Failed to initialize font") } val scale = stb.font_ScaleForMappingEmToPixels(fontInfo, renderedSize) @@ -906,15 +908,15 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re descent = des[0] * scale lineGap = gap[0] * scale - val range = stb.createPackRange() + val range = stb.font_CreatePackRange() stb.font_RangeSetFontSize(range, renderedSize) stb.font_RangeSetFirstUnicodeCodepointInRange(range, 32) stb.font_RangeSetNumChars(range, 95) - val packed = stb.createPackedCharArray(95) + val packed = stb.font_CreatePackedCharArray(95) stb.font_RangeSetChardata(range, packed) val bitMap = BufferUtils.createByteBuffer(FONT_MAX_BITMAP_W * FONT_MAX_BITMAP_H) - val pack = stb.createPackContext() + val pack = stb.font_CreatePackContext() if (!stb.font_PackBegin(pack, bitMap, FONT_MAX_BITMAP_W, FONT_MAX_BITMAP_H, 0, 1, 0L)) { throw IllegalStateException("Failed to initialize font packer") } @@ -974,6 +976,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re stb.free(packed) stb.free(range) +// dumpAtlas() + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) glBindTexture(GL_TEXTURE_2D, atlas) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/StbImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/StbImpl.kt index a37379759..a3a698224 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/StbImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/StbImpl.kt @@ -27,15 +27,15 @@ class StbImpl : StbApi { STBImageWrite.stbi_write_png(filename, w, h, comp, data, strideInBytes) } - override fun createFontInfo() = STBTTFontinfo.malloc().address() + override fun font_CreateFontInfo() = STBTTFontinfo.malloc().address() - override fun createPackRange() = STBTTPackRange.malloc().address() + override fun font_CreatePackRange() = STBTTPackRange.malloc().address() - override fun createPackedCharArray(capacity: Int) = STBTTPackedchar.malloc(capacity).address() + override fun font_CreatePackedCharArray(capacity: Int) = STBTTPackedchar.malloc(capacity).address() - override fun createPackContext() = STBTTPackContext.malloc().address() + override fun font_CreatePackContext() = STBTTPackContext.malloc().address() - override fun initFont(info: Long, data: ByteBuffer) = nstbtt_InitFont(info, MemoryUtil.memAddress(data), 0) != 0 + override fun font_InitFont(info: Long, data: ByteBuffer) = nstbtt_InitFont(info, MemoryUtil.memAddress(data), 0) != 0 override fun font_ScaleForMappingEmToPixels(info: Long, pixels: Float) = nstbtt_ScaleForMappingEmToPixels(info, pixels) From 80316fc46e8a351adbab6c92096251b5743ae77b Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Mon, 1 Dec 2025 21:20:40 +0000 Subject: [PATCH 05/34] fixed GLRenderer yay --- .../api/ui/v1/internal/GLRendererImpl.kt | 84 +++++++++++-------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index e4b778841..f03f80c6f 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -86,6 +86,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var pixelRatio = 1f private var alphaCap = 1f private var popFlushNeeded = false + private val init get() = program != 0 private var slotX = 0 private var slotY = 0 @@ -284,6 +285,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun init() { + if (init) return // check if instancing extension is available require(GlCapabilities.isGl21Available) { "At least OpenGL 2.1 is required" } if (!GlCapabilities.isGl33Available) { // asm: skip check, both are core past 3.3 @@ -398,6 +400,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private fun flush() { if (count == 0) return buffer.flip() + val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) val prevProg = glGetInteger(GL_CURRENT_PROGRAM) val prevBuf = glGetInteger(GL_ARRAY_BUFFER_BINDING) @@ -459,6 +462,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (prevDepth) glEnable(GL_DEPTH_TEST) if (prevCull) glEnable(GL_CULL_FACE) glUseProgram(prevProg) + glActiveTexture(prevActive) glBindTexture(GL_TEXTURE_2D, prevTex) glBindBuffer(GL_ARRAY_BUFFER, prevBuf) if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao) @@ -598,7 +602,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re buffer.put(EMPTY_ROW) // zero radii buffer.put(r).put(g).put(b).put(a) buffer.put(EMPTY_ROW) // color1 unused - buffer.put(glyph.u).put(glyph.v).put(glyph.uw).put(glyph.vh) + buffer.put(glyph, 0, 4) buffer.put(-1f) // thickness = -1 for text penX += glyph.xAdvance * scaleFactor count += 1 @@ -796,18 +800,23 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re h[0] / ATLAS_SIZE.toFloat() ) - val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glBindTexture(GL_TEXTURE_2D, atlas) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1) - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) - glTexSubImage2D(GL_TEXTURE_2D, 0, slotX, slotY, w[0], h[0], GL_RGBA, GL_UNSIGNED_BYTE, d) - when (mipmapMode) { - 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) - 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) + synchronized(this) { + val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) + glActiveTexture(GL_TEXTURE0) + glBindTexture(GL_TEXTURE_2D, atlas) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1) + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) + glTexSubImage2D(GL_TEXTURE_2D, 0, slotX, slotY, w[0], h[0], GL_RGBA, GL_UNSIGNED_BYTE, d) + when (mipmapMode) { + 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) + 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) + } + glBindTexture(GL_TEXTURE_2D, prevTex) + glActiveTexture(prevActive) } - glBindTexture(GL_TEXTURE_2D, prevTex) if (image.type == PolyImage.Type.Raster) stb.image_free(d) slotX += w[0] @@ -976,30 +985,33 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re stb.free(packed) stb.free(range) -// dumpAtlas() - - val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glBindTexture(GL_TEXTURE_2D, atlas) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1) - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) - // can't write to the alpha channel in GL3 core! lol haha - glTexSubImage2D( - GL_TEXTURE_2D, - 0, - sx, - sy, - FONT_MAX_BITMAP_W, - FONT_MAX_BITMAP_H, - GL_RED, - GL_UNSIGNED_BYTE, - bitMap - ) - glBindTexture(GL_TEXTURE_2D, prevTex) - when (mipmapMode) { - 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) - 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) + synchronized(this@GLRendererImpl) { + val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) + glActiveTexture(GL_TEXTURE0) + glBindTexture(GL_TEXTURE_2D, atlas) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1) + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) + // can't write to the alpha channel in GL3 core! lol haha + glTexSubImage2D( + GL_TEXTURE_2D, + 0, + sx, + sy, + FONT_MAX_BITMAP_W, + FONT_MAX_BITMAP_H, + GL_RED, + GL_UNSIGNED_BYTE, + bitMap + ) + when (mipmapMode) { + 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) + 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) + } + glBindTexture(GL_TEXTURE_2D, prevTex) + glActiveTexture(prevActive) } slotX += totalSizeX atlasRowHeight = maxOf(atlasRowHeight, totalSizeY) From 0bebd02e4e0b507ffa91a333ca7b0853849a3f02 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Tue, 2 Dec 2025 15:04:12 +0000 Subject: [PATCH 06/34] port fixes --- .../api/ui/v1/internal/GLRendererImpl.kt | 184 ++++++++++-------- 1 file changed, 99 insertions(+), 85 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index f03f80c6f..07e411d52 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("UnstableApiUsage", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + package org.polyfrost.oneconfig.api.ui.v1.internal import dev.deftu.omnicore.api.client.render.GlCapabilities @@ -41,14 +43,36 @@ private const val MAX_BATCH = 1024 private val EMPTY_ROW = floatArrayOf(0f, 0f, 0f, 0f) private val NO_UV = floatArrayOf(-1f, -1f, 1f, 1f) +private val IDENTITY = floatArrayOf( + 1f, 0f, 0f, + 0f, 1f, 0f, + 0f, 0f, 1f +) + +private fun FloatArray.isIdentity(): Boolean { + return this[0] == 1f && this[1] == 0f && this[2] == 0f && + this[3] == 0f && this[4] == 1f && this[5] == 0f && + this[6] == 0f && this[7] == 0f && this[8] == 1f +} + +@kotlin.internal.InlineOnly +private inline fun FloatArray.set(other: FloatArray) { + System.arraycopy(other, 0, this, 0, 9) +} + +@kotlin.internal.InlineOnly +private inline fun FloatArray.setThenClear(other: FloatArray) { + System.arraycopy(other, 0, this, 0, 9) + System.arraycopy(IDENTITY, 0, other, 0, 9) +} -@Suppress("UnstableApiUsage", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Renderer, RendererExt { private val buffer = BufferUtils.createFloatBuffer(MAX_BATCH * STRIDE) private val scissorStack = IntArray(MAX_UI_DEPTH * 4) - private val transformStack = ArrayList(MAX_UI_DEPTH) + private val transformStack = Array(MAX_UI_DEPTH) { FloatArray(9) } private val fonts = HashMap() + private val init get() = program != 0 // lateinit private var mipmapMode = 0 @@ -75,6 +99,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re // Current batch state private var count = 0 private var curTex = 0 + private var transformDepth = 0 private var curScissor = 0 private var transform = floatArrayOf( 1f, 0f, 0f, @@ -86,7 +111,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var pixelRatio = 1f private var alphaCap = 1f private var popFlushNeeded = false - private val init get() = program != 0 private var slotX = 0 private var slotY = 0 @@ -128,14 +152,19 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re float rRight = mix(r.z, r.y, py); // bottom-right / top-right float radius = mix(rLeft, rRight, px); - vec2 d = abs(p) - b + vec2(radius); - vec2 dClamped = max(d, vec2(0.0)); - return length(dClamped) - radius + min(max(d.x, d.y), 0.0); + vec2 q = abs(p) - (b - vec2(radius)); + return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius; } float hollowRoundedBoxSDF(vec2 p, vec2 b, vec4 r, float thickness) { - float dist = roundedBoxSDF(p, b, r); - return abs(dist) - thickness * 0.5; + float outer = roundedBoxSDF(p, b + vec2(0.2), r); + float inner = roundedBoxSDF(p, b - vec2(thickness), max(r - vec4(thickness), 0.0)); + return max(outer, -inner); + } + + float roundBoxSDF(vec2 p, vec2 halfSize, float radius) { + vec2 q = abs(p) - (halfSize - vec2(radius)); + return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius; } void main() { @@ -152,20 +181,19 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re col = (vThickness == -1.0) ? vec4(col.rgb, col.a * texColor.r) : col * texColor; } else if (vThickness == -2.0) { // linear gradient, vUV as start and vUV2 as end - vec2 dir = normalize(vUV2 - vUV); - float t = dot((p + halfSize) - vUV, dir) / length(vUV2 - vUV); - t = clamp(t, 0.0, 1.0); + vec2 dir = vUV2 - vUV; + float len = length(dir); + float t = clamp(dot((p + halfSize) - vUV, dir / len) / len, 0.0, 1.0); col = mix(vColor0, vColor1, t); } else if (vThickness == -3.0) { // radial gradient, vUV as center and vUV2.x as radius float dist = length(p + halfSize - vUV); - float t = (dist - vUV2.x) / (vUV2.y - vUV2.x); - t = clamp(t, 0.0, 1.0); + float t = clamp((dist - vUV2.x) / (vUV2.y - vUV2.x), 0.0, 1.0); col = mix(vColor0, vColor1, t); } else if (vThickness == -4.0) { // box gradient, vUV.x as radius and vUV.y as feather - float dist = roundedBoxSDF(p, halfSize - vec2(vUV.x), vec4(vUV.x)); - float t = clamp(dist / vUV.y, 0.0, 1.0); + float dist = roundBoxSDF(p, halfSize, vUV.x); + float t = clamp((dist + vUV.y * 0.5) / vUV.y, 0.0, 1.0); col = mix(vColor0, vColor1, t); } @@ -380,7 +408,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re alphaCap = 1f count = 0 buffer.clear() - loadIdentity() + transform.set(IDENTITY) + transformDepth = 0 val prevProg = glGetInteger(GL_CURRENT_PROGRAM) glUseProgram(program) glUniform2f(uWindow, width, height) @@ -596,7 +625,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (count >= MAX_BATCH) { flush() } - val glyph = fAtlas.get(c) ?: continue + val glyph = fAtlas.get(c) buffer.put(penX + glyph.xOff * scaleFactor).put(penY + glyph.yOff * scaleFactor) .put(glyph.width * scaleFactor).put(glyph.height * scaleFactor) buffer.put(EMPTY_ROW) // zero radii @@ -697,15 +726,17 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re override fun push() { if (transform.isIdentity()) return - transformStack.add(transform.copyOf()) + transformStack[transformDepth++].set(transform) } override fun pop() { if (transform.isIdentity()) return flush() - if (transformStack.isEmpty()) { - loadIdentity() - } else transform = transformStack.removeLast() + if (transformDepth == 0) { + transform.set(IDENTITY) + } else { + transform.setThenClear(transformStack[--transformDepth]) + } popFlushNeeded = true } @@ -763,20 +794,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re popFlushNeeded = true } - private fun FloatArray.isIdentity(): Boolean { - return this[0] == 1f && this[1] == 0f && this[2] == 0f && - this[3] == 0f && this[4] == 1f && this[5] == 0f && - this[6] == 0f && this[7] == 0f && this[8] == 1f - } - - private fun loadIdentity() { - val transform = transform - transform[0] = 1f; transform[1] = 0f; transform[2] = 0f - transform[3] = 0f; transform[4] = 1f; transform[5] = 0f - transform[6] = 0f; transform[7] = 0f; transform[8] = 1f - this.transform = transform - } - override fun initImage(image: PolyImage, size: Vec2) { if (image.initialized) return val w = IntArray(1) @@ -800,27 +817,26 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re h[0] / ATLAS_SIZE.toFloat() ) - synchronized(this) { - val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) - val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glActiveTexture(GL_TEXTURE0) - glBindTexture(GL_TEXTURE_2D, atlas) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1) - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) - glTexSubImage2D(GL_TEXTURE_2D, 0, slotX, slotY, w[0], h[0], GL_RGBA, GL_UNSIGNED_BYTE, d) - when (mipmapMode) { - 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) - 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) - } - glBindTexture(GL_TEXTURE_2D, prevTex) - glActiveTexture(prevActive) + val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) + glActiveTexture(GL_TEXTURE0) + glBindTexture(GL_TEXTURE_2D, atlas) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1) + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) + glTexSubImage2D(GL_TEXTURE_2D, 0, slotX, slotY, w[0], h[0], GL_RGBA, GL_UNSIGNED_BYTE, d) + when (mipmapMode) { + 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) + 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } + glBindTexture(GL_TEXTURE_2D, prevTex) + glActiveTexture(prevActive) + if (image.type == PolyImage.Type.Raster) stb.image_free(d) - slotX += w[0] - if (h[0] > atlasRowHeight) atlasRowHeight = h[0] + slotX += w[0] + 1 + if (h[0] + 1 > atlasRowHeight) atlasRowHeight = h[0] + 1 image.reportInit() } @@ -882,7 +898,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (quadVbo != 0) glDeleteBuffers(quadVbo) if (instancedVbo != 0) glDeleteBuffers(instancedVbo) if (atlas != 0) glDeleteTextures(atlas) - transformStack.clear() fonts.clear() buffer.clear() } @@ -985,36 +1000,35 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re stb.free(packed) stb.free(range) - synchronized(this@GLRendererImpl) { - val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) - val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glActiveTexture(GL_TEXTURE0) - glBindTexture(GL_TEXTURE_2D, atlas) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1) - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) - // can't write to the alpha channel in GL3 core! lol haha - glTexSubImage2D( - GL_TEXTURE_2D, - 0, - sx, - sy, - FONT_MAX_BITMAP_W, - FONT_MAX_BITMAP_H, - GL_RED, - GL_UNSIGNED_BYTE, - bitMap - ) - when (mipmapMode) { - 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) - 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) - } - glBindTexture(GL_TEXTURE_2D, prevTex) - glActiveTexture(prevActive) + val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) + glActiveTexture(GL_TEXTURE0) + glBindTexture(GL_TEXTURE_2D, atlas) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1) + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0) + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0) + // can't write to the alpha channel in GL3 core! lol haha + glTexSubImage2D( + GL_TEXTURE_2D, + 0, + sx, + sy, + FONT_MAX_BITMAP_W, + FONT_MAX_BITMAP_H, + GL_RED, + GL_UNSIGNED_BYTE, + bitMap + ) + when (mipmapMode) { + 1 -> org.lwjgl.opengl.GL30.glGenerateMipmap(GL_TEXTURE_2D) + 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } - slotX += totalSizeX - atlasRowHeight = maxOf(atlasRowHeight, totalSizeY) + glBindTexture(GL_TEXTURE_2D, prevTex) + glActiveTexture(prevActive) + + slotX += totalSizeX + 1 + atlasRowHeight = maxOf(atlasRowHeight, totalSizeY + 1) } fun measure(text: String, fontSize: Float): Vec2 { @@ -1022,7 +1036,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re // var height = 0f val scaleFactor = fontSize / this.renderedSize for (c in text) { - val g = get(c) ?: continue + val g = get(c) width += g.xAdvance * scaleFactor // height = maxOf(height, g.height + g.offsetY) } @@ -1031,7 +1045,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re @Suppress("DEPRECATION") @kotlin.internal.InlineOnly - inline fun get(char: Char) = if (char.toInt() in 32..32+95) glyphs[(char.toInt() - 32)] else null + inline fun get(char: Char) = if (char.toInt() in 32..32 + 95) glyphs[(char.toInt() - 32)] else glyphs['?'.toInt()] } @kotlin.internal.InlineOnly From 34824546ea84c2a6109297a53b875269779ca016 Mon Sep 17 00:00:00 2001 From: Wyvest Date: Thu, 4 Dec 2025 05:29:29 -0500 Subject: [PATCH 07/34] Fix 1.8 errors --- .../api/ui/v1/internal/GLRendererImpl.kt | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 07e411d52..cbfea5e2e 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -7,6 +7,7 @@ import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals import org.apache.logging.log4j.LogManager import org.lwjgl.BufferUtils import org.lwjgl.opengl.GL11.* +import org.lwjgl.opengl.GL13 import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* @@ -24,6 +25,7 @@ import org.polyfrost.polyui.unit.Vec4 import org.polyfrost.polyui.utils.toDirectByteBuffer import org.polyfrost.polyui.utils.toDirectByteBufferNT import java.nio.ByteBuffer +import java.nio.ByteOrder import java.nio.FloatBuffer import kotlin.math.cos import kotlin.math.roundToInt @@ -309,7 +311,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re @Suppress("SameParameterValue") private fun glUniformMatrix3fv(location: Int, transpose: Boolean, array: FloatArray) { - ShaderInternals.uniformMatrix3(location, transpose, array) + val buffer = ByteBuffer.allocateDirect(array.size * 4).order(ByteOrder.nativeOrder()).asFloatBuffer().put(array) + buffer.flip() + ShaderInternals.uniformMatrix3(location, transpose, buffer) } override fun init() { @@ -461,7 +465,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re popFlushNeeded = false } - glActiveTexture(GL_TEXTURE0) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, curTex) // Quad attrib @@ -491,7 +496,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (prevDepth) glEnable(GL_DEPTH_TEST) if (prevCull) glEnable(GL_CULL_FACE) glUseProgram(prevProg) - glActiveTexture(prevActive) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(prevActive) glBindTexture(GL_TEXTURE_2D, prevTex) glBindBuffer(GL_ARRAY_BUFFER, prevBuf) if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao) @@ -819,7 +825,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glActiveTexture(GL_TEXTURE0) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) @@ -831,7 +838,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } glBindTexture(GL_TEXTURE_2D, prevTex) - glActiveTexture(prevActive) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(prevActive) if (image.type == PolyImage.Type.Raster) stb.image_free(d) @@ -1002,7 +1010,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - glActiveTexture(GL_TEXTURE0) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) @@ -1025,7 +1034,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } glBindTexture(GL_TEXTURE_2D, prevTex) - glActiveTexture(prevActive) + @Suppress("RemoveRedundantQualifierName") + GL13.glActiveTexture(prevActive) slotX += totalSizeX + 1 atlasRowHeight = maxOf(atlasRowHeight, totalSizeY + 1) From a1865d9f2e368fa8c99b58e4b0ceb503c9cd0db5 Mon Sep 17 00:00:00 2001 From: Wyvest Date: Thu, 4 Dec 2025 05:37:45 -0500 Subject: [PATCH 08/34] Disable blur everywhere --- .../oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index 287c7b36a..9fc70937b 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -85,7 +85,7 @@ public PolyUIScreen(@NotNull PolyUI polyUI, float designedWidth, float designedH this.designedHeight = designedHeight; this.initialWidth = polyUI.getMaster().getWidth(); this.initialHeight = polyUI.getMaster().getHeight(); - this.blurs = blurs; + this.blurs = false; //todo fix blur this.pauses = pauses; this.close = onClose; //#if MC <= 1.12.2 @@ -239,7 +239,7 @@ public boolean isPausingScreen() { @Override public boolean hasBackgroundBlur() { - return blurs; + return false; } From 4c4c05206bd81395c5f821d2a3179bcf07c66080 Mon Sep 17 00:00:00 2001 From: Wyvest Date: Thu, 4 Dec 2025 06:04:35 -0500 Subject: [PATCH 09/34] bump textile and apiDump --- gradle/libs.versions.toml | 2 +- modules/config-impl/api/config-impl.api | 33 +++++++++++++++++++++++++ modules/config/api/config.api | 9 ++++--- modules/ui/api/ui.api | 15 +++++++---- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3b391217d..f1ad67825 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ copycat = "0.1.3" copycat-image-awt = "0.1.1" # Per version -textile = "1.0.0-beta.8" +textile = "1.0.0-beta.9" omnicore = "1.0.0-beta.38" lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader diff --git a/modules/config-impl/api/config-impl.api b/modules/config-impl/api/config-impl.api index 91e6cc320..9d0db0d00 100644 --- a/modules/config-impl/api/config-impl.api +++ b/modules/config-impl/api/config-impl.api @@ -102,74 +102,107 @@ protected final class org/polyfrost/oneconfig/api/config/v1/KtConfig$Provider : } public abstract interface class org/polyfrost/oneconfig/api/config/v1/Visualizer { + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public abstract fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$ButtonVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$CheckboxVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$ColorVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } +public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$DefaultImpls { + public static fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Visualizer;Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public static fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Visualizer;Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; +} + public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$DraggableListVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public synthetic fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/impl/Group; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$DropdownVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$InfoVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public synthetic fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/impl/Group; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$KeybindVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$MultiSelectDropdownVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public synthetic fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/impl/Group; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$NumberVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$RadioVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$SliderVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$SwitchVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } public final class org/polyfrost/oneconfig/api/config/v1/Visualizer$TextVisualizer : org/polyfrost/oneconfig/api/config/v1/Visualizer { public fun ()V + public fun toEnumState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; + public fun toState (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/event/State; public fun visualize (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/polyui/component/Drawable; } diff --git a/modules/config/api/config.api b/modules/config/api/config.api index fef4b2884..f543a39f1 100644 --- a/modules/config/api/config.api +++ b/modules/config/api/config.api @@ -72,12 +72,13 @@ public abstract class org/polyfrost/oneconfig/api/config/v1/Property : org/polyf public fun onDisplayChange (Ljava/util/function/Consumer;)V public fun overwrite (Lorg/polyfrost/oneconfig/api/config/v1/Node;Z)V public static fun recast (Lorg/polyfrost/oneconfig/api/config/v1/Property;)Lorg/polyfrost/oneconfig/api/config/v1/Property; + public final fun removeCallback (Ljava/util/function/Predicate;)Z public fun revaluateDisplay ()V - public final fun set (Ljava/lang/Object;)V + public final fun set (Ljava/lang/Object;)Z protected abstract fun set0 (Ljava/lang/Object;)V - public final fun setAs (Ljava/lang/Object;)V - public final fun setAsReferential (Ljava/lang/Object;)V - public fun setReferential (Ljava/lang/Object;)V + public final fun setAs (Ljava/lang/Object;)Z + public final fun setAsReferential (Ljava/lang/Object;)Z + public fun setReferential (Ljava/lang/Object;)Z public final fun toString ()Ljava/lang/String; } diff --git a/modules/ui/api/ui.api b/modules/ui/api/ui.api index 3e5e9ed9f..69e139b94 100644 --- a/modules/ui/api/ui.api +++ b/modules/ui/api/ui.api @@ -43,6 +43,7 @@ public abstract interface class org/polyfrost/oneconfig/api/ui/v1/UIManager { public abstract fun getDefaultInstance ()Lorg/polyfrost/polyui/PolyUI; public abstract fun getRenderPipeline ()Ldev/deftu/omnicore/api/client/render/pipeline/OmniRenderPipeline; public abstract fun getRenderer ()Lorg/polyfrost/polyui/renderer/Renderer; + public abstract fun getRendererExt ()Lorg/polyfrost/oneconfig/api/ui/v1/api/RendererExt; public abstract fun getTinyFD ()Lorg/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi; } @@ -118,13 +119,18 @@ public abstract interface class org/polyfrost/oneconfig/api/ui/v1/api/NanoVgApi$ public abstract fun NVG_ROUND ()I } +public abstract interface class org/polyfrost/oneconfig/api/ui/v1/api/RendererExt { + public abstract fun dumpAtlas ()V +} + public abstract interface class org/polyfrost/oneconfig/api/ui/v1/api/StbApi { - public abstract fun createFontInfo ()J - public abstract fun createPackContext ()J - public abstract fun createPackRange ()J - public abstract fun createPackedCharArray (I)J + public abstract fun font_CreateFontInfo ()J + public abstract fun font_CreatePackContext ()J + public abstract fun font_CreatePackRange ()J + public abstract fun font_CreatePackedCharArray (I)J public abstract fun font_GetFontVMetrics (J[I[I[I)V public abstract fun font_GetPackedGlyph (JI)J + public abstract fun font_InitFont (JLjava/nio/ByteBuffer;)Z public abstract fun font_PackBegin (JLjava/nio/ByteBuffer;IIIIJ)Z public abstract fun font_PackEnd (J)V public abstract fun font_PackFontRange (JLjava/nio/ByteBuffer;IFIIJ)Z @@ -145,7 +151,6 @@ public abstract interface class org/polyfrost/oneconfig/api/ui/v1/api/StbApi { public abstract fun image_free (Ljava/nio/ByteBuffer;)V public abstract fun image_load_from_memory (Ljava/nio/ByteBuffer;[I[I[II)Ljava/nio/ByteBuffer; public abstract fun image_write_png (Ljava/lang/String;IIILjava/nio/ByteBuffer;I)V - public abstract fun initFont (JLjava/nio/ByteBuffer;)Z } public abstract interface class org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi { From 70e39170c39e553fc44bd102fb602abca34f063e Mon Sep 17 00:00:00 2001 From: Wyvest Date: Thu, 4 Dec 2025 07:11:07 -0500 Subject: [PATCH 10/34] add more disclaimers in TinyFD usage --- .../oneconfig/api/ui/v1/api/TinyFdApi.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi.java index 06807735d..4a567f30d 100644 --- a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi.java +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi.java @@ -53,11 +53,17 @@ public interface TinyFdApi { /** * Open a save file selection prompt. * Same as {@link #openFileSelector(String, String, String[], String)} but says save instead of open. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** */ Path openSaveSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription); /** * Open a file selection prompt. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** * * @param title the title of the prompt * @param defaultFilePath the path to the default file to select @@ -71,17 +77,26 @@ public interface TinyFdApi { /** * Open a multi file selection prompt. * Same as {@link #openFileSelector(String, String, String[], String)} but allows the user to select multiple files. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** */ Path[] openMultiFileSelector(@Nullable String title, @Nullable String defaultFilePath, String[] filterPatterns, @Nullable String filterDescription); /** * Open a folder selection prompt. * Same as {@link #openFileSelector(String, String, String[], String)} but allows the user to select a folder. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** */ Path openFolderSelector(@Nullable String title, @Nullable String defaultFolderPath); /** * Shows a message box. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** * * @param message the message. may contain \n and \t * @param dialog the type of message box to show.
One of: {@link #OK_DIALOG}, {@link #OK_CANCEL_DIALOG}, {@link #YES_NO_DIALOG}, {@link #YES_NO_CANCEL_DIALOG} @@ -93,6 +108,9 @@ public interface TinyFdApi { /** * Shows a notification. + *

+ * On Linux, TinyFD "allows shell metacharacters in titles, messages, and other input data," meaning that it is vulnerable to command injection. + * **Treat all user input as untrusted and sanitize it before passing it to TinyFD.** * * @param icon the icon to use. One of: {@link #QUESTION_ICON}, {@link #ERROR_ICON}, {@link #WARNING_ICON}, {@link #INFO_ICON} * @return 0 if the user clicked the "ok" button, 1 for "cancel" From 89304bdb4d4a9e79dd02dd641e514e4a58be7afd Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:28:58 +0000 Subject: [PATCH 11/34] cleanup and improve font rendering --- .../api/ui/v1/internal/GLRendererImpl.kt | 66 ++++++++----------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index cbfea5e2e..5737b2c5d 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -7,7 +7,7 @@ import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals import org.apache.logging.log4j.LogManager import org.lwjgl.BufferUtils import org.lwjgl.opengl.GL11.* -import org.lwjgl.opengl.GL13 +import org.lwjgl.opengl.GL13.* import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* @@ -25,7 +25,6 @@ import org.polyfrost.polyui.unit.Vec4 import org.polyfrost.polyui.utils.toDirectByteBuffer import org.polyfrost.polyui.utils.toDirectByteBufferNT import java.nio.ByteBuffer -import java.nio.ByteOrder import java.nio.FloatBuffer import kotlin.math.cos import kotlin.math.roundToInt @@ -35,10 +34,9 @@ import kotlin.math.tan private val LOGGER = LogManager.getLogger("PolyUI/GLRenderer") private const val MAX_UI_DEPTH = 16 -private const val FONT_MAX_BITMAP_W = 1024 +private const val FONT_MAX_BITMAP_W = 1536 private const val FONT_MAX_BITMAP_H = 512 private const val ATLAS_SIZE = 2048 -private const val FONT_RENDER_SIZE = 24f // 48f scales nicely to 16f, 12f, 32f, etc. private const val ATLAS_SVG_UPSCALE_FACTOR = 2f private const val STRIDE = 4 + 4 + 4 + 4 + 4 + 1 // bounds, radii, color0, color1, UV, thick private const val MAX_BATCH = 1024 @@ -73,7 +71,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private val buffer = BufferUtils.createFloatBuffer(MAX_BATCH * STRIDE) private val scissorStack = IntArray(MAX_UI_DEPTH * 4) private val transformStack = Array(MAX_UI_DEPTH) { FloatArray(9) } - private val fonts = HashMap() + private val transformBuffer = BufferUtils.createFloatBuffer(9) + private val fonts = HashMap() private val init get() = program != 0 // lateinit @@ -103,11 +102,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var curTex = 0 private var transformDepth = 0 private var curScissor = 0 - private var transform = floatArrayOf( - 1f, 0f, 0f, - 0f, 1f, 0f, - 0f, 0f, 1f - ) + private var transform = IDENTITY.copyOf() private var viewportWidth = 0f private var viewportHeight = 0f private var pixelRatio = 1f @@ -311,9 +306,10 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re @Suppress("SameParameterValue") private fun glUniformMatrix3fv(location: Int, transpose: Boolean, array: FloatArray) { - val buffer = ByteBuffer.allocateDirect(array.size * 4).order(ByteOrder.nativeOrder()).asFloatBuffer().put(array) - buffer.flip() - ShaderInternals.uniformMatrix3(location, transpose, buffer) + val buf = transformBuffer + buf.clear() + buf.put(array).flip() + ShaderInternals.uniformMatrix3(location, transpose, buf) } override fun init() { @@ -465,8 +461,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re popFlushNeeded = false } - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(GL_TEXTURE0) + glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, curTex) // Quad attrib @@ -496,8 +491,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (prevDepth) glEnable(GL_DEPTH_TEST) if (prevCull) glEnable(GL_CULL_FACE) glUseProgram(prevProg) - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(prevActive) + glActiveTexture(prevActive) glBindTexture(GL_TEXTURE_2D, prevTex) glBindBuffer(GL_ARRAY_BUFFER, prevBuf) if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao) @@ -613,7 +607,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun text(font: Font, x: Float, y: Float, text: String, color: Color, fontSize: Float) { - val fAtlas = getFontAtlas(font) + val fAtlas = getFontAtlas(font, fontSize) if (count >= MAX_BATCH) flush() if (count > 0 && curTex != atlas) flush() curTex = atlas @@ -645,7 +639,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun textBounds(font: Font, text: String, fontSize: Float): Vec2 { - return getFontAtlas(font).measure(text, fontSize) + return getFontAtlas(font, fontSize).measure(text, fontSize) } override fun line(x1: Float, y1: Float, x2: Float, y2: Float, color: Color, width: Float) { @@ -825,8 +819,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(GL_TEXTURE0) + glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) @@ -838,8 +831,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } glBindTexture(GL_TEXTURE_2D, prevTex) - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(prevActive) + glActiveTexture(prevActive) if (image.type == PolyImage.Type.Raster) stb.image_free(d) @@ -868,25 +860,29 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } } - private fun getFontAtlas(font: Font): FontAtlas { - return fonts.getOrPut(font) { + private fun getFontAtlas(font: Font, fontSize: Float): FontAtlas { + val renderSize = when(fontSize) { + in 0f..36f -> 24f + else -> 48f + } + return fonts.getOrPut(font.resourcePath.hashCode() + renderSize.toInt()) { val data = font.load { LOGGER.error("Failed to load font: $font", it) - return@getOrPut fonts[PolyUI.defaultFonts.regular] + return@getOrPut fonts[PolyUI.defaultFonts.regular.resourcePath.hashCode() + renderSize.toInt()] ?: throw IllegalStateException("Default font couldn't be loaded") }.toDirectByteBuffer() - FontAtlas(data, FONT_RENDER_SIZE) + FontAtlas(data, renderSize) } } private var i = 0 - fun dumpTexture(texId: Int = atlas) { + override fun dumpAtlas() { val buf = BufferUtils.createByteBuffer(ATLAS_SIZE * ATLAS_SIZE * 4) - glBindTexture(GL_TEXTURE_2D, texId) + glBindTexture(GL_TEXTURE_2D, atlas) glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf) glBindTexture(GL_TEXTURE_2D, 0) stb.image_write_png( - "debug_texture$texId($i).png", + "debug_atlas$i.png", ATLAS_SIZE, ATLAS_SIZE, 4, @@ -896,10 +892,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re i++ } - override fun dumpAtlas() { - dumpTexture(atlas) - } - override fun cleanup() { // dumpAtlas() if (program != 0) glDeleteProgram(program) @@ -1010,8 +1002,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val prevActive = glGetInteger(GL_ACTIVE_TEXTURE) val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(GL_TEXTURE0) + glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0) @@ -1034,8 +1025,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re 2 -> org.lwjgl.opengl.EXTFramebufferObject.glGenerateMipmapEXT(GL_TEXTURE_2D) } glBindTexture(GL_TEXTURE_2D, prevTex) - @Suppress("RemoveRedundantQualifierName") - GL13.glActiveTexture(prevActive) + glActiveTexture(prevActive) slotX += totalSizeX + 1 atlasRowHeight = maxOf(atlasRowHeight, totalSizeY + 1) From ca97ebb8d87c7a6c40f53c36e93f38e9547e8e98 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Sun, 7 Dec 2025 15:47:55 +0000 Subject: [PATCH 12/34] drop shadow, improve font rendering when scale is used --- .../api/ui/v1/internal/GLRendererImpl.kt | 82 ++++++++++++------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 5737b2c5d..6dc12e0ff 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -29,6 +29,7 @@ import java.nio.FloatBuffer import kotlin.math.cos import kotlin.math.roundToInt import kotlin.math.sin +import kotlin.math.sqrt import kotlin.math.tan private val LOGGER = LogManager.getLogger("PolyUI/GLRenderer") @@ -101,7 +102,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var count = 0 private var curTex = 0 private var transformDepth = 0 - private var curScissor = 0 + private var scissorDepth = 0 private var transform = IDENTITY.copyOf() private var viewportWidth = 0f private var viewportHeight = 0f @@ -109,10 +110,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var alphaCap = 1f private var popFlushNeeded = false + // atlas data private var slotX = 0 private var slotY = 0 - - /** current max height of the currently active row in the atlas. */ private var atlasRowHeight = 0 private val FRAG = """ @@ -149,24 +149,24 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re float rRight = mix(r.z, r.y, py); // bottom-right / top-right float radius = mix(rLeft, rRight, px); - vec2 q = abs(p) - (b - vec2(radius)); + vec2 q = abs(p) - (b - radius); return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius; } float hollowRoundedBoxSDF(vec2 p, vec2 b, vec4 r, float thickness) { - float outer = roundedBoxSDF(p, b + vec2(0.2), r); - float inner = roundedBoxSDF(p, b - vec2(thickness), max(r - vec4(thickness), 0.0)); + float outer = roundedBoxSDF(p, b + 0.2, r + 0.2); + float inner = roundedBoxSDF(p, b - thickness, max(r - thickness, 0.0)); return max(outer, -inner); } float roundBoxSDF(vec2 p, vec2 halfSize, float radius) { - vec2 q = abs(p) - (halfSize - vec2(radius)); + vec2 q = abs(p) - (halfSize - radius); return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius; } void main() { - vec2 center = vRect.xy + 0.5 * vRect.zw; vec2 halfSize = 0.5 * vRect.zw; + vec2 center = vRect.xy + halfSize; vec2 p = vPos - center; float d = (vThickness > 0.0) ? hollowRoundedBoxSDF(p, halfSize, vRadii, vThickness) : roundedBoxSDF(p, halfSize, vRadii); @@ -193,6 +193,10 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re float t = clamp((dist + vUV.y * 0.5) / vUV.y, 0.0, 1.0); col = mix(vColor0, vColor1, t); } + else if (vThickness == -5.0) { // drop shadow, vUV.x as spread and vUV.y as blur + float dShadow = roundBoxSDF(p, halfSize + vUV.x, vRadii.x); + col = vec4(vColor0.rgb, vColor0.a * (1.0 - smoothstep(-vUV.y, vUV.y, dShadow))); + } // Proper antialiasing based on distance field float f = fwidth(d); @@ -404,11 +408,12 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun beginFrame(width: Float, height: Float, pixelRatio: Float) { - curScissor = 0 + scissorDepth = 0 alphaCap = 1f count = 0 buffer.clear() transform.set(IDENTITY) + popFlushNeeded = false transformDepth = 0 val prevProg = glGetInteger(GL_CURRENT_PROGRAM) glUseProgram(program) @@ -608,6 +613,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re override fun text(font: Font, x: Float, y: Float, text: String, color: Color, fontSize: Float) { val fAtlas = getFontAtlas(font, fontSize) + val s = transformScale() + val fAtlasForRendering = if (s == 1f) fAtlas else getFontAtlas(font, fontSize * s) if (count >= MAX_BATCH) flush() if (count > 0 && curTex != atlas) flush() curTex = atlas @@ -631,7 +638,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re buffer.put(EMPTY_ROW) // zero radii buffer.put(r).put(g).put(b).put(a) buffer.put(EMPTY_ROW) // color1 unused - buffer.put(glyph, 0, 4) + buffer.put(if (s == 1f) glyph else fAtlasForRendering.get(c), 0, 4) buffer.put(-1f) // thickness = -1 for text penX += glyph.xAdvance * scaleFactor count += 1 @@ -656,7 +663,14 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re spread: Float, radius: Float ) { - // rect(x, y, width, height, ) + if (count >= MAX_BATCH) flush() + buffer.put(x).put(y).put(width).put(height) + buffer.put(EMPTY_ROW) // zero radii + buffer.put(0f).put(0f).put(0f).put(alphaCap) // black, alpha to alphaCap + buffer.put(EMPTY_ROW) // color1 unused + buffer.put(spread).put(blur).put(0f).put(0f) + buffer.put(-5f) // thickness = -5 for drop shadow + count += 1 } override fun pushScissor(x: Float, y: Float, width: Float, height: Float) { @@ -665,24 +679,24 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val ny = (viewportHeight - (y + height) * pixelRatio).roundToInt() val nw = (width * pixelRatio).roundToInt() val nh = (height * pixelRatio).roundToInt() - scissorStack[curScissor++] = nx - scissorStack[curScissor++] = ny - scissorStack[curScissor++] = nw - scissorStack[curScissor++] = nh + scissorStack[scissorDepth++] = nx + scissorStack[scissorDepth++] = ny + scissorStack[scissorDepth++] = nw + scissorStack[scissorDepth++] = nh glEnable(GL_SCISSOR_TEST) glScissor(nx, ny, nw, nh) } override fun pushScissorIntersecting(x: Float, y: Float, width: Float, height: Float) { - if (curScissor < 4) { + if (scissorDepth < 4) { pushScissor(x, y, width, height) return } flush() - val px = scissorStack[curScissor - 4] - val py = scissorStack[curScissor - 3] - val pw = scissorStack[curScissor - 2] - val ph = scissorStack[curScissor - 1] + val px = scissorStack[scissorDepth - 4] + val py = scissorStack[scissorDepth - 3] + val pw = scissorStack[scissorDepth - 2] + val ph = scissorStack[scissorDepth - 1] val nx = (x * pixelRatio).roundToInt() val ny = (viewportHeight - (y + height) * pixelRatio).roundToInt() @@ -691,10 +705,10 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val iw = maxOf(0, minOf(nx + (width * pixelRatio).roundToInt(), px + pw) - ix) val ih = maxOf(0, minOf(ny + (height * pixelRatio).roundToInt(), py + ph) - iy) - scissorStack[curScissor++] = ix - scissorStack[curScissor++] = iy - scissorStack[curScissor++] = iw - scissorStack[curScissor++] = ih + scissorStack[scissorDepth++] = ix + scissorStack[scissorDepth++] = iy + scissorStack[scissorDepth++] = iw + scissorStack[scissorDepth++] = ih glEnable(GL_SCISSOR_TEST) glScissor(ix, iy, iw, ih) @@ -702,16 +716,16 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re override fun popScissor() { flush() - if (curScissor <= 4) { - curScissor = 0 + if (scissorDepth <= 4) { + scissorDepth = 0 glDisable(GL_SCISSOR_TEST) return } - curScissor -= 4 - val x = scissorStack[curScissor - 4] - val y = scissorStack[curScissor - 3] - val width = scissorStack[curScissor - 2] - val height = scissorStack[curScissor - 1] + scissorDepth -= 4 + val x = scissorStack[scissorDepth - 4] + val y = scissorStack[scissorDepth - 3] + val width = scissorStack[scissorDepth - 2] + val height = scissorStack[scissorDepth - 1] glEnable(GL_SCISSOR_TEST) glScissor(x, y, width, height) } @@ -740,6 +754,12 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re popFlushNeeded = true } + private fun transformScale(): Float { + val sx = sqrt(transform[0] * transform[0] + transform[3] * transform[3]) + val sy = sqrt(transform[1] * transform[1] + transform[4] * transform[4]) + return (sx + sy) * 0.5f + } + override fun translate(x: Float, y: Float) { flush() transform[6] += transform[0] * x + transform[3] * y From 58a5fea535f0ace5dfc8e150c3f2c500fcf52a42 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Sun, 7 Dec 2025 16:13:37 +0000 Subject: [PATCH 13/34] fix keying issues (fixes #591) --- .../oneconfig/api/ui/v1/keybind/KeybindManager.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/keybind/KeybindManager.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/keybind/KeybindManager.kt index 82e7690dc..ad68d505c 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/keybind/KeybindManager.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/keybind/KeybindManager.kt @@ -87,16 +87,17 @@ object KeybindManager { try { if (char.isValid() && inputManager.mods <= 2) { // asm: only allow no mod or shift mod for char input if (down) inputManager.keyTyped(char.code) + return } val mod = when (keyCode) { OmniKeys.KEY_LEFT_SHIFT.code -> KeyModifiers.LSHIFT OmniKeys.KEY_LEFT_CONTROL.code -> if (PolyUI.isOnMac) KeyModifiers.LMETA else KeyModifiers.LPRIMARY -// OmniKeys.KEY_LMENU -> KeyModifiers.LSECONDARY -// OmniKeys.KEY_LMETA -> if (PolyUI.isOnMac) KeyModifiers.LPRIMARY else KeyModifiers.LSECONDARY + OmniKeys.KEY_LEFT_ALT.code -> KeyModifiers.LSECONDARY + OmniKeys.KEY_LEFT_SUPER.code -> if (PolyUI.isOnMac) KeyModifiers.LPRIMARY else KeyModifiers.LSECONDARY OmniKeys.KEY_RIGHT_SHIFT.code -> KeyModifiers.RSHIFT OmniKeys.KEY_RIGHT_CONTROL.code -> if (PolyUI.isOnMac) KeyModifiers.RMETA else KeyModifiers.RPRIMARY -// OmniKeys.KEY_RIGHT_MENU -> KeyModifiers.RSECONDARY -// OmniKeys.KEY_RIGHT_META -> if (PolyUI.isOnMac) KeyModifiers.RPRIMARY else KeyModifiers.RSECONDARY + OmniKeys.KEY_RIGHT_ALT.code -> KeyModifiers.RSECONDARY + OmniKeys.KEY_RIGHT_SUPER.code -> if (PolyUI.isOnMac) KeyModifiers.RPRIMARY else KeyModifiers.RSECONDARY else -> null } From c0f952a84e72a03e1f6fb91f1522c59e7ce80c12 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Mon, 8 Dec 2025 12:31:02 +0000 Subject: [PATCH 14/34] fix crashes and radii issue --- gradle/libs.versions.toml | 2 +- .../api/config/v1/ConfigManager.java | 2 ++ .../serialize/adapter/impl/FontAdapter.java | 26 +++++++++++++++++++ .../oneconfig/api/config/v1/Visualizer.kt | 2 +- .../config/v1/internal/ConfigVisualizer.kt | 5 ++-- .../api/ui/v1/internal/GLRendererImpl.kt | 15 ++++------- 6 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/FontAdapter.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f1ad67825..681e7ec15 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" fabric-language-kotlin = "1.13.5+kotlin.2.2.10" google-ksp = "2.2.10-2.0.2" -polyui = "2.0.5" +polyui = "2.0.6" annotations = "24.1.0" hypixel-modapi = "1.0.1" hypixel-data = "0.2.0" # Dep of hypixel-modapi diff --git a/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/ConfigManager.java b/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/ConfigManager.java index f10fb35c6..8c4e28355 100644 --- a/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/ConfigManager.java +++ b/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/ConfigManager.java @@ -37,6 +37,7 @@ import org.polyfrost.oneconfig.api.config.v1.collect.PropertyCollector; import org.polyfrost.oneconfig.api.config.v1.collect.impl.OneConfigCollector; import org.polyfrost.oneconfig.api.config.v1.serialize.ObjectSerializer; +import org.polyfrost.oneconfig.api.config.v1.serialize.adapter.impl.FontAdapter; import org.polyfrost.oneconfig.api.config.v1.serialize.adapter.impl.PolyColorAdapter; import org.polyfrost.oneconfig.api.config.v1.serialize.adapter.impl.Vec4Adapter; import org.polyfrost.oneconfig.api.config.v1.serialize.impl.FileSerializer; @@ -64,6 +65,7 @@ public final class ConfigManager { static { ObjectSerializer.INSTANCE.registerTypeAdapter(new PolyColorAdapter()); + ObjectSerializer.INSTANCE.registerTypeAdapter(new FontAdapter()); ObjectSerializer.INSTANCE.registerTypeAdapter(new Vec4Adapter()); registerCollector(new OneConfigCollector()); } diff --git a/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/FontAdapter.java b/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/FontAdapter.java new file mode 100644 index 000000000..dbf637a18 --- /dev/null +++ b/modules/config-impl/src/main/java/org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/FontAdapter.java @@ -0,0 +1,26 @@ +package org.polyfrost.oneconfig.api.config.v1.serialize.adapter.impl; + +import org.polyfrost.oneconfig.api.config.v1.serialize.adapter.Adapter; +import org.polyfrost.polyui.data.Font; + +public class FontAdapter extends Adapter { + @Override + public Font deserialize(String in) { + return Font.of(in); + } + + @Override + public String serialize(Font in) { + return in.getResourcePath(); + } + + @Override + public Class getTargetClass() { + return Font.class; + } + + @Override + public Class getOutputClass() { + return String.class; + } +} diff --git a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt index 6a7e613ae..89a4eb6c7 100644 --- a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt +++ b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/Visualizer.kt @@ -230,7 +230,7 @@ fun interface Visualizer { placeholder = placeholder, image = "assets/oneconfig/ico/text.svg".image(), size = Vec2(200f, 32f), - value = state, + value = state.value.toFloat().toString(dps = 2), post = unit ) s.getTextFromBoxedTextInput().numeric(min, max, state) diff --git a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt index 3beca1711..ad6e3d601 100644 --- a/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt +++ b/modules/config-impl/src/main/kotlin/org/polyfrost/oneconfig/api/config/v1/internal/ConfigVisualizer.kt @@ -269,7 +269,6 @@ open class ConfigVisualizer { var contentHeight = -1f // asm: signature as it prevents re-wrapping of function val openInsn: Drawable.(Any?) -> Unit = { - open.value = !open.value val arrow = if (enabled != null) this[1][1] else this[1] val anim = Animations.Default.create(0.6.seconds) Rotate(arrow, if (!open.value) PI else 0.0, false, anim).add() @@ -292,13 +291,13 @@ open class ConfigVisualizer { size = 21f, state = open ).onChange(open) { - enabled?.setAs(it) + enabled?.set(it) if (open.value != it) (parent.parent as Drawable).openInsn(null) }, Image("polyui/chevron-down.svg").also { it.rotation = PI } ) // lmao - open.value = !open.value + //open.value = !open.value @Suppress("UNCHECKED_CAST") // reason: #already-type-checked enabled = e as Property } else { diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 6dc12e0ff..3cdee0b25 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -100,7 +100,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re // Current batch state private var count = 0 - private var curTex = 0 private var transformDepth = 0 private var scissorDepth = 0 private var transform = IDENTITY.copyOf() @@ -145,9 +144,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re float py = step(0.0, p.y); // Select radius per quadrant - float rLeft = mix(r.w, r.x, py); // bottom-left / top-left - float rRight = mix(r.z, r.y, py); // bottom-right / top-right - float radius = mix(rLeft, rRight, px); + float rLeft = mix(r.x, r.w, py); // top-left / bottom-left + float rRight = mix(r.y, r.z, py); // top-right / bottom-right + float radius = mix(rLeft, rRight, px); // left vs right vec2 q = abs(p) - (b - radius); return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - radius; @@ -467,7 +466,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } glActiveTexture(GL_TEXTURE0) - glBindTexture(GL_TEXTURE_2D, curTex) + glBindTexture(GL_TEXTURE_2D, atlas) // Quad attrib glBindBuffer(GL_ARRAY_BUFFER, quadVbo) @@ -596,8 +595,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re colorMask: Int, topLeftRadius: Float, topRightRadius: Float, bottomLeftRadius: Float, bottomRightRadius: Float ) { if (count >= MAX_BATCH) flush() - if (count > 0 && curTex != atlas) flush() - curTex = atlas buffer.put(x).put(y).put(width).put(height) buffer.put(topLeftRadius).put(topRightRadius).put(bottomRightRadius).put(bottomLeftRadius) @@ -616,8 +613,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val s = transformScale() val fAtlasForRendering = if (s == 1f) fAtlas else getFontAtlas(font, fontSize * s) if (count >= MAX_BATCH) flush() - if (count > 0 && curTex != atlas) flush() - curTex = atlas var penX = x val scaleFactor = fontSize / fAtlas.renderedSize @@ -918,8 +913,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (quadVbo != 0) glDeleteBuffers(quadVbo) if (instancedVbo != 0) glDeleteBuffers(instancedVbo) if (atlas != 0) glDeleteTextures(atlas) + if (vao != 0) org.lwjgl.opengl.GL30C.glDeleteVertexArrays(vao) fonts.clear() - buffer.clear() } override fun delete(font: Font?) {} From fc1dd0f3dcafa51bf5dc87f1d6b5abe6eb0ef7a5 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:16:46 +0000 Subject: [PATCH 15/34] fix scissoring on GLRenderer --- gradle/libs.versions.toml | 2 +- .../v1/internal/ScreenPlatformImpl.java | 25 +++++++++++++++++ .../ui/v1/internal/wrappers/PolyUIScreen.java | 20 +++----------- .../api/ui/v1/internal/GLRendererImpl.kt | 27 +++++++++---------- .../api/platform/v1/ScreenPlatform.java | 11 ++++++++ 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 681e7ec15..6c20262a1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" fabric-language-kotlin = "1.13.5+kotlin.2.2.10" google-ksp = "2.2.10-2.0.2" -polyui = "2.0.6" +polyui = "2.0.7" annotations = "24.1.0" hypixel-modapi = "1.0.1" hypixel-data = "0.2.0" # Dep of hypixel-modapi diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java index 6e6541c62..234a9c28d 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java @@ -29,7 +29,9 @@ import dev.deftu.omnicore.api.client.render.OmniRenderingContext; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.lwjgl.BufferUtils; import org.polyfrost.oneconfig.api.event.v1.EventDelay; import org.polyfrost.oneconfig.api.hud.v1.LegacyHud; import org.polyfrost.oneconfig.api.platform.v1.ScreenPlatform; @@ -38,6 +40,8 @@ import org.polyfrost.polyui.component.Component; import org.polyfrost.polyui.component.Drawable; +import java.nio.Buffer; +import java.nio.IntBuffer; import java.util.List; public class ScreenPlatformImpl implements ScreenPlatform { @@ -45,6 +49,14 @@ public class ScreenPlatformImpl implements ScreenPlatform { // //$$ private final float[] pixelScaleFactor = new float[1]; // //#endif + private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer( + //#if MC >= 1.13 + //$$ 4 + //#else + 16 + //#endif + ); + @Override public int viewportWidth() { //#if MC>=11502 @@ -81,6 +93,19 @@ public int windowHeight() { //#endif } + @Override + public int @NotNull [] glViewport(int @Nullable [] in) { + ((Buffer) VIEWPORT).clear(); + //#if MC >= 1.13 + //$$ org.lwjgl.opengl.GL11.glGetIntegerv(org.lwjgl.opengl.GL11.GL_VIEWPORT, VIEWPORT); + //#else + org.lwjgl.opengl.GL11.glGetInteger(org.lwjgl.opengl.GL11.GL_VIEWPORT, VIEWPORT); + //#endif + int[] out = in != null ? in : new int[4]; + VIEWPORT.get(out, 0, 4); + return out; + } + public void renderLegacyHuds(OmniRenderingContext ctx) { PolyUI defaultInstance = UIManager.INSTANCE.getDefaultInstance(); Drawable master = defaultInstance.getMaster(); diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index 9fc70937b..b10e04383 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -39,7 +39,6 @@ import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.NotNull; -import org.lwjgl.BufferUtils; import org.polyfrost.oneconfig.api.platform.v1.Platform; import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.oneconfig.api.ui.v1.UIManager; @@ -48,8 +47,6 @@ import org.polyfrost.polyui.component.Drawable; import org.polyfrost.polyui.data.Cursor; -import java.nio.Buffer; -import java.nio.IntBuffer; import java.util.function.Consumer; import static org.lwjgl.opengl.GL11.*; @@ -65,13 +62,7 @@ public class PolyUIScreen extends OmniScreen implements BlurScreen { private final float designedWidth, designedHeight, initialWidth, initialHeight; private final boolean pauses, blurs; private final Consumer close; - private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer( - //#if MC >= 1.13 - //$$ 4 - //#else - 16 - //#endif - ); + private final int[] viewport = new int[4]; //#if MC < 1.13 private int mx, my; @@ -130,12 +121,7 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, //#if MC >= 1.21.5 //$$ kotlin.jvm.functions.Function0 unbind = dev.deftu.omnicore.api.client.framebuffer.OmniFramebuffers.getMain().bind(); //#endif - ((Buffer) VIEWPORT).clear(); - //#if MC >= 1.13 - //$$ glGetIntegerv(GL_VIEWPORT, VIEWPORT); - //#else - glGetInteger(GL_VIEWPORT, VIEWPORT); - //#endif + Platform.screen().glViewport(viewport); float factor = Platform.screen().pixelRatio(); int w = (int) (polyUI.getMaster().getWidth() * factor); int h = (int) (polyUI.getMaster().getHeight() * factor); @@ -143,7 +129,7 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, int y = Platform.screen().viewportHeight() / 2 - h / 2; glViewport(x, y, w, h); polyUI.render(); - glViewport(VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get()); + glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); //#if MC >= 1.21.5 //$$ unbind.invoke(); //#endif diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 3cdee0b25..2b7a0f424 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL13.* import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* +import org.polyfrost.oneconfig.api.platform.v1.Platform import org.polyfrost.oneconfig.api.ui.v1.api.NanoSvgApi import org.polyfrost.oneconfig.api.ui.v1.api.RendererExt import org.polyfrost.oneconfig.api.ui.v1.api.StbApi @@ -99,12 +100,11 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re // Current batch state + private val viewport = IntArray(4) private var count = 0 private var transformDepth = 0 private var scissorDepth = 0 private var transform = IDENTITY.copyOf() - private var viewportWidth = 0f - private var viewportHeight = 0f private var pixelRatio = 1f private var alphaCap = 1f private var popFlushNeeded = false @@ -420,8 +420,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re glUniformMatrix3fv(uTransform, false, transform) glUseProgram(prevProg) glDisable(GL_SCISSOR_TEST) - viewportWidth = width * pixelRatio - viewportHeight = height * pixelRatio + Platform.screen().glViewport(viewport) this.pixelRatio = pixelRatio } @@ -671,7 +670,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re override fun pushScissor(x: Float, y: Float, width: Float, height: Float) { flush() val nx = (x * pixelRatio).roundToInt() - val ny = (viewportHeight - (y + height) * pixelRatio).roundToInt() + val ny = (viewport[3] - (y + height) * pixelRatio).roundToInt() val nw = (width * pixelRatio).roundToInt() val nh = (height * pixelRatio).roundToInt() scissorStack[scissorDepth++] = nx @@ -679,7 +678,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re scissorStack[scissorDepth++] = nw scissorStack[scissorDepth++] = nh glEnable(GL_SCISSOR_TEST) - glScissor(nx, ny, nw, nh) + glScissor(nx + viewport[0], ny + viewport[1], nw, nh) } override fun pushScissorIntersecting(x: Float, y: Float, width: Float, height: Float) { @@ -693,7 +692,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re val pw = scissorStack[scissorDepth - 2] val ph = scissorStack[scissorDepth - 1] val nx = (x * pixelRatio).roundToInt() - val ny = (viewportHeight - (y + height) * pixelRatio).roundToInt() + val ny = (viewport[3] - (y + height) * pixelRatio).roundToInt() val ix = maxOf(nx, px) val iy = maxOf(ny, py) @@ -706,7 +705,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re scissorStack[scissorDepth++] = ih glEnable(GL_SCISSOR_TEST) - glScissor(ix, iy, iw, ih) + glScissor(ix + viewport[0], iy + viewport[1], iw, ih) } override fun popScissor() { @@ -717,12 +716,12 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re return } scissorDepth -= 4 - val x = scissorStack[scissorDepth - 4] - val y = scissorStack[scissorDepth - 3] - val width = scissorStack[scissorDepth - 2] - val height = scissorStack[scissorDepth - 1] + val nx = scissorStack[scissorDepth - 4] + val ny = scissorStack[scissorDepth - 3] + val nw = scissorStack[scissorDepth - 2] + val nh = scissorStack[scissorDepth - 1] glEnable(GL_SCISSOR_TEST) - glScissor(x, y, width, height) + glScissor(nx + viewport[0], ny + viewport[1], nw, nh) } override fun globalAlpha(alpha: Float) { @@ -883,7 +882,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re return fonts.getOrPut(font.resourcePath.hashCode() + renderSize.toInt()) { val data = font.load { LOGGER.error("Failed to load font: $font", it) - return@getOrPut fonts[PolyUI.defaultFonts.regular.resourcePath.hashCode() + renderSize.toInt()] + return@getOrPut fonts[PolyUI.defaultFonts.regular.resourcePath.hashCode() + 12f.toInt()] ?: throw IllegalStateException("Default font couldn't be loaded") }.toDirectByteBuffer() FontAtlas(data, renderSize) diff --git a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java index f0c210dff..b48386422 100644 --- a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java +++ b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java @@ -27,6 +27,7 @@ package org.polyfrost.oneconfig.api.platform.v1; import dev.deftu.omnicore.api.client.render.OmniRenderingContext; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface ScreenPlatform { @@ -39,6 +40,16 @@ public interface ScreenPlatform { int windowHeight(); + /** + * Return the result of glGetInteger(GL_VIEWPORT). + * If in is supplied, it will be set to the result and returned. If not, a new array will be created. + */ + int @NotNull [] glViewport(int @Nullable [] in); + + default int @NotNull [] glViewport() { + return glViewport(null); + } + void renderLegacyHuds(OmniRenderingContext ctx); default float pixelRatio() { From d72f971ff7db51d54d519bddf632212cef18898f Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:25:32 +0000 Subject: [PATCH 16/34] dump --- modules/config-impl/api/config-impl.api | 10 ++++++++++ modules/utils/api/utils.api | 2 ++ 2 files changed, 12 insertions(+) diff --git a/modules/config-impl/api/config-impl.api b/modules/config-impl/api/config-impl.api index 9d0db0d00..36c634f34 100644 --- a/modules/config-impl/api/config-impl.api +++ b/modules/config-impl/api/config-impl.api @@ -474,6 +474,16 @@ public final class org/polyfrost/oneconfig/api/config/v1/dsl/Tree_extensionsKt { public static final fun setVisualizer (Lorg/polyfrost/oneconfig/api/config/v1/Property;Ljava/lang/Class;)V } +public class org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/FontAdapter : org/polyfrost/oneconfig/api/config/v1/serialize/adapter/Adapter { + public fun ()V + public synthetic fun deserialize (Ljava/lang/Object;)Ljava/lang/Object; + public fun deserialize (Ljava/lang/String;)Lorg/polyfrost/polyui/data/Font; + public fun getOutputClass ()Ljava/lang/Class; + public fun getTargetClass ()Ljava/lang/Class; + public synthetic fun serialize (Ljava/lang/Object;)Ljava/lang/Object; + public fun serialize (Lorg/polyfrost/polyui/data/Font;)Ljava/lang/String; +} + public class org/polyfrost/oneconfig/api/config/v1/serialize/adapter/impl/PolyColorAdapter : org/polyfrost/oneconfig/api/config/v1/serialize/adapter/Adapter { public fun ()V public synthetic fun deserialize (Ljava/lang/Object;)Ljava/lang/Object; diff --git a/modules/utils/api/utils.api b/modules/utils/api/utils.api index 94d93d681..2bc9a2b66 100644 --- a/modules/utils/api/utils.api +++ b/modules/utils/api/utils.api @@ -78,6 +78,8 @@ public abstract interface class org/polyfrost/oneconfig/api/platform/v1/ScreenPl public abstract fun current ()Ljava/lang/Object; public fun display (Ljava/lang/Object;)V public abstract fun display (Ljava/lang/Object;I)V + public fun glViewport ()[I + public abstract fun glViewport ([I)[I public fun pixelRatio ()F public abstract fun renderLegacyHuds (Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;)V public abstract fun viewportHeight ()I From 62b79594bebedda3a24e3b4c229da102538bc4fd Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:02:11 +0000 Subject: [PATCH 17/34] implement MC text with MC renderer, move Platform.screen().glViewport, remove old code from LegacyHud --- .../platform/v1/internal/GLPlatformImpl.java | 31 ++++++++++++- .../v1/internal/ScreenPlatformImpl.java | 45 ------------------- .../api/ui/v1/internal/UIManagerImpl.java | 26 +++++++++-- .../ui/v1/internal/wrappers/PolyUIScreen.java | 2 +- modules/hud/api/hud.api | 4 +- .../oneconfig/api/hud/v1/LegacyHud.kt | 24 +++------- .../oneconfig/api/hud/v1/internal/hudpages.kt | 5 +-- modules/ui/api/ui.api | 3 ++ .../oneconfig/api/ui/v1/UIManager.java | 23 +++++++++- .../api/ui/v1/internal/GLRendererImpl.kt | 18 +++++++- .../api/ui/v1/internal/NVGRendererImpl.kt | 3 +- modules/utils/api/utils.api | 7 ++- .../oneconfig/api/platform/v1/GLPlatform.java | 15 ++++++- .../api/platform/v1/ScreenPlatform.java | 14 ------ 14 files changed, 121 insertions(+), 99 deletions(-) diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/GLPlatformImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/GLPlatformImpl.java index e2a185d3c..619ae55ac 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/GLPlatformImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/GLPlatformImpl.java @@ -27,9 +27,17 @@ package org.polyfrost.oneconfig.api.platform.v1.internal; import dev.deftu.omnicore.api.client.render.state.OmniRenderStates; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.BufferUtils; import org.polyfrost.oneconfig.api.platform.v1.GLPlatform; import org.polyfrost.oneconfig.utils.v1.MHUtils; +import java.nio.Buffer; +import java.nio.IntBuffer; + +import static org.lwjgl.opengl.GL11.*; + public class GLPlatformImpl implements GLPlatform { //@formatter:off //#if MC <= 1.12.2 @@ -38,6 +46,14 @@ public class GLPlatformImpl implements GLPlatform { .logIfErr().getOrElse(v -> 0L); //#endif + private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer( + //#if MC >= 1.13 + //$$ 4 + //#else + 16 + //#endif + ); + @Override public long getFunctionAddress(String addr) { //#if MC <= 1.12.2 @@ -53,7 +69,7 @@ public long getFunctionAddress(String addr) { * to match what NanoVG leaves dropped into the OpenGL context. */ @Override - public void updateGameRenderStateAlongsideNanoVG() { + public void syncOpenGLContext() { OmniRenderStates.syncBlend(); OmniRenderStates.syncDepth(); OmniRenderStates.syncCull(); @@ -63,4 +79,17 @@ public void updateGameRenderStateAlongsideNanoVG() { //$$ com.mojang.blaze3d.vertex.BufferUploader.reset(); //#endif } + + @Override + public int @NotNull [] glViewport(int @Nullable [] in) { + ((Buffer) VIEWPORT).clear(); + //#if MC >= 1.13 + //$$ glGetIntegerv(GL_VIEWPORT, VIEWPORT); + //#else + glGetInteger(GL_VIEWPORT, VIEWPORT); + //#endif + int[] out = in != null ? in : new int[4]; + VIEWPORT.get(out, 0, 4); + return out; + } } diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java index 234a9c28d..59f5dbd9f 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java @@ -26,37 +26,17 @@ package org.polyfrost.oneconfig.api.platform.v1.internal; -import dev.deftu.omnicore.api.client.render.OmniRenderingContext; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.lwjgl.BufferUtils; import org.polyfrost.oneconfig.api.event.v1.EventDelay; -import org.polyfrost.oneconfig.api.hud.v1.LegacyHud; import org.polyfrost.oneconfig.api.platform.v1.ScreenPlatform; -import org.polyfrost.oneconfig.api.ui.v1.UIManager; -import org.polyfrost.polyui.PolyUI; -import org.polyfrost.polyui.component.Component; -import org.polyfrost.polyui.component.Drawable; - -import java.nio.Buffer; -import java.nio.IntBuffer; -import java.util.List; public class ScreenPlatformImpl implements ScreenPlatform { // //#if MC > 1.13 // //$$ private final float[] pixelScaleFactor = new float[1]; // //#endif - private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer( - //#if MC >= 1.13 - //$$ 4 - //#else - 16 - //#endif - ); - @Override public int viewportWidth() { //#if MC>=11502 @@ -93,31 +73,6 @@ public int windowHeight() { //#endif } - @Override - public int @NotNull [] glViewport(int @Nullable [] in) { - ((Buffer) VIEWPORT).clear(); - //#if MC >= 1.13 - //$$ org.lwjgl.opengl.GL11.glGetIntegerv(org.lwjgl.opengl.GL11.GL_VIEWPORT, VIEWPORT); - //#else - org.lwjgl.opengl.GL11.glGetInteger(org.lwjgl.opengl.GL11.GL_VIEWPORT, VIEWPORT); - //#endif - int[] out = in != null ? in : new int[4]; - VIEWPORT.get(out, 0, 4); - return out; - } - - public void renderLegacyHuds(OmniRenderingContext ctx) { - PolyUI defaultInstance = UIManager.INSTANCE.getDefaultInstance(); - Drawable master = defaultInstance.getMaster(); - List children = master.getChildren(); - if (children == null || children.isEmpty()) return; - - for (Component child : children) { - if (!(child instanceof LegacyHud.LegacyHudComponent)) continue; - ((LegacyHud.LegacyHudComponent) child).renderLegacy(ctx); - } - } - // todo: https://github.com/Polyfrost/OneConfig/issues/478 // this override was removed to avoid the system receiving incorrect/inaccurate pixel ratio values // while the window was being resized (as it was calculated based on viewport / window size) diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java index eaa539c46..fa45c0621 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java @@ -41,6 +41,7 @@ import dev.deftu.omnicore.api.client.render.GlCapabilities; import dev.deftu.omnicore.api.client.render.pipeline.OmniRenderPipeline; import dev.deftu.omnicore.api.client.render.pipeline.OmniRenderPipelines; +import dev.deftu.omnicore.api.client.render.OmniRenderingContext; import dev.deftu.omnicore.api.client.render.state.OmniBlendState; import dev.deftu.omnicore.api.client.screen.OmniScreen; import net.minecraft.client.Minecraft; @@ -54,6 +55,7 @@ import org.polyfrost.oneconfig.api.ui.v1.internal.wrappers.MCWindow; import org.polyfrost.oneconfig.api.ui.v1.internal.wrappers.PolyUIScreen; import org.polyfrost.polyui.PolyUI; +import org.polyfrost.polyui.data.Font; import org.polyfrost.polyui.renderer.Renderer; import org.polyfrost.polyui.renderer.Window; @@ -67,15 +69,18 @@ public class UIManagerImpl implements UIManager { private static final String LWJGL_API_PACKAGE = "org.polyfrost.oneconfig.api.ui.v1.api."; private static final String LWJGL_IMPL_PACKAGE = "org.polyfrost.oneconfig.api.ui.v1.internal."; + private static final Font MC_FONT = Font.of("minecraft/assets/fonts/nowhere", null, false, Font.Weight.Regular); + private static final Logger LOGGER = LogManager.getLogger("OneConfig/LWJGL"); private PolyUI ui; private OmniRenderPipeline pipeline; + private OmniRenderingContext ctx; private final Set classLoaderInclude = new HashSet<>(); private final Map> classCache = new HashMap<>(); - private final NanoVgApi nanoVg; +// private final NanoVgApi nanoVg; private final NanoSvgApi nanoSvg; private final StbApi stb; private final TinyFdApi tinyFD; @@ -114,12 +119,12 @@ public UIManagerImpl() throws Throwable { boolean isGl3 = GlCapabilities.isGl3Available(); //#if MC >= 1.16.5 - //$$ nanoVg = new NanoVgImpl(isGl3); +// //$$ nanoVg = new NanoVgImpl(isGl3); //$$ nanoSvg = new NanoSvgImpl(); //$$ stb = new StbImpl(); //$$ tinyFD = new TinyFdImpl(); //#else - nanoVg = Lwjgl3Manager.getIsolated(NanoVgApi.class, LWJGL_IMPL_PACKAGE + "NanoVgImpl", isGl3); +// nanoVg = Lwjgl3Manager.getIsolated(NanoVgApi.class, LWJGL_IMPL_PACKAGE + "NanoVgImpl", isGl3); nanoSvg = Lwjgl3Manager.getIsolated(NanoSvgApi.class, LWJGL_IMPL_PACKAGE + "NanoSvgImpl"); stb = Lwjgl3Manager.getIsolated(StbApi.class, LWJGL_IMPL_PACKAGE + "StbImpl"); tinyFD = Lwjgl3Manager.getIsolated(TinyFdApi.class, LWJGL_IMPL_PACKAGE + "TinyFdImpl"); @@ -173,4 +178,19 @@ public OmniRenderPipeline getRenderPipeline() { return pipeline; } + + @Override + public void __setRenderingContext(OmniRenderingContext renderingContext) { + ctx = renderingContext; + } + + @Override + public OmniRenderingContext getRenderingContext() { + return ctx; + } + + @Override + public Font getMCFont() { + return MC_FONT; + } } diff --git a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java index b10e04383..b911666cf 100644 --- a/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java +++ b/minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java @@ -121,7 +121,7 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY, //#if MC >= 1.21.5 //$$ kotlin.jvm.functions.Function0 unbind = dev.deftu.omnicore.api.client.framebuffer.OmniFramebuffers.getMain().bind(); //#endif - Platform.screen().glViewport(viewport); + Platform.gl().glViewport(viewport); float factor = Platform.screen().pixelRatio(); int w = (int) (polyUI.getMaster().getWidth() * factor); int h = (int) (polyUI.getMaster().getHeight() * factor); diff --git a/modules/hud/api/hud.api b/modules/hud/api/hud.api index 4c62331c1..0da2ebebe 100644 --- a/modules/hud/api/hud.api +++ b/modules/hud/api/hud.api @@ -94,8 +94,7 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/LegacyHud : org/polyfro public static synthetic fun createLegacy-Op45VSw$default (Lorg/polyfrost/oneconfig/api/hud/v1/LegacyHud;[Lorg/polyfrost/polyui/component/Component;Lorg/polyfrost/polyui/unit/Align;JZILjava/lang/Object;)Lorg/polyfrost/oneconfig/api/hud/v1/LegacyHud$LegacyHudComponent; public abstract fun getHeight ()F public abstract fun getWidth ()F - public fun render (Lorg/polyfrost/polyui/renderer/Renderer;Lorg/polyfrost/polyui/component/Drawable;)V - public abstract fun renderLegacy (Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;FFFF)V + public abstract fun renderLegacy (Lorg/polyfrost/polyui/renderer/Renderer;Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;FFFFLorg/polyfrost/polyui/component/Drawable;)V public abstract fun setHeight (F)V public abstract fun setWidth (F)V } @@ -106,7 +105,6 @@ public class org/polyfrost/oneconfig/api/hud/v1/LegacyHud$LegacyHudComponent : o public fun getHeight ()F public fun getWidth ()F protected fun render ()V - public final fun renderLegacy (Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;)V public fun setHeight (F)V public fun setWidth (F)V } diff --git a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/LegacyHud.kt b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/LegacyHud.kt index 056bb0456..5a96e9090 100644 --- a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/LegacyHud.kt +++ b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/LegacyHud.kt @@ -30,6 +30,7 @@ import dev.deftu.omnicore.api.client.render.OmniRenderingContext import dev.deftu.omnicore.api.client.render.OmniResolution import org.jetbrains.annotations.ApiStatus import org.polyfrost.oneconfig.api.platform.v1.Platform +import org.polyfrost.oneconfig.api.ui.v1.UIManager import org.polyfrost.polyui.component.Component import org.polyfrost.polyui.component.Drawable import org.polyfrost.polyui.renderer.Renderer @@ -38,7 +39,7 @@ import org.polyfrost.polyui.unit.AlignDefault import org.polyfrost.polyui.unit.Vec2 /** - * [Hud] implementation that uses the old rendering system, with a standard [render] method. + * [Hud] implementation that uses the old rendering system. * * **You must** ensure that the [width] and [height] properties accurately reflect the size of the HUD. * Note that they are only queried when the HUD is first created, and when the [update] method returns `true`. @@ -69,18 +70,7 @@ abstract class LegacyHud(id: String, title: String, category: Category) : Hud PolyUI.monospaceFont - 2 -> mcFont.get(text.fontWeight, text.italic) + 2 -> UIManager.INSTANCE.mcFont else -> text.polyUI.fonts.get(text.fontWeight, text.italic) } text._parent?.recalculate(false) diff --git a/modules/ui/api/ui.api b/modules/ui/api/ui.api index 69e139b94..3e8776876 100644 --- a/modules/ui/api/ui.api +++ b/modules/ui/api/ui.api @@ -37,13 +37,16 @@ public final class org/polyfrost/oneconfig/api/ui/v1/OCPolyUIBuilder : org/polyf public abstract interface class org/polyfrost/oneconfig/api/ui/v1/UIManager { public static final field INSTANCE Lorg/polyfrost/oneconfig/api/ui/v1/UIManager; + public abstract fun __setRenderingContext (Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;)V public fun createDefault ()Lorg/polyfrost/polyui/PolyUI; public abstract fun createPolyUIScreen (Lorg/polyfrost/polyui/PolyUI;FFZZLjava/util/function/Consumer;)Ldev/deftu/omnicore/api/client/screen/OmniScreen; public abstract fun createWindow ()Lorg/polyfrost/polyui/renderer/Window; public abstract fun getDefaultInstance ()Lorg/polyfrost/polyui/PolyUI; + public abstract fun getMCFont ()Lorg/polyfrost/polyui/data/Font; public abstract fun getRenderPipeline ()Ldev/deftu/omnicore/api/client/render/pipeline/OmniRenderPipeline; public abstract fun getRenderer ()Lorg/polyfrost/polyui/renderer/Renderer; public abstract fun getRendererExt ()Lorg/polyfrost/oneconfig/api/ui/v1/api/RendererExt; + public abstract fun getRenderingContext ()Ldev/deftu/omnicore/api/client/render/OmniRenderingContext; public abstract fun getTinyFD ()Lorg/polyfrost/oneconfig/api/ui/v1/api/TinyFdApi; } diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java index 77f941472..e911aa8a7 100644 --- a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java @@ -56,6 +56,7 @@ import org.polyfrost.polyui.Settings; import org.polyfrost.polyui.component.Component; import org.polyfrost.polyui.component.Drawable; +import org.polyfrost.polyui.data.Font; import org.polyfrost.polyui.renderer.Renderer; import org.polyfrost.polyui.renderer.Window; @@ -65,6 +66,7 @@ /** * Abstraction over the LWJGL3 implementation and loading. */ +@SuppressWarnings("DeprecatedIsStillUsed") public interface UIManager { UIManager INSTANCE = ServiceLoader.load( UIManager.class, @@ -113,6 +115,25 @@ public interface UIManager { OmniRenderPipeline getRenderPipeline(); + /** + * Return the current rendering context of the default UI instance. + * This method is internal as, well, you shouldn't have any reason to use it. + *
+ * In fact, if you are using it, please let us know on the GitHub issues page. + */ + @ApiStatus.Internal + OmniRenderingContext getRenderingContext(); + + /** + *

don't use this method!!

+ *
if you do, I don't like you. you will probably break like, everything. + */ + @Deprecated + @ApiStatus.Internal + void __setRenderingContext(OmniRenderingContext renderingContext); + + Font getMCFont(); + /** *

don't use this method!!

*/ @@ -138,8 +159,8 @@ default PolyUI createDefault() { framebuffer.clearDepthStencil(1.0, 0); framebuffer.usingToRender((matrixStack, w, h) -> { ctx.pose().runReplacingGlobalState(() -> { + __setRenderingContext(ctx); polyUI.render(); - Platform.screen().renderLegacyHuds(ctx); }); return Unit.INSTANCE; diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 2b7a0f424..5f1681f59 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -3,6 +3,8 @@ package org.polyfrost.oneconfig.api.ui.v1.internal import dev.deftu.omnicore.api.client.render.GlCapabilities +import dev.deftu.omnicore.api.client.render.OmniTextRenderer +import dev.deftu.omnicore.api.color.OmniColor import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals import org.apache.logging.log4j.LogManager import org.lwjgl.BufferUtils @@ -12,6 +14,7 @@ import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* import org.polyfrost.oneconfig.api.platform.v1.Platform +import org.polyfrost.oneconfig.api.ui.v1.UIManager import org.polyfrost.oneconfig.api.ui.v1.api.NanoSvgApi import org.polyfrost.oneconfig.api.ui.v1.api.RendererExt import org.polyfrost.oneconfig.api.ui.v1.api.StbApi @@ -420,7 +423,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re glUniformMatrix3fv(uTransform, false, transform) glUseProgram(prevProg) glDisable(GL_SCISSOR_TEST) - Platform.screen().glViewport(viewport) + Platform.gl().glViewport(viewport) this.pixelRatio = pixelRatio } @@ -608,6 +611,15 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun text(font: Font, x: Float, y: Float, text: String, color: Color, fontSize: Float) { + if (font === UIManager.INSTANCE.mcFont) { + val ctx = UIManager.INSTANCE.renderingContext + // todo hi deftu https://github.com/Deftu/OmniCore/issues/57 +// ctx.pose.push(OmniMatrix3f(transform)) + // asm: can be optimized by https://github.com/Deftu/OmniCore/issues/58 + OmniTextRenderer.render(ctx.pose, text, x, y, OmniColor.argb(color.argb), false) +// ctx.pose.pop() + return + } val fAtlas = getFontAtlas(font, fontSize) val s = transformScale() val fAtlasForRendering = if (s == 1f) fAtlas else getFontAtlas(font, fontSize * s) @@ -640,7 +652,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun textBounds(font: Font, text: String, fontSize: Float): Vec2 { - return getFontAtlas(font, fontSize).measure(text, fontSize) + return if (font === UIManager.INSTANCE.mcFont) { + Vec2(OmniTextRenderer.width(text).toFloat(), OmniTextRenderer.lineHeight.toFloat()) + } else getFontAtlas(font, fontSize).measure(text, fontSize) } override fun line(x1: Float, y1: Float, x2: Float, y2: Float, color: Color, width: Float) { diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/NVGRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/NVGRendererImpl.kt index 0dacb64c2..52a928dda 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/NVGRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/NVGRendererImpl.kt @@ -30,7 +30,6 @@ import dev.deftu.omnicore.api.client.render.OmniTextureUnit import dev.deftu.omnicore.api.paddedMinecraftVersion import dev.deftu.omnicore.internal.client.textures.TextureInternals import org.apache.logging.log4j.LogManager -import org.lwjgl.nanovg.NanoVG import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL20 import org.lwjgl.opengl.GL30 @@ -176,7 +175,7 @@ class NVGRendererImpl( GL11.glPopAttrib() } - Platform.gl().updateGameRenderStateAlongsideNanoVG() + Platform.gl().syncOpenGLContext() if (mcVersion >= 1_16_05) { if (prevProgram != -1) { diff --git a/modules/utils/api/utils.api b/modules/utils/api/utils.api index 2bc9a2b66..cdcf7f51e 100644 --- a/modules/utils/api/utils.api +++ b/modules/utils/api/utils.api @@ -53,7 +53,9 @@ public abstract interface class org/polyfrost/oneconfig/api/platform/v1/Compatib public abstract interface class org/polyfrost/oneconfig/api/platform/v1/GLPlatform { public abstract fun getFunctionAddress (Ljava/lang/String;)J - public abstract fun updateGameRenderStateAlongsideNanoVG ()V + public fun glViewport ()[I + public abstract fun glViewport ([I)[I + public abstract fun syncOpenGLContext ()V } public abstract interface class org/polyfrost/oneconfig/api/platform/v1/I18nPlatform { @@ -78,10 +80,7 @@ public abstract interface class org/polyfrost/oneconfig/api/platform/v1/ScreenPl public abstract fun current ()Ljava/lang/Object; public fun display (Ljava/lang/Object;)V public abstract fun display (Ljava/lang/Object;I)V - public fun glViewport ()[I - public abstract fun glViewport ([I)[I public fun pixelRatio ()F - public abstract fun renderLegacyHuds (Ldev/deftu/omnicore/api/client/render/OmniRenderingContext;)V public abstract fun viewportHeight ()I public abstract fun viewportWidth ()I public abstract fun windowHeight ()I diff --git a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/GLPlatform.java b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/GLPlatform.java index 7070d6478..f5b168d12 100644 --- a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/GLPlatform.java +++ b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/GLPlatform.java @@ -26,6 +26,9 @@ package org.polyfrost.oneconfig.api.platform.v1; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + public interface GLPlatform { /** @@ -36,6 +39,16 @@ public interface GLPlatform { */ long getFunctionAddress(String addr); - void updateGameRenderStateAlongsideNanoVG(); + void syncOpenGLContext(); + + /** + * Return the result of glGetInteger(GL_VIEWPORT). + * If in is supplied, it will be set to the result and returned. If not, a new array will be created. + */ + int @NotNull [] glViewport(int @Nullable [] in); + + default int @NotNull [] glViewport() { + return glViewport(null); + } } diff --git a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java index b48386422..240b8d0eb 100644 --- a/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java +++ b/modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java @@ -26,8 +26,6 @@ package org.polyfrost.oneconfig.api.platform.v1; -import dev.deftu.omnicore.api.client.render.OmniRenderingContext; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface ScreenPlatform { @@ -40,18 +38,6 @@ public interface ScreenPlatform { int windowHeight(); - /** - * Return the result of glGetInteger(GL_VIEWPORT). - * If in is supplied, it will be set to the result and returned. If not, a new array will be created. - */ - int @NotNull [] glViewport(int @Nullable [] in); - - default int @NotNull [] glViewport() { - return glViewport(null); - } - - void renderLegacyHuds(OmniRenderingContext ctx); - default float pixelRatio() { return (float) viewportWidth() / windowWidth(); } From cc412aa9591372342a6320b3921dcb368b9e755f Mon Sep 17 00:00:00 2001 From: Wyvest Date: Wed, 10 Dec 2025 04:42:45 -0500 Subject: [PATCH 18/34] bump to 181 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 0b58527de..146a69938 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,4 @@ dgt.minecraft.revision=3 # Project Configuration project.group=org.polyfrost.oneconfig project.name=OneConfig -project.version=1.0.0-alpha.180 +project.version=1.0.0-alpha.181 From 82016023eff49075050c81ed007b7c0327df3156 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:01:05 +0000 Subject: [PATCH 19/34] updates and fixes --- gradle/libs.versions.toml | 2 +- .../api/ui/v1/internal/GLRendererImpl.kt | 164 +++++++++++------- 2 files changed, 101 insertions(+), 65 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6c20262a1..8bf6b1d8d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,7 +22,7 @@ copycat-image-awt = "0.1.1" # Per version textile = "1.0.0-beta.9" -omnicore = "1.0.0-beta.38" +omnicore = "1.0.0-beta.39" lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader # Legacy only diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 5f1681f59..1013211b7 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -4,7 +4,9 @@ package org.polyfrost.oneconfig.api.ui.v1.internal import dev.deftu.omnicore.api.client.render.GlCapabilities import dev.deftu.omnicore.api.client.render.OmniTextRenderer +import dev.deftu.omnicore.api.client.render.stack.OmniPoseStack import dev.deftu.omnicore.api.color.OmniColor +import dev.deftu.omnicore.api.math.OmniMatrix3f import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals import org.apache.logging.log4j.LogManager import org.lwjgl.BufferUtils @@ -30,11 +32,7 @@ import org.polyfrost.polyui.utils.toDirectByteBuffer import org.polyfrost.polyui.utils.toDirectByteBufferNT import java.nio.ByteBuffer import java.nio.FloatBuffer -import kotlin.math.cos -import kotlin.math.roundToInt -import kotlin.math.sin -import kotlin.math.sqrt -import kotlin.math.tan +import kotlin.math.* private val LOGGER = LogManager.getLogger("PolyUI/GLRenderer") @@ -43,7 +41,7 @@ private const val FONT_MAX_BITMAP_W = 1536 private const val FONT_MAX_BITMAP_H = 512 private const val ATLAS_SIZE = 2048 private const val ATLAS_SVG_UPSCALE_FACTOR = 2f -private const val STRIDE = 4 + 4 + 4 + 4 + 4 + 1 // bounds, radii, color0, color1, UV, thick +private const val STRIDE = 4 + 4 + 1 + 1 + 4 + 1 // bounds, radii, color0, color1, UV, thick private const val MAX_BATCH = 1024 private val EMPTY_ROW = floatArrayOf(0f, 0f, 0f, 0f) @@ -109,7 +107,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private var scissorDepth = 0 private var transform = IDENTITY.copyOf() private var pixelRatio = 1f - private var alphaCap = 1f + private var alphaCap = 255 private var popFlushNeeded = false // atlas data @@ -210,19 +208,22 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re private val VERT = """ #version $$$ // replaced by compileShader + #extension GL_EXT_gpu_shader4 : enable #if __VERSION__ >= 130 #define ATTRIBUTE in #define VARYING out + #define U_INT uint #else #define ATTRIBUTE attribute #define VARYING varying + #define U_INT unsigned int #endif ATTRIBUTE vec2 aLocal; ATTRIBUTE vec4 iRect; ATTRIBUTE vec4 iRadii; - ATTRIBUTE vec4 iColor0; - ATTRIBUTE vec4 iColor1; + ATTRIBUTE U_INT iColor0; + ATTRIBUTE U_INT iColor1; ATTRIBUTE vec4 iUVRect; ATTRIBUTE float iThickness; @@ -241,6 +242,15 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re VARYING vec2 vUV; VARYING vec2 vUV2; VARYING float vThickness; + + vec4 unpackColor(U_INT c) { + float a = float((c >> 24) & 0xFFu) / 255.0; + float r = float((c >> 16) & 0xFFu) / 255.0; + float g = float((c >> 8) & 0xFFu) / 255.0; + float b = float((c ) & 0xFFu) / 255.0; + + return vec4(r, g, b, a); + } void main() { // Position inside rect @@ -257,8 +267,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re vPos = pos; vRect = iRect; vRadii = iRadii; - vColor0 = iColor0; - vColor1 = iColor1; + vColor0 = unpackColor(iColor0); + vColor1 = unpackColor(iColor1); vUV = uv; // pass through for gradients. vUV2 = iUVRect.zw; @@ -318,6 +328,14 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re ShaderInternals.uniformMatrix3(location, transpose, buf) } + @kotlin.internal.InlineOnly + private inline fun Int.capAlpha(): Int { + val a = (this ushr 24) and 0xFF + val capped = if (a > alphaCap) alphaCap else a + return (capped shl 24) or (this and 0x00FFFFFF) + } + + override fun init() { if (init) return // check if instancing extension is available @@ -340,18 +358,19 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } else { // gl2 check val extensions = glGetString(GL_EXTENSIONS) ?: "" + require("GL_EXT_gpu_shader4" in extensions) { "GL_EXT_gpu_shader4 is not supported and is required" } require("GL_ARB_instanced_arrays" in extensions) { "GL_ARB_instanced_arrays is not supported and is required" } require("GL_ARB_draw_instanced" in extensions) { "GL_ARB_draw_instanced is not supported and is required" } - if ("GL_EXT_framebuffer_object" in extensions) { - LOGGER.info("Using mipmaps as extension GL_EXT_framebuffer_object is available") - mipmapMode = 2 - } +// if ("GL_EXT_framebuffer_object" in extensions) { +// LOGGER.info("Using mipmaps as extension GL_EXT_framebuffer_object is available") +// mipmapMode = 2 +// } } } if (GlCapabilities.isGl3Available) { - LOGGER.info("Using mipmaps and VAOs as OpenGL 3+ is available.") - mipmapMode = 1 +// LOGGER.info("Using mipmaps and VAOs as OpenGL 3+ is available.") +// mipmapMode = 1 // ...ok I guess this is needed vao = org.lwjgl.opengl.GL30.glGenVertexArrays() org.lwjgl.opengl.GL30.glBindVertexArray(vao) @@ -359,8 +378,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re program = linkProgram(compileShader(GL_VERTEX_SHADER, VERT), compileShader(GL_FRAGMENT_SHADER, FRAG)) - if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(0) - val prevBuf = glGetInteger(GL_ARRAY_BUFFER_BINDING) val quadData = BufferUtils.createFloatBuffer(8).put( floatArrayOf( @@ -376,7 +393,6 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re instancedVbo = glGenBuffers() glBindBuffer(GL_ARRAY_BUFFER, instancedVbo) glBufferData(GL_ARRAY_BUFFER, MAX_BATCH * STRIDE * 4L, GL_STREAM_DRAW) - glBindBuffer(GL_ARRAY_BUFFER, prevBuf) uWindow = glGetUniformLocation(program, "uWindow") uTransform = glGetUniformLocation(program, "uTransform") @@ -388,6 +404,21 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re iUVRect = glGetAttribLocation(program, "iUVRect") iThickness = glGetAttribLocation(program, "iThickness") + if (GlCapabilities.isGl3Available) { + var offset = 0L + offset = enableAttrib(iRect, 4, offset) + offset = enableAttrib(iRadii, 4, offset) + offset = enableAttrib(iColor0, 1, offset, GL_UNSIGNED_INT) + offset = enableAttrib(iColor1, 1, offset, GL_UNSIGNED_INT) + offset = enableAttrib(iUVRect, 4, offset) + enableAttrib(iThickness, 1, offset) + + glBindBuffer(GL_ARRAY_BUFFER, quadVbo) + glEnableVertexAttribArray(aLocal) + glVertexAttribPointer(aLocal, 2, GL_FLOAT, false, 0, 0L) + org.lwjgl.opengl.GL30C.glBindVertexArray(0) + } + val prevTex = glGetInteger(GL_TEXTURE_BINDING_2D) atlas = glGenTextures() glBindTexture(GL_TEXTURE_2D, atlas) @@ -402,16 +433,17 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re GL_UNSIGNED_BYTE, null as ByteBuffer? ) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, if (mipmapMode == 0) GL_LINEAR else GL_LINEAR_MIPMAP_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) glBindTexture(GL_TEXTURE_2D, prevTex) + glBindBuffer(GL_ARRAY_BUFFER, prevBuf) } override fun beginFrame(width: Float, height: Float, pixelRatio: Float) { scissorDepth = 0 - alphaCap = 1f + alphaCap = 255 count = 0 buffer.clear() transform.set(IDENTITY) @@ -470,21 +502,24 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) - // Quad attrib - glBindBuffer(GL_ARRAY_BUFFER, quadVbo) - glEnableVertexAttribArray(aLocal) - glVertexAttribPointer(aLocal, 2, GL_FLOAT, false, 0, 0L) - - // Instance attribs - glBindBuffer(GL_ARRAY_BUFFER, instancedVbo) - - var offset = 0L - offset = enableAttrib(iRect, 4, offset) - offset = enableAttrib(iRadii, 4, offset) - offset = enableAttrib(iColor0, 4, offset) - offset = enableAttrib(iColor1, 4, offset) - offset = enableAttrib(iUVRect, 4, offset) - enableAttrib(iThickness, 1, offset) + // asm: on VAO the state is stored, so we only need to set it up once + if (!GlCapabilities.isGl3Available) { + // Quad attrib + glBindBuffer(GL_ARRAY_BUFFER, quadVbo) + glEnableVertexAttribArray(aLocal) + glVertexAttribPointer(aLocal, 2, GL_FLOAT, false, 0, 0L) + + // Instance attribs + glBindBuffer(GL_ARRAY_BUFFER, instancedVbo) + + var offset = 0L + offset = enableAttrib(iRect, 4, offset) + offset = enableAttrib(iRadii, 4, offset) + offset = enableAttrib(iColor0, 1, offset, GL_UNSIGNED_INT) + offset = enableAttrib(iColor1, 1, offset, GL_UNSIGNED_INT) + offset = enableAttrib(iUVRect, 4, offset) + enableAttrib(iThickness, 1, offset) + } // Draw all instances if (GlCapabilities.isGl31Available) org.lwjgl.opengl.GL31.glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, count) @@ -503,9 +538,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao) } - private fun enableAttrib(loc: Int, size: Int, offset: Long): Long { + private fun enableAttrib(loc: Int, size: Int, offset: Long, type: Int = GL_FLOAT): Long { glEnableVertexAttribArray(loc) - glVertexAttribPointer(loc, size, GL_FLOAT, false, STRIDE * 4, offset) + glVertexAttribPointer(loc, size, type, false, STRIDE * 4, offset) // I don't know why core disables the extension functions... but ok! if (GlCapabilities.isGl33Available) org.lwjgl.opengl.GL33.glVertexAttribDivisor(loc, 1) else org.lwjgl.opengl.ARBInstancedArrays.glVertexAttribDivisorARB(loc, 1) @@ -524,10 +559,9 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (count >= MAX_BATCH) flush() buffer.put(x).put(y).put(width).put(height) buffer.put(topLeftRadius).put(topRightRadius).put(bottomRightRadius).put(bottomLeftRadius) - buffer.put(color.r / 255f).put(color.g / 255f).put(color.b / 255f).put(color.alpha.coerceAtMost(alphaCap)) + buffer.put(java.lang.Float.intBitsToFloat(color.argb.capAlpha())) if (color is PolyColor.Gradient) { - buffer.put(color.color2.r / 255f).put(color.color2.g / 255f).put(color.color2.b / 255f) - .put(color.color2.alpha.coerceAtMost(alphaCap)) + buffer.put(java.lang.Float.intBitsToFloat(color.color2.argb.capAlpha())) when (val type = color.type) { is PolyColor.Gradient.Type.LeftToRight -> { buffer.put(0f).put(height / 2f).put(width).put(height / 2f) @@ -562,7 +596,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } } } else { - buffer.put(EMPTY_ROW) // color1 unused + buffer.put(0f) // color1 unused buffer.put(NO_UV) // -1f UVs to indicate no texture buffer.put(0f) } @@ -585,8 +619,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (count >= MAX_BATCH) flush() buffer.put(x).put(y).put(width).put(height) buffer.put(topLeftRadius).put(topRightRadius).put(bottomRightRadius).put(bottomLeftRadius) - buffer.put(color.r / 255f).put(color.g / 255f).put(color.b / 255f).put(color.alpha.coerceAtMost(alphaCap)) - buffer.put(EMPTY_ROW) // color1 unused + buffer.put(java.lang.Float.intBitsToFloat(color.argb.capAlpha())) + buffer.put(0f) // color1 unused buffer.put(NO_UV) // -1f UVs to indicate no texture buffer.put(lineWidth) count += 1 @@ -600,11 +634,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re buffer.put(x).put(y).put(width).put(height) buffer.put(topLeftRadius).put(topRightRadius).put(bottomRightRadius).put(bottomLeftRadius) - buffer.put((colorMask shr 16 and 0xFF) / 255f) - .put((colorMask shr 8 and 0xFF) / 255f) - .put((colorMask and 0xFF) / 255f) - .put(((colorMask ushr 24 and 0xFF) / 255f).coerceAtMost(alphaCap)) - buffer.put(EMPTY_ROW) // color1 unused + buffer.put(java.lang.Float.intBitsToFloat(colorMask.capAlpha())) + buffer.put(0f) // color1 unused buffer.put(image.uv.x).put(image.uv.y).put(image.uv.w).put(image.uv.h) buffer.put(0f) // thickness = 0 for filled rect count += 1 @@ -614,10 +645,10 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (font === UIManager.INSTANCE.mcFont) { val ctx = UIManager.INSTANCE.renderingContext // todo hi deftu https://github.com/Deftu/OmniCore/issues/57 -// ctx.pose.push(OmniMatrix3f(transform)) + ctx.pose.push(OmniPoseStack.Entry(ctx.pose.current.positionMatrix, OmniMatrix3f.from(transform))) // asm: can be optimized by https://github.com/Deftu/OmniCore/issues/58 OmniTextRenderer.render(ctx.pose, text, x, y, OmniColor.argb(color.argb), false) -// ctx.pose.pop() + ctx.pose.pop() return } val fAtlas = getFontAtlas(font, fontSize) @@ -628,10 +659,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re var penX = x val scaleFactor = fontSize / fAtlas.renderedSize val penY = y + (fAtlas.ascent + fAtlas.descent) * scaleFactor - val r = (color.r / 255f) - val g = (color.g / 255f) - val b = (color.b / 255f) - val a = (color.alpha.coerceAtMost(alphaCap)) + val col = java.lang.Float.intBitsToFloat(color.argb.capAlpha()) val buffer = buffer for (c in text) { @@ -642,8 +670,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re buffer.put(penX + glyph.xOff * scaleFactor).put(penY + glyph.yOff * scaleFactor) .put(glyph.width * scaleFactor).put(glyph.height * scaleFactor) buffer.put(EMPTY_ROW) // zero radii - buffer.put(r).put(g).put(b).put(a) - buffer.put(EMPTY_ROW) // color1 unused + buffer.put(col) + buffer.put(0f) // color1 unused buffer.put(if (s == 1f) glyph else fAtlasForRendering.get(c), 0, 4) buffer.put(-1f) // thickness = -1 for text penX += glyph.xAdvance * scaleFactor @@ -674,8 +702,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (count >= MAX_BATCH) flush() buffer.put(x).put(y).put(width).put(height) buffer.put(EMPTY_ROW) // zero radii - buffer.put(0f).put(0f).put(0f).put(alphaCap) // black, alpha to alphaCap - buffer.put(EMPTY_ROW) // color1 unused + buffer.put(java.lang.Float.intBitsToFloat(alphaCap shl 24)) // black, alpha to alphaCap + buffer.put(0f) // color1 unused buffer.put(spread).put(blur).put(0f).put(0f) buffer.put(-5f) // thickness = -5 for drop shadow count += 1 @@ -739,7 +767,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } override fun globalAlpha(alpha: Float) { - alphaCap = alpha + alphaCap = (alpha * 255f).toInt() } override fun resetGlobalAlpha() = globalAlpha(1f) @@ -763,8 +791,16 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } private fun transformScale(): Float { - val sx = sqrt(transform[0] * transform[0] + transform[3] * transform[3]) - val sy = sqrt(transform[1] * transform[1] + transform[4] * transform[4]) + val a = transform[0] + val c = transform[1] + val b = transform[3] + val d = transform[4] + // Fast-path: identity (no rotation, no scale, no shear) + if (a == 1f && d == 1f && c == 0f && b == 0f) { + return 1f + } + val sx = sqrt(a * a + b * b) + val sy = sqrt(c * c + d * d) return (sx + sy) * 0.5f } @@ -889,7 +925,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re } private fun getFontAtlas(font: Font, fontSize: Float): FontAtlas { - val renderSize = when(fontSize) { + val renderSize = when (fontSize) { in 0f..36f -> 24f else -> 48f } From 954d81481a35c0662ec43952e56780b041fac707 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:14:35 +0000 Subject: [PATCH 20/34] fix transformation matrix --- .../api/ui/v1/internal/GLRendererImpl.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 1013211b7..7e2a363f2 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -3,10 +3,11 @@ package org.polyfrost.oneconfig.api.ui.v1.internal import dev.deftu.omnicore.api.client.render.GlCapabilities +import dev.deftu.omnicore.api.client.render.OmniResolution import dev.deftu.omnicore.api.client.render.OmniTextRenderer import dev.deftu.omnicore.api.client.render.stack.OmniPoseStack import dev.deftu.omnicore.api.color.OmniColor -import dev.deftu.omnicore.api.math.OmniMatrix3f +import dev.deftu.omnicore.api.math.OmniMatrix4f import dev.deftu.omnicore.internal.client.render.shader.ShaderInternals import org.apache.logging.log4j.LogManager import org.lwjgl.BufferUtils @@ -641,11 +642,21 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re count += 1 } + private fun FloatArray.getScaledMat4(): OmniMatrix4f { + // asm: scale to MC instance coordinates and mutate to a 4x4 matrix + val sf = pixelRatio / OmniResolution.scaleFactor.toFloat() + return OmniMatrix4f.from(floatArrayOf( + this[0] * sf, this[1] * sf, 0f, 0f, + this[3] * sf, this[4] * sf, 0f, 0f, + 0f, 0f, 1f, 0f, + this[6] * sf, this[7] * sf, 0f, 1f + )) + } + override fun text(font: Font, x: Float, y: Float, text: String, color: Color, fontSize: Float) { if (font === UIManager.INSTANCE.mcFont) { val ctx = UIManager.INSTANCE.renderingContext - // todo hi deftu https://github.com/Deftu/OmniCore/issues/57 - ctx.pose.push(OmniPoseStack.Entry(ctx.pose.current.positionMatrix, OmniMatrix3f.from(transform))) + ctx.pose.push(OmniPoseStack.Entry(transform.getScaledMat4(), ctx.pose.current.normalMatrix)) // asm: can be optimized by https://github.com/Deftu/OmniCore/issues/58 OmniTextRenderer.render(ctx.pose, text, x, y, OmniColor.argb(color.argb), false) ctx.pose.pop() From 91aedf602498d0806e1c92e103f204e36450f8c6 Mon Sep 17 00:00:00 2001 From: Deftu Date: Thu, 18 Dec 2025 16:19:53 +0200 Subject: [PATCH 21/34] Add 1.21.11 support and bump DGT --- .../org/polyfrost/gradle/addDependencies.kt | 7 +++ gradle/libs.versions.toml | 6 +-- minecraft/build.gradle.kts | 11 +++-- minecraft/root.gradle.kts | 46 ++++++++++--------- modules/dependencies/legacy/build.gradle.kts | 2 +- settings.gradle.kts | 9 +++- 6 files changed, 51 insertions(+), 30 deletions(-) diff --git a/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt b/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt index f17f736e5..fd61e4ecd 100644 --- a/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt +++ b/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt @@ -42,6 +42,7 @@ private val fabricApiModuleVersions = mapOf( "api-base-12108" to "0.4.64+9ec45cd8f3", // 1.21.8 "api-base-12109" to "0.5.2+2fa446b294", // 1.21.9 "api-base-12110" to "1.0.0+14b92d8968", // 1.21.10 + "api-base-12111" to "1.0.5+4ebb5c0853", // 1.21.11 "lifecycle-events-v1-common" to "1.1.0+2c3f108c81e6", // Common (Legacy Fabric API) "lifecycle-events-v1-10809" to "1.1.0+1.8.9+2c3f108c81e6", // 1.8.9 "lifecycle-events-v1-11202" to "1.1.0+1.12.2+2c3f108c81e6", // 1.12.2 @@ -63,6 +64,7 @@ private val fabricApiModuleVersions = mapOf( "lifecycle-events-v1-12108" to "2.6.3+db4dfd85f3", // 1.21.8 "lifecycle-events-v1-12109" to "2.6.8+33df5e6e94", // 1.21.9 "lifecycle-events-v1-12110" to "2.6.9+33df5e6e68", // 1.21.10 + "lifecycle-events-v1-12111" to "2.6.15+4ebb5c0853", // 1.21.11 "keybindings-api-v1-common" to "1.1.1+281301ea81e6", // Common (Legacy Fabric API) "keybindings-api-v1-10809" to "1.1.1+1.8.9+2c3f108c81e6", // 1.8.9 "keybindings-api-v1-11202" to "1.1.1+1.12.2+2c3f108c81e6", // 1.12.2 @@ -84,6 +86,7 @@ private val fabricApiModuleVersions = mapOf( "key-binding-api-v1-12108" to "1.0.65+946bf4c3f3", // 1.21.8 "key-binding-api-v1-12109" to "1.1.0+4ec8267494", // 1.21.9 "key-binding-api-v1-12110" to "1.1.1+b3ba9c4868", // 1.21.10 + "key-binding-api-v1-12111" to "1.1.7+4fc5413f53", // 1.21.11 "rendering-api-v1-common" to "1.0.0+7c545fdb81e6", // Common (Legacy Fabric API) "rendering-api-v1-10809" to "1.0.0+1.8.9+2c3f108c81e6", // 1.8.9 "rendering-api-v1-11202" to "1.0.0+1.8.9+2c3f108c81e6", // 1.12.2 @@ -105,6 +108,7 @@ private val fabricApiModuleVersions = mapOf( "rendering-v1-12108" to "12.4.0+e8d43c76f3", // 1.21.8 "rendering-v1-12109" to "15.0.2+9bce411b94", // 1.21.9 "rendering-v1-12110" to "16.0.1+328a75ba68", // 1.21.10 + "rendering-v1-12111" to "16.2.5+1fb1cde953", // 1.21.11 "screen-api-v1-11605" to "1.0.1+3cc0f0907d", // 1.16.5 "screen-api-v1-11701" to "1.0.5+cf39a74318", // 1.17.1 "screen-api-v1-11802" to "1.0.11+d882b91560", // 1.18.2 @@ -123,6 +127,7 @@ private val fabricApiModuleVersions = mapOf( "screen-api-v1-12108" to "2.1.0+277ecf7df3", // 1.21.8 "screen-api-v1-12109" to "3.0.2+86b3ae5794", // 1.21.9 "screen-api-v1-12110" to "3.1.0+9c82a79868", // 1.21.10 + "screen-api-v1-12111" to "3.1.7+4ebb5c0853", // 1.21.11 "command-api-v1-11605" to "1.1.3+3cc0f0907d", // 1.16.5 "command-api-v1-11701" to "1.1.4+cf39a74318", // 1.17.1 "command-api-v1-11802" to "1.1.10+d7c144a860", // 1.18.2 @@ -141,6 +146,7 @@ private val fabricApiModuleVersions = mapOf( "command-api-v2-12108" to "2.2.53+946bf4c3f3", // 1.21.8 "command-api-v2-12109" to "2.3.5+33df5e6e94", // 1.21.9 "command-api-v2-12110" to "2.3.7+328a75ba68", // 1.21.10 + "command-api-v2-12111" to "2.4.6+4ebb5c0853", // 1.21.11 "transitive-access-wideners-v1-11802" to "1.1.0+e747827960", // 1.18.2 "transitive-access-wideners-v1-11902" to "1.3.3+08b73de490", // 1.19.2 "transitive-access-wideners-v1-11904" to "3.3.0+1b5f819af4", // 1.19.4 @@ -157,6 +163,7 @@ private val fabricApiModuleVersions = mapOf( "transitive-access-wideners-v1-12108" to "6.4.1+ac3e15d1f3", // 1.21.8 "transitive-access-wideners-v1-12109" to "6.5.2+5d9dbead94", // 1.21.9 "transitive-access-wideners-v1-12110" to "6.5.3+41eb434368", // 1.21.10 + "transitive-access-wideners-v1-12111" to "7.0.7+1fb1cde953", // 1.21.11 ) /** diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8bf6b1d8d..9eedb80e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,8 +21,8 @@ copycat = "0.1.3" copycat-image-awt = "0.1.1" # Per version -textile = "1.0.0-beta.9" -omnicore = "1.0.0-beta.39" +textile = "1.0.0-beta.11" +omnicore = "1.0.0-beta.40" lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader # Legacy only @@ -35,7 +35,7 @@ brigadier = "1.0.18" oneconfig-loader = "1.1.0-alpha.48" # Gradle -dgt = "2.62.0" +dgt = "2.69.0" kotlinx-abi = "0.18.1" licenser = "2.1.1" jetbrains-idea-ext = "1.3" diff --git a/minecraft/build.gradle.kts b/minecraft/build.gradle.kts index b70045426..3bc5a32b2 100644 --- a/minecraft/build.gradle.kts +++ b/minecraft/build.gradle.kts @@ -39,7 +39,9 @@ if (mcData.isForge) { toolkitLoomHelper { disableRunConfigs(GameSide.SERVER) - useDevAuth("+") + if (mcData.version < MinecraftVersions.VERSION_1_21_11) { + useDevAuth("+") + } useProperty("mixin.debug.export", "true", GameSide.CLIENT) useProperty("debugBytecode", "true", GameSide.CLIENT) @@ -207,7 +209,8 @@ dependencies { rconfig("1.21.7", "3.7.2"), rconfig("1.21.8", "3.7.2", "1.21.7"), rconfig("1.21.9", "3.9.1"), - rconfig("1.21.10", "3.9.1", "1.21.9") + rconfig("1.21.10", "3.9.1", "1.21.9"), + rconfig("1.21.11", "3.9.1", "1.21.9"), ) compileOnlyCompat(rconfig[mcVersionString]) @@ -249,7 +252,8 @@ dependencies { yacl("1.21.7", "3.7.1", "1.21.6"), yacl("1.21.8", "3.7.1", "1.21.6"), yacl("1.21.9", "3.8.0", "1.21.6"), - yacl("1.21.10", "3.8.0", "1.21.9") + yacl("1.21.10", "3.8.0", "1.21.9"), + yacl("1.21.11", "3.8.0", "1.21.9"), ) compileOnlyCompat(yacl[mcVersionString]) @@ -274,6 +278,7 @@ dependencies { modMenu("1.21.7", "15.0.0-beta.3"), modMenu("1.21.8", "15.0.0-beta.3"), modMenu("1.21.10", "16.0.0-rc.1"), + modMenu("1.21.11", "17.0.0-alpha.1"), ) compileOnlyCompat(modMenu[mcVersionString]) diff --git a/minecraft/root.gradle.kts b/minecraft/root.gradle.kts index 77528ef84..4e213bc39 100644 --- a/minecraft/root.gradle.kts +++ b/minecraft/root.gradle.kts @@ -14,27 +14,31 @@ preprocess { strictExtraMappings.set(true) // FOR ALL NEW VERSIONS ENSURE TO UPDATE settings.gradle.kts ! - "1.21.10-neoforge"(1_21_10, "srg") { - "1.21.10-fabric"(1_21_10, "srg") { - "1.21.8-fabric"(1_21_08, "srg") { - "1.21.8-neoforge"(1_21_08, "srg") { - "1.21.5-neoforge"(1_21_05, "srg") { - "1.21.5-fabric"(1_21_05, "srg") { - "1.21.4-fabric"(1_21_04, "srg") { - "1.21.4-neoforge"(1_21_04, "srg") { - "1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) { - "1.21.1-fabric"(1_21_01, "srg") { - "1.20.4-fabric"(1_20_04, "srg") { - "1.20.4-neoforge"(1_20_04, "srg") { - "1.20.4-forge"(1_20_04, "srg") { - "1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) { - "1.20.1-fabric"(1_20_01, "srg") { - "1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) { - "1.16.5-forge"(1_16_05, "srg") { - "1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) { - "1.12.2-fabric"(1_12_02, "srg") { - "1.8.9-fabric"(1_08_09, "srg") { - "1.8.9-forge"(1_08_09, "srg") + "1.21.11-fabric"(1_21_11, "srg") { + "1.21.11-neoforge"(1_21_11, "srg") { + "1.21.10-neoforge"(1_21_10, "srg") { + "1.21.10-fabric"(1_21_10, "srg") { + "1.21.8-fabric"(1_21_08, "srg") { + "1.21.8-neoforge"(1_21_08, "srg") { + "1.21.5-neoforge"(1_21_05, "srg") { + "1.21.5-fabric"(1_21_05, "srg") { + "1.21.4-fabric"(1_21_04, "srg") { + "1.21.4-neoforge"(1_21_04, "srg") { + "1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) { + "1.21.1-fabric"(1_21_01, "srg") { + "1.20.4-fabric"(1_20_04, "srg") { + "1.20.4-neoforge"(1_20_04, "srg") { + "1.20.4-forge"(1_20_04, "srg") { + "1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) { + "1.20.1-fabric"(1_20_01, "srg") { + "1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) { + "1.16.5-forge"(1_16_05, "srg") { + "1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) { + "1.12.2-fabric"(1_12_02, "srg") { + "1.8.9-fabric"(1_08_09, "srg") { + "1.8.9-forge"(1_08_09, "srg") + } + } } } } diff --git a/modules/dependencies/legacy/build.gradle.kts b/modules/dependencies/legacy/build.gradle.kts index edd26cd99..27ed664f7 100644 --- a/modules/dependencies/legacy/build.gradle.kts +++ b/modules/dependencies/legacy/build.gradle.kts @@ -1,7 +1,7 @@ import org.polyfrost.gradle.provideIncludedDependencies plugins { - id("gg.essential.loom") + id("dev.deftu.gradle.loom") } repositories { diff --git a/settings.gradle.kts b/settings.gradle.kts index 2200de399..8fb912204 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,7 @@ pluginManagement { plugins { kotlin("jvm") version("2.2.10") - id("dev.deftu.gradle.multiversion-root") version("2.62.0") // Update in libs.versions.toml too!!! + id("dev.deftu.gradle.multiversion-root") version("2.69.0") // Update in libs.versions.toml too!!! } } @@ -110,6 +110,9 @@ listOf( "1.21.10-neoforge", "1.21.10-fabric", + + "1.21.11-neoforge", + "1.21.11-fabric", ).forEach { version -> val proj = ":minecraft:$version" include(proj) @@ -125,7 +128,9 @@ listOf( "1.21.1-fabric", "1.21.4-fabric", "1.21.5-fabric", - "1.21.8-fabric" + "1.21.8-fabric", +// "1.21.10-fabric", +// "1.21.11-fabric", ).contains(version)) { include(bootstrapProj) project(bootstrapProj).apply { From 21dccd008194cb091827ca694d1807df9918c0ea Mon Sep 17 00:00:00 2001 From: Deftu Date: Thu, 18 Dec 2025 16:30:26 +0200 Subject: [PATCH 22/34] Bump to DGT revision 4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 146a69938..5b1af1b5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ ksp.incremental=false dgt.java.version=8 dgt.loom.mappings=official-like -dgt.minecraft.revision=3 +dgt.minecraft.revision=4 # Project Configuration project.group=org.polyfrost.oneconfig From 78cdb6fc586f2f9f40429ad69af036bbcedc6577 Mon Sep 17 00:00:00 2001 From: nextdayy <79922345+nextdayy@users.noreply.github.com> Date: Fri, 16 Jan 2026 10:38:47 +0000 Subject: [PATCH 23/34] macos moment --- .../api/ui/v1/internal/GLRendererImpl.kt | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 7e2a363f2..14db6be4f 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -409,8 +409,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re var offset = 0L offset = enableAttrib(iRect, 4, offset) offset = enableAttrib(iRadii, 4, offset) - offset = enableAttrib(iColor0, 1, offset, GL_UNSIGNED_INT) - offset = enableAttrib(iColor1, 1, offset, GL_UNSIGNED_INT) + offset = enableAttribui(iColor0, 1, offset) + offset = enableAttribui(iColor1, 1, offset) offset = enableAttrib(iUVRect, 4, offset) enableAttrib(iThickness, 1, offset) @@ -516,8 +516,8 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re var offset = 0L offset = enableAttrib(iRect, 4, offset) offset = enableAttrib(iRadii, 4, offset) - offset = enableAttrib(iColor0, 1, offset, GL_UNSIGNED_INT) - offset = enableAttrib(iColor1, 1, offset, GL_UNSIGNED_INT) + offset = enableAttribui(iColor0, 1, offset) + offset = enableAttribui(iColor1, 1, offset) offset = enableAttrib(iUVRect, 4, offset) enableAttrib(iThickness, 1, offset) } @@ -539,15 +539,24 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glBindVertexArray(prevVao) } - private fun enableAttrib(loc: Int, size: Int, offset: Long, type: Int = GL_FLOAT): Long { + private fun enableAttrib(loc: Int, size: Int, offset: Long): Long { glEnableVertexAttribArray(loc) - glVertexAttribPointer(loc, size, type, false, STRIDE * 4, offset) + glVertexAttribPointer(loc, size, GL_FLOAT, false, STRIDE * 4, offset) // I don't know why core disables the extension functions... but ok! if (GlCapabilities.isGl33Available) org.lwjgl.opengl.GL33.glVertexAttribDivisor(loc, 1) else org.lwjgl.opengl.ARBInstancedArrays.glVertexAttribDivisorARB(loc, 1) return offset + size * 4L } + private fun enableAttribui(loc: Int, size: Int, offset: Long): Long { + glEnableVertexAttribArray(loc) + if (GlCapabilities.isGl3Available) org.lwjgl.opengl.GL30.glVertexAttribIPointer(loc, size, GL_UNSIGNED_INT, STRIDE * 4, offset) + else org.lwjgl.opengl.EXTGPUShader4.glVertexAttribIPointerEXT(loc, size, GL_UNSIGNED_INT, STRIDE * 4, offset) + if (GlCapabilities.isGl33Available) org.lwjgl.opengl.GL33.glVertexAttribDivisor(loc, 1) + else org.lwjgl.opengl.ARBInstancedArrays.glVertexAttribDivisorARB(loc, 1) + return offset + size * 4L + } + override fun rect( x: Float, y: Float, width: Float, height: Float, color: Color, From 8020eec06b60e72fb3e58d5e88231d2361cde837 Mon Sep 17 00:00:00 2001 From: Deftu Date: Tue, 20 Jan 2026 09:29:52 +0200 Subject: [PATCH 24/34] do the stuff for the stuff --- bootstrap/build.gradle.kts | 2 + gradle/libs.versions.toml | 6 +- gradle/wrapper/gradle-wrapper.jar | Bin 43453 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- minecraft/build.gradle.kts | 56 +++++++++++------- minecraft/root.gradle.kts | 48 ++++++++------- .../versions/26.1-fabric/gradle.properties | 4 ++ modules/dependencies/legacy/build.gradle.kts | 2 +- settings.gradle.kts | 6 +- 9 files changed, 74 insertions(+), 52 deletions(-) create mode 100644 minecraft/versions/26.1-fabric/gradle.properties diff --git a/bootstrap/build.gradle.kts b/bootstrap/build.gradle.kts index f70882630..a733224fe 100644 --- a/bootstrap/build.gradle.kts +++ b/bootstrap/build.gradle.kts @@ -6,6 +6,8 @@ import dev.deftu.gradle.utils.version.MinecraftReleaseVersion import org.polyfrost.gradle.provideFabricApiDependency import org.polyfrost.gradle.provideIncludedDependencies +println("[${mcData.version::class.java}] ${mcData.version}") + plugins { java alias(libs.plugins.kotlin) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9eedb80e5..572086f84 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,8 +21,8 @@ copycat = "0.1.3" copycat-image-awt = "0.1.1" # Per version -textile = "1.0.0-beta.11" -omnicore = "1.0.0-beta.40" +textile = "1.0.0-beta.17" +omnicore = "1.0.0-beta.41" lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader # Legacy only @@ -35,7 +35,7 @@ brigadier = "1.0.18" oneconfig-loader = "1.1.0-alpha.48" # Gradle -dgt = "2.69.0" +dgt = "2.71.0" kotlinx-abi = "0.18.1" licenser = "2.1.1" jetbrains-idea-ext = "1.3" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3d4ba8a0da8d277868979cfbc8ad796..a4b76b9530d66f5e68d973ea569d8e19de379189 100644 GIT binary patch delta 12612 zcmY+pRa6|n(lttO3GVLh?(Xh3xVuAe26uONcL=V5;I6?T_zdn2`Oi5I_gl9gx~lft zRjVKRp?B~8Wyrx5$mS3|py!Njy{0Wt4i%@s8v88pK z6fPNA45)|*9+*w5kcg$o)}2g}%JfXe6l9ig4T8ia3Hlw#3f^fAKW63%<~GZJd-0YA z9YjleCs~#Y?V+`#nr+49hhsr$K$k!lg}AZDw@>2j=f7t~5IW6#K|lAX7|^N}lJ)I!km`nrwx> z))1Es16__aXGVzQM0EC8xH+O!nqTFBg9Ci{NwRK*CP<6s`Gq(~#lqb(zOlh6ZDBK* zr$|NDj^s6VanrKa+QC;5>twePaexqRI%RO~OY075y?NN90I|f^(P# zF=b>fZ73b5JzD`#GC3lTQ_B3lMeBWgQUGYnFw*HQC}^z{$6G4j(n4y-pRxPT(d2Wgb%vCH(?+t&Pj z)QM`zc`U`+<~D+9E{4Uj2kc#*6eZMU$4Oj6QMfA^K!rbl`iBix=2sPrs7j@aqIrE zTaZJ2M09>rp$mgyUZ!r2$UK{+DGqgl`n;*qFF~M(r#eh`T{MO?2&j?xgr8FU$u3-` zhRDc_I23LL4)K&xg$^&l-W=!Jp-P(_Ie07q>Je;QLxi8LaEc%;WIacJD_T69egF?7 z;I_Sg_!+qrur8$Hq4grigaiVF>U7uWJ@Hkd&%kmFnQN-P^fq0gB1|uRt!U#X;DnlV zo?yHWTw7g5B;#xxY`adhi4yZn@f(7-Xa(J6S=#d@&rlFw!qfvholE>MEb|VWn^g}G zMSrK&zQ^vDId&ojL!{%{o7?s{7;{+u%L{|tar(gp?Uxq3p?xAysB>0E$eG#$tvkk9 z2Q2gEP17{U6@UD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K%-1Ao1~G-@4ve~y5#9E8x;TE0k5d^TC(=Zc>mwjW^c=+U-<9}b0ku~}gj z3sbW>R2M6DR!g#NUP;nxo>)@7*=RP{U18SDop6b2&PHce^&h97@xx3t+VK+!keE#} z;(Uf&89as9k8{$nkLbuB!-d7TP`_VJpL^Xs8OKB~ri$YUbW8fch64}7|0EWoT(TRj{ z*GT<7Y<7DsrCi79ZsM)z#c(!nNOGySOCkY1fAuQOq12&iUVC!a`#O;dBLf=d?&4*B zI~LgAO7E0qxK(uRTM;IgJ}+z^gD+bi-6I!3x{r9`l~%8TRP%UE0V8E*Sz>Nl1NVG<<7(wDHZ+HcOkQm$O&k+vyx)y)x{Pz!U8hS$*m zByc0h6BUI*BOpuL==P+H|Hx%`>7!W+1H!l9vi&)`V zyn2o9{z=lc+VX*!Vh~SF=)L}Z40XeG>LF6cP^b+R$NxSeUqbK^Q*UTalKzP8X%{9@RSCXm_NhF>{=S2 zi}ezam_^P`S!!-cyEW9y7DBbK93roz@Raccy*v}?mKXScU9E_4g;hBU7}zSofAFda zKYEe?{{I54 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2847c820..23449a2b5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/minecraft/build.gradle.kts b/minecraft/build.gradle.kts index 3bc5a32b2..244e80ca2 100644 --- a/minecraft/build.gradle.kts +++ b/minecraft/build.gradle.kts @@ -129,7 +129,7 @@ fun DependencyHandlerScope.handleApiDep(dependency: String, isMod: Boolean = fal fun DependencyHandlerScope.handleApiDep(dependency: ExternalModuleDependency, isMod: Boolean = false) { val dep = "${dependency.group}:${dependency.name}:${dependency.version}" - if (isMod) "oneConfigModulesCompileOnlyApi"(modApi(dep) { + if (isMod) "oneConfigModulesCompileOnlyApi"(maybeModApi(dep) { isTransitive = false attributes { attribute(includeInLoader, JBoolean.TRUE) @@ -167,7 +167,7 @@ dependencies { ) fun DependencyHandlerScope.compileOnlyCompat(notation: String?) = - notation?.let { modCompileOnly(it) { isTransitive = false } } + notation?.let { maybeModCompileOnly(it) { isTransitive = false } } fun DependencyHandlerScope.compileOnlyCompat(notation: CompatDependency?) { when { @@ -298,7 +298,7 @@ dependencies { if (mcData.isFabric) { provideFabricApiDependency(tripleVersion).forEach { @Suppress("USELESS_CAST") - modApi(if (it.dep is String) it.dep as String else "${(it.dep as ExternalModuleDependency).group}:${(it.dep as ExternalModuleDependency).name}:${(it.dep as ExternalModuleDependency).version}") { + maybeModApi(if (it.dep is String) it.dep as String else "${(it.dep as ExternalModuleDependency).group}:${(it.dep as ExternalModuleDependency).name}:${(it.dep as ExternalModuleDependency).version}") { isTransitive = false } } @@ -351,35 +351,43 @@ dependencies { } } - if ((mcData.version as MinecraftReleaseVersion).isNewerThan(MinecraftVersions.VERSION_1_21_4)) { + if (mcData.version > MinecraftVersions.VERSION_1_21_4) { compileOnly("net.azureaaron:dandelion:1.0.0-alpha.3") { isTransitive = false } } api("dev.deftu:enhancedeventbus:2.0.0") // TODO } tasks { + val manifestFunc = { manifest: Manifest -> + val attributesMap = buildMap { + putAll( + mapOf( + "Specification-Title" to modData.id, + "Specification-Vendor" to "Polyfrost", + "Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means + "Implementation-Title" to rootProject.name, + "Implementation-Version" to project.version, + "Implementation-Vendor" to "Polyfrost", + "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()), + "OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap", + "MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json",) + ) + } + manifest.attributes(attributesMap) + Unit + } + withType(Jar::class) { exclude("**/**_Test.**") exclude("**/**_Test$**.**") } - remapJar { - manifest { - val attributesMap = buildMap { - putAll( - mapOf( - "Specification-Title" to modData.id, - "Specification-Vendor" to "Polyfrost", - "Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means - "Implementation-Title" to rootProject.name, - "Implementation-Version" to project.version, - "Implementation-Vendor" to "Polyfrost", - "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()), - "OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap", - "MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json", - ) - ) - } - attributes(attributesMap) + if (mcData.version.isDrop) { + jar { + manifest(manifestFunc) + } + } else { + named("remapJar") { + manifest(manifestFunc) } } processResources { @@ -387,6 +395,10 @@ tasks { exclude("patched-lwjgl/**") } } + + fun Manifest.applyManifest() { + + } } afterEvaluate { diff --git a/minecraft/root.gradle.kts b/minecraft/root.gradle.kts index 4e213bc39..b1d822d5b 100644 --- a/minecraft/root.gradle.kts +++ b/minecraft/root.gradle.kts @@ -14,29 +14,31 @@ preprocess { strictExtraMappings.set(true) // FOR ALL NEW VERSIONS ENSURE TO UPDATE settings.gradle.kts ! - "1.21.11-fabric"(1_21_11, "srg") { - "1.21.11-neoforge"(1_21_11, "srg") { - "1.21.10-neoforge"(1_21_10, "srg") { - "1.21.10-fabric"(1_21_10, "srg") { - "1.21.8-fabric"(1_21_08, "srg") { - "1.21.8-neoforge"(1_21_08, "srg") { - "1.21.5-neoforge"(1_21_05, "srg") { - "1.21.5-fabric"(1_21_05, "srg") { - "1.21.4-fabric"(1_21_04, "srg") { - "1.21.4-neoforge"(1_21_04, "srg") { - "1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) { - "1.21.1-fabric"(1_21_01, "srg") { - "1.20.4-fabric"(1_20_04, "srg") { - "1.20.4-neoforge"(1_20_04, "srg") { - "1.20.4-forge"(1_20_04, "srg") { - "1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) { - "1.20.1-fabric"(1_20_01, "srg") { - "1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) { - "1.16.5-forge"(1_16_05, "srg") { - "1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) { - "1.12.2-fabric"(1_12_02, "srg") { - "1.8.9-fabric"(1_08_09, "srg") { - "1.8.9-forge"(1_08_09, "srg") + "26.1-fabric"(26_01_00, "srg") { + "1.21.11-fabric"(1_21_11, "srg") { + "1.21.11-neoforge"(1_21_11, "srg") { + "1.21.10-neoforge"(1_21_10, "srg") { + "1.21.10-fabric"(1_21_10, "srg") { + "1.21.8-fabric"(1_21_08, "srg") { + "1.21.8-neoforge"(1_21_08, "srg") { + "1.21.5-neoforge"(1_21_05, "srg") { + "1.21.5-fabric"(1_21_05, "srg") { + "1.21.4-fabric"(1_21_04, "srg") { + "1.21.4-neoforge"(1_21_04, "srg") { + "1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) { + "1.21.1-fabric"(1_21_01, "srg") { + "1.20.4-fabric"(1_20_04, "srg") { + "1.20.4-neoforge"(1_20_04, "srg") { + "1.20.4-forge"(1_20_04, "srg") { + "1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) { + "1.20.1-fabric"(1_20_01, "srg") { + "1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) { + "1.16.5-forge"(1_16_05, "srg") { + "1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) { + "1.12.2-fabric"(1_12_02, "srg") { + "1.8.9-fabric"(1_08_09, "srg") { + "1.8.9-forge"(1_08_09, "srg") + } } } } diff --git a/minecraft/versions/26.1-fabric/gradle.properties b/minecraft/versions/26.1-fabric/gradle.properties new file mode 100644 index 000000000..e6e3be017 --- /dev/null +++ b/minecraft/versions/26.1-fabric/gradle.properties @@ -0,0 +1,4 @@ +fabric.loom.disableObfuscation=true +dgt.loom.mappings.use=false +minecraft.version=26.1-snapshot-3 +dgt.fabric.api.version=0.141.3+26.1 diff --git a/modules/dependencies/legacy/build.gradle.kts b/modules/dependencies/legacy/build.gradle.kts index 27ed664f7..edd26cd99 100644 --- a/modules/dependencies/legacy/build.gradle.kts +++ b/modules/dependencies/legacy/build.gradle.kts @@ -1,7 +1,7 @@ import org.polyfrost.gradle.provideIncludedDependencies plugins { - id("dev.deftu.gradle.loom") + id("gg.essential.loom") } repositories { diff --git a/settings.gradle.kts b/settings.gradle.kts index 8fb912204..24d354335 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,8 +23,8 @@ pluginManagement { } plugins { - kotlin("jvm") version("2.2.10") - id("dev.deftu.gradle.multiversion-root") version("2.69.0") // Update in libs.versions.toml too!!! + kotlin("jvm") version("2.3.0") + id("dev.deftu.gradle.multiversion-root") version("2.70.0") // Update in libs.versions.toml too!!! } } @@ -113,6 +113,8 @@ listOf( "1.21.11-neoforge", "1.21.11-fabric", + + "26.1-fabric" ).forEach { version -> val proj = ":minecraft:$version" include(proj) From 903c0f92bb77e11852289f648c5b64cd7953e654 Mon Sep 17 00:00:00 2001 From: Deftu Date: Tue, 20 Jan 2026 13:52:22 +0200 Subject: [PATCH 25/34] Shenanigans have been thoroughly accounted for :3 --- .../org/polyfrost/gradle/addDependencies.kt | 43 +++++++++++++------ minecraft/build.gradle.kts | 18 +++++--- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt b/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt index fd61e4ecd..9cd3dfab6 100644 --- a/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt +++ b/buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt @@ -14,7 +14,6 @@ private val legacyFabricApiModules = listOf( private val fabricApiModules = listOf( // command-api-v2 introduced in 1.19, transitive-access-wideners-v1 introduced in 1.18 "api-base", "lifecycle-events-v1", - "key-binding-api-v1", "rendering-v1", "screen-api-v1" ) @@ -43,6 +42,7 @@ private val fabricApiModuleVersions = mapOf( "api-base-12109" to "0.5.2+2fa446b294", // 1.21.9 "api-base-12110" to "1.0.0+14b92d8968", // 1.21.10 "api-base-12111" to "1.0.5+4ebb5c0853", // 1.21.11 + "api-base-260100" to "2.0.0+574290ba7d", // 26.1 "lifecycle-events-v1-common" to "1.1.0+2c3f108c81e6", // Common (Legacy Fabric API) "lifecycle-events-v1-10809" to "1.1.0+1.8.9+2c3f108c81e6", // 1.8.9 "lifecycle-events-v1-11202" to "1.1.0+1.12.2+2c3f108c81e6", // 1.12.2 @@ -65,6 +65,7 @@ private val fabricApiModuleVersions = mapOf( "lifecycle-events-v1-12109" to "2.6.8+33df5e6e94", // 1.21.9 "lifecycle-events-v1-12110" to "2.6.9+33df5e6e68", // 1.21.10 "lifecycle-events-v1-12111" to "2.6.15+4ebb5c0853", // 1.21.11 + "lifecycle-events-v1-260100" to "4.0.2+a208210e7d", // 26.1 "keybindings-api-v1-common" to "1.1.1+281301ea81e6", // Common (Legacy Fabric API) "keybindings-api-v1-10809" to "1.1.1+1.8.9+2c3f108c81e6", // 1.8.9 "keybindings-api-v1-11202" to "1.1.1+1.12.2+2c3f108c81e6", // 1.12.2 @@ -87,6 +88,7 @@ private val fabricApiModuleVersions = mapOf( "key-binding-api-v1-12109" to "1.1.0+4ec8267494", // 1.21.9 "key-binding-api-v1-12110" to "1.1.1+b3ba9c4868", // 1.21.10 "key-binding-api-v1-12111" to "1.1.7+4fc5413f53", // 1.21.11 + "key-mapping-api-v1-260100" to "2.0.0+574290ba7d", // 26.1 "rendering-api-v1-common" to "1.0.0+7c545fdb81e6", // Common (Legacy Fabric API) "rendering-api-v1-10809" to "1.0.0+1.8.9+2c3f108c81e6", // 1.8.9 "rendering-api-v1-11202" to "1.0.0+1.8.9+2c3f108c81e6", // 1.12.2 @@ -109,6 +111,7 @@ private val fabricApiModuleVersions = mapOf( "rendering-v1-12109" to "15.0.2+9bce411b94", // 1.21.9 "rendering-v1-12110" to "16.0.1+328a75ba68", // 1.21.10 "rendering-v1-12111" to "16.2.5+1fb1cde953", // 1.21.11 + "rendering-v1-260100" to "18.0.0+a9f246707d", // 26.1 "screen-api-v1-11605" to "1.0.1+3cc0f0907d", // 1.16.5 "screen-api-v1-11701" to "1.0.5+cf39a74318", // 1.17.1 "screen-api-v1-11802" to "1.0.11+d882b91560", // 1.18.2 @@ -128,6 +131,7 @@ private val fabricApiModuleVersions = mapOf( "screen-api-v1-12109" to "3.0.2+86b3ae5794", // 1.21.9 "screen-api-v1-12110" to "3.1.0+9c82a79868", // 1.21.10 "screen-api-v1-12111" to "3.1.7+4ebb5c0853", // 1.21.11 + "screen-api-v1-260100" to "4.0.0+574290ba7d", // 26.1 "command-api-v1-11605" to "1.1.3+3cc0f0907d", // 1.16.5 "command-api-v1-11701" to "1.1.4+cf39a74318", // 1.17.1 "command-api-v1-11802" to "1.1.10+d7c144a860", // 1.18.2 @@ -147,6 +151,7 @@ private val fabricApiModuleVersions = mapOf( "command-api-v2-12109" to "2.3.5+33df5e6e94", // 1.21.9 "command-api-v2-12110" to "2.3.7+328a75ba68", // 1.21.10 "command-api-v2-12111" to "2.4.6+4ebb5c0853", // 1.21.11 + "command-api-v2-260100" to "3.0.0+574290ba7d", // 26.1 "transitive-access-wideners-v1-11802" to "1.1.0+e747827960", // 1.18.2 "transitive-access-wideners-v1-11902" to "1.3.3+08b73de490", // 1.19.2 "transitive-access-wideners-v1-11904" to "3.3.0+1b5f819af4", // 1.19.4 @@ -164,6 +169,7 @@ private val fabricApiModuleVersions = mapOf( "transitive-access-wideners-v1-12109" to "6.5.2+5d9dbead94", // 1.21.9 "transitive-access-wideners-v1-12110" to "6.5.3+41eb434368", // 1.21.10 "transitive-access-wideners-v1-12111" to "7.0.7+1fb1cde953", // 1.21.11 + "transitive-access-wideners-v1-260100" to "8.0.1+a208210e7d", // 26.1 ) /** @@ -172,7 +178,7 @@ private val fabricApiModuleVersions = mapOf( * @param version The version of Minecraft. If null, the method is running inside the `:dependencies:legacy` module. * @param loader The mod loader being used. */ -fun Project.provideIncludedDependencies(version: Triple?, loader: String?): List { // Either a String or ExternalModuleDependency +fun Project.provideIncludedDependencies(version: Triple?, loader: String?, shenanigans: String? = version?.toMCVer()): List { // Either a String or ExternalModuleDependency project.logger.lifecycle("===> Adding dependencies for Minecraft ${version?.toMCVer()} & $loader") val libs = rootProject @@ -201,17 +207,21 @@ fun Project.provideIncludedDependencies(version: Triple?, loader: deps.add(libs.findLibrary("copycat-image-awt").get().get()) - if (version != null && version.second >= 16) { + if (version != null && (version.second >= 16 || version.first >= 2)) { logger.lifecycle("===> Adding LWJGL dependencies for Minecraft ${version.toMCVer()} & $loader") // Modern (1.16+) val lwjglBase = "org.lwjgl:lwjgl" - val lwjglVersion = when (version.second) { - in 16..18 -> "3.2.2" - 19 -> "3.3.1" - 20 -> "3.3.2" - 21 -> "3.3.3" - else -> error("Unsupported Minecraft version: ${version.toMCVer()}") + val lwjglVersion = if (version.first >= 2) { + "3.3.3" + } else { + when (version.second) { + in 16..18 -> "3.2.2" + 19 -> "3.3.1" + 20 -> "3.3.2" + 21 -> "3.3.3" + else -> error("Unsupported Minecraft version: ${version.toMCVer()}") + } } deps.add("$lwjglBase-tinyfd:$lwjglVersion") @@ -243,8 +253,8 @@ fun Project.provideIncludedDependencies(version: Triple?, loader: actualDeps.add(OCDependency(dep)) } if (version != null) { - actualDeps.add(OCDependency("dev.deftu:textile-${version.toMCVer()}-$loader:${libs.findVersion("textile").get().displayName}", true)) - actualDeps.add(OCDependency("dev.deftu:omnicore-${version.toMCVer()}-$loader:${libs.findVersion("omnicore").get().displayName}", true)) + actualDeps.add(OCDependency("dev.deftu:textile-${shenanigans}-$loader:${libs.findVersion("textile").get().displayName}", true)) + actualDeps.add(OCDependency("dev.deftu:omnicore-${shenanigans}-$loader:${libs.findVersion("omnicore").get().displayName}", true)) } return actualDeps @@ -253,7 +263,7 @@ fun Project.provideIncludedDependencies(version: Triple?, loader: fun Project.provideFabricApiDependency(version: Triple): List { val deps = mutableListOf() - if (version.second <= 12) { + if (version.first == 1 && version.second <= 12) { // Legacy Fabric for (module in legacyFabricApiModules) { val commonVersionValue = fabricApiModuleVersions["$module-common"] ?: error("No version found for $module-common") @@ -265,14 +275,19 @@ fun Project.provideFabricApiDependency(version: Triple): List() finalList.addAll(fabricApiModules) - if (version.second >= 18) { + if (version.first >= 2 || version.second >= 18) { finalList.add("transitive-access-wideners-v1") } - if (version.second >= 19) { + if (version.first >= 2 || version.second >= 19) { finalList.add("command-api-v2") } else { finalList.add("command-api-v1") } + if (version.first >= 2) { + finalList.add("key-mapping-api-v1") + } else { + finalList.add("key-binding-api-v1") + } for (module in finalList) { val mcVersionValue = fabricApiModuleVersions["$module-${version.toPreprocessorNumber()}"] ?: error("No version found for $module-${version.toMCVer()}") deps.add(OCDependency("net.fabricmc.fabric-api:fabric-$module:$mcVersionValue", true)) diff --git a/minecraft/build.gradle.kts b/minecraft/build.gradle.kts index 244e80ca2..a3570736b 100644 --- a/minecraft/build.gradle.kts +++ b/minecraft/build.gradle.kts @@ -6,8 +6,10 @@ import com.replaymod.gradle.preprocess.PreprocessTask import com.replaymod.gradle.preprocess.ProjectGraphNode import com.replaymod.gradle.preprocess.RootPreprocessExtension import dev.deftu.gradle.utils.GameSide +import dev.deftu.gradle.utils.version.MinecraftDropVersion import dev.deftu.gradle.utils.version.MinecraftReleaseVersion import dev.deftu.gradle.utils.version.MinecraftVersions +import dev.deftu.gradle.utils.version.patchless import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute import gg.essential.gradle.util.prebundle import org.gradle.kotlin.dsl.invoke @@ -177,9 +179,14 @@ dependencies { } } - val mcVersion = mcData.version as MinecraftReleaseVersion - val tripleVersion = Triple(mcVersion.major, mcVersion.minor, mcVersion.patch) - val mcVersionString = listOf(mcVersion.major, mcVersion.minor, mcVersion.patch).joinToString(".") + val mcVersion = mcData.version + val tripleVersion = when (mcVersion) { + is MinecraftDropVersion -> Triple(mcVersion.year, mcVersion.drop, mcVersion.patch) + is MinecraftReleaseVersion -> Triple(mcVersion.major, mcVersion.minor, mcVersion.patch) + else -> error("no") + } + + val mcVersionString = mcData.version.patchless compileOnlyCompat("gg.essential:vigilance-1.8.9-forge:299") compileOnlyCompat("org.notenoughupdates.moulconfig:common:3.11.0") @@ -284,8 +291,9 @@ dependencies { provideIncludedDependencies( - Triple(mcVersion.major, mcVersion.minor, mcVersion.patch), - mcData.loader.friendlyString + tripleVersion, + mcData.loader.friendlyString, + mcVersion.toString() ).forEach { if (it.dep is String) { @Suppress("USELESS_CAST") From 9cb1963d9872c971807dd2ef19928e5be3e04cd3 Mon Sep 17 00:00:00 2001 From: Deftu Date: Tue, 20 Jan 2026 14:04:24 +0200 Subject: [PATCH 26/34] We need toString not patchless --- minecraft/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft/build.gradle.kts b/minecraft/build.gradle.kts index a3570736b..7196ecc22 100644 --- a/minecraft/build.gradle.kts +++ b/minecraft/build.gradle.kts @@ -186,7 +186,7 @@ dependencies { else -> error("no") } - val mcVersionString = mcData.version.patchless + val mcVersionString = mcData.version.toString() compileOnlyCompat("gg.essential:vigilance-1.8.9-forge:299") compileOnlyCompat("org.notenoughupdates.moulconfig:common:3.11.0") From bc4491e5e0280214a338ff559fab6d1648869ef7 Mon Sep 17 00:00:00 2001 From: Deftu Date: Wed, 21 Jan 2026 14:36:15 +0200 Subject: [PATCH 27/34] Minecraft 26.1 is mostly functional now --- gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- minecraft/src/main/resources/fabric.mod.json | 2 +- .../polyfrost/oneconfig/internal/compat/ModMenuCompat.kt | 2 +- .../compat/yacl/Mixin_YetAnotherConfigLib_Builder.java | 2 ++ .../compat/yacl/AbstractDropdownControllerCompat.kt | 2 ++ .../oneconfig/internal/compat/yacl/ExtraHandler.kt | 2 ++ .../oneconfig/internal/compat/yacl/ExtraV1Handlers.kt | 3 +++ .../oneconfig/internal/compat/yacl/YaclV1Compat.kt | 2 ++ .../mixin/compat/rconfig/Mixin_Configurations.java | 2 ++ .../polyfrost/oneconfig/internal/compat/RConfigCompat.kt | 2 +- .../polyfrost/oneconfig/internal/compat/RConfigCompat.kt | 4 +++- modules/relocator/src/main/kotlin/utils.kt | 9 +++++++-- settings.gradle.kts | 2 +- 14 files changed, 29 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5b1af1b5c..1ee718262 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ ksp.incremental=false dgt.java.version=8 dgt.loom.mappings=official-like -dgt.minecraft.revision=4 +dgt.minecraft.revision=5 # Project Configuration project.group=org.polyfrost.oneconfig diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 572086f84..83d6cb783 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,7 +35,7 @@ brigadier = "1.0.18" oneconfig-loader = "1.1.0-alpha.48" # Gradle -dgt = "2.71.0" +dgt = "2.72.0" kotlinx-abi = "0.18.1" licenser = "2.1.1" jetbrains-idea-ext = "1.3" diff --git a/minecraft/src/main/resources/fabric.mod.json b/minecraft/src/main/resources/fabric.mod.json index 249b1b465..42b0ec77b 100644 --- a/minecraft/src/main/resources/fabric.mod.json +++ b/minecraft/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ }, "depends": { "fabricloader": ">=0.12.0", - "minecraft": "${mc_version}" + "minecraft": "${fabric_mc_version}" }, "custom": { "modmenu": { diff --git a/minecraft/versions/1.16.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/ModMenuCompat.kt b/minecraft/versions/1.16.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/ModMenuCompat.kt index a79510d64..fc4dc4785 100644 --- a/minecraft/versions/1.16.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/ModMenuCompat.kt +++ b/minecraft/versions/1.16.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/ModMenuCompat.kt @@ -1,6 +1,6 @@ package org.polyfrost.oneconfig.internal.compat -//#if FABRIC +//#if FABRIC && MC < 26.1 import com.terraformersmc.modmenu.ModMenu import com.terraformersmc.modmenu.util.mod.Mod import dev.deftu.omnicore.api.client.screen.currentScreen diff --git a/minecraft/versions/1.20.1-fabric/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/yacl/Mixin_YetAnotherConfigLib_Builder.java b/minecraft/versions/1.20.1-fabric/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/yacl/Mixin_YetAnotherConfigLib_Builder.java index ceaa07dda..566cb443d 100644 --- a/minecraft/versions/1.20.1-fabric/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/yacl/Mixin_YetAnotherConfigLib_Builder.java +++ b/minecraft/versions/1.20.1-fabric/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/yacl/Mixin_YetAnotherConfigLib_Builder.java @@ -1,5 +1,6 @@ package org.polyfrost.oneconfig.internal.mixin.compat.yacl; +//#if MC < 26.1 //#if MC != 1.20.4 || FABRIC import dev.isxander.yacl3.api.ConfigCategory; import dev.isxander.yacl3.api.YetAnotherConfigLib; @@ -27,4 +28,5 @@ public void build(CallbackInfoReturnable cir) { YaclV1Compat.build(title, categories, saveFunction); } } +//#endif //#endif \ No newline at end of file diff --git a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/AbstractDropdownControllerCompat.kt b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/AbstractDropdownControllerCompat.kt index 8cd244676..7d6f6e9c1 100644 --- a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/AbstractDropdownControllerCompat.kt +++ b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/AbstractDropdownControllerCompat.kt @@ -1,5 +1,6 @@ package org.polyfrost.oneconfig.internal.compat.yacl +//#if MC < 26.1 //#if MC != 1.20.4 || FABRIC import dev.isxander.yacl3.api.Controller import dev.isxander.yacl3.gui.controllers.dropdown.AbstractDropdownController @@ -25,4 +26,5 @@ internal object AbstractDropdownControllerCompat : ExtraHandler> { fun handle(controller: Controller<*>, builder: YaclPropertyBuilder): Class? } +//#endif //#endif \ No newline at end of file diff --git a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/ExtraV1Handlers.kt b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/ExtraV1Handlers.kt index 55d3a539c..f41777303 100644 --- a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/ExtraV1Handlers.kt +++ b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/ExtraV1Handlers.kt @@ -1,8 +1,11 @@ package org.polyfrost.oneconfig.internal.compat.yacl + +//#if MC < 26.1 //#if MC != 1.20.4 || FABRIC object ExtraV1Handlers { init { extraYaclHandlers.add(AbstractDropdownControllerCompat) } } +//#endif //#endif \ No newline at end of file diff --git a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/YaclV1Compat.kt b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/YaclV1Compat.kt index 923f90b54..2f6e6a427 100644 --- a/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/YaclV1Compat.kt +++ b/minecraft/versions/1.20.1-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/yacl/YaclV1Compat.kt @@ -4,6 +4,7 @@ import dev.deftu.omnicore.api.client.getIconResource import dev.deftu.omnicore.api.client.getIconResourcePath import net.minecraft.network.chat.Component as Text // preprocessor moment, ping me (wyvest) if you want an explanation why this is needed +//#if MC < 26.1 //#if MC != 1.20.4 || FABRIC import dev.deftu.omnicore.api.loader.ModInfo import dev.isxander.yacl3.api.ConfigCategory @@ -207,4 +208,5 @@ internal class YaclPropertyBuilder internal constructor(option: Option<*>) { this@YaclPropertyBuilder.metadata.entries.forEach { (key, value) -> addMetadata(key, value) } } } +//#endif //#endif \ No newline at end of file diff --git a/minecraft/versions/1.20.4-forge/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/rconfig/Mixin_Configurations.java b/minecraft/versions/1.20.4-forge/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/rconfig/Mixin_Configurations.java index c96ee9c3b..1e5503669 100644 --- a/minecraft/versions/1.20.4-forge/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/rconfig/Mixin_Configurations.java +++ b/minecraft/versions/1.20.4-forge/src/main/java/org/polyfrost/oneconfig/internal/mixin/compat/rconfig/Mixin_Configurations.java @@ -1,5 +1,6 @@ package org.polyfrost.oneconfig.internal.mixin.compat.rconfig; +//#if MC < 26.1 import com.llamalad7.mixinextras.sugar.Local; import com.teamresourceful.resourcefulconfig.api.types.ResourcefulConfig; import com.teamresourceful.resourcefulconfig.common.config.Configurations; @@ -25,3 +26,4 @@ private void addConfig(CallbackInfo ci, @Local(argsOnly = true) ResourcefulConfi } } +//#endif diff --git a/minecraft/versions/1.20.4-forge/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt b/minecraft/versions/1.20.4-forge/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt index b19db31fa..ab459f0db 100644 --- a/minecraft/versions/1.20.4-forge/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt +++ b/minecraft/versions/1.20.4-forge/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt @@ -168,4 +168,4 @@ internal object RConfigCompat { } } -} \ No newline at end of file +} diff --git a/minecraft/versions/1.21.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt b/minecraft/versions/1.21.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt index f48c37bdf..f142d5487 100644 --- a/minecraft/versions/1.21.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt +++ b/minecraft/versions/1.21.5-fabric/src/main/kotlin/org/polyfrost/oneconfig/internal/compat/RConfigCompat.kt @@ -1,5 +1,6 @@ package org.polyfrost.oneconfig.internal.compat +//#if MC < 26.1 import com.teamresourceful.resourcefulconfig.api.types.ResourcefulConfig import com.teamresourceful.resourcefulconfig.api.types.ResourcefulConfigButton import com.teamresourceful.resourcefulconfig.api.types.ResourcefulConfigElement @@ -191,4 +192,5 @@ internal object RConfigCompat { } } -} \ No newline at end of file +} +//#endif diff --git a/modules/relocator/src/main/kotlin/utils.kt b/modules/relocator/src/main/kotlin/utils.kt index 885ab53e7..3754003e4 100644 --- a/modules/relocator/src/main/kotlin/utils.kt +++ b/modules/relocator/src/main/kotlin/utils.kt @@ -11,9 +11,14 @@ internal enum class SourceKind(val fileExtension: String) { ; } -internal fun convertStringToIntVersion(version: String) = - version.let { if (it.count { char -> char == '.' } == 1) "$it.0" else it }.split(".") +internal fun convertStringToIntVersion(version: String): Int { + val version = if (version.substringBefore('.') != "1") { + version.substringBefore("-") + } else version + + return version.let { if (it.count { char -> char == '.' } == 1) "$it.0" else it }.split(".") .joinToString("") { it.padStart(2, '0') }.toInt() +} internal enum class SourceLocation(val path: String) { PRE_PROCESSED("build/preprocessed/main"), diff --git a/settings.gradle.kts b/settings.gradle.kts index 24d354335..7f551d99e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,7 @@ pluginManagement { plugins { kotlin("jvm") version("2.3.0") - id("dev.deftu.gradle.multiversion-root") version("2.70.0") // Update in libs.versions.toml too!!! + id("dev.deftu.gradle.multiversion-root") version("2.72.0") // Update in libs.versions.toml too!!! } } From 50a258791eb18cd1572e86c3d784d018909e564c Mon Sep 17 00:00:00 2001 From: Deftu Date: Thu, 22 Jan 2026 09:54:44 +0200 Subject: [PATCH 28/34] stuff --- bootstrap/build.gradle.kts | 2 -- gradle/libs.versions.toml | 6 +++--- minecraft/build.gradle.kts | 5 ----- settings.gradle.kts | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/bootstrap/build.gradle.kts b/bootstrap/build.gradle.kts index a733224fe..f70882630 100644 --- a/bootstrap/build.gradle.kts +++ b/bootstrap/build.gradle.kts @@ -6,8 +6,6 @@ import dev.deftu.gradle.utils.version.MinecraftReleaseVersion import org.polyfrost.gradle.provideFabricApiDependency import org.polyfrost.gradle.provideIncludedDependencies -println("[${mcData.version::class.java}] ${mcData.version}") - plugins { java alias(libs.plugins.kotlin) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 83d6cb783..547c6fb8d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,10 +2,10 @@ # Libraries # All -kotlin = "2.2.10" +kotlin = "2.3.0" kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" -fabric-language-kotlin = "1.13.5+kotlin.2.2.10" +fabric-language-kotlin = "1.13.8+kotlin.2.3.0" google-ksp = "2.2.10-2.0.2" polyui = "2.0.7" annotations = "24.1.0" @@ -35,7 +35,7 @@ brigadier = "1.0.18" oneconfig-loader = "1.1.0-alpha.48" # Gradle -dgt = "2.72.0" +dgt = "2.73.0" kotlinx-abi = "0.18.1" licenser = "2.1.1" jetbrains-idea-ext = "1.3" diff --git a/minecraft/build.gradle.kts b/minecraft/build.gradle.kts index 7196ecc22..0716b1fb8 100644 --- a/minecraft/build.gradle.kts +++ b/minecraft/build.gradle.kts @@ -9,7 +9,6 @@ import dev.deftu.gradle.utils.GameSide import dev.deftu.gradle.utils.version.MinecraftDropVersion import dev.deftu.gradle.utils.version.MinecraftReleaseVersion import dev.deftu.gradle.utils.version.MinecraftVersions -import dev.deftu.gradle.utils.version.patchless import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute import gg.essential.gradle.util.prebundle import org.gradle.kotlin.dsl.invoke @@ -403,10 +402,6 @@ tasks { exclude("patched-lwjgl/**") } } - - fun Manifest.applyManifest() { - - } } afterEvaluate { diff --git a/settings.gradle.kts b/settings.gradle.kts index 7f551d99e..6c846bbe4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,7 @@ pluginManagement { plugins { kotlin("jvm") version("2.3.0") - id("dev.deftu.gradle.multiversion-root") version("2.72.0") // Update in libs.versions.toml too!!! + id("dev.deftu.gradle.multiversion-root") version("2.73.0") // Update in libs.versions.toml too!!! } } From 02d97bfcf131f1f13d35e9d57e3d9792545e3b30 Mon Sep 17 00:00:00 2001 From: Deftu Date: Sat, 24 Jan 2026 20:22:36 +0200 Subject: [PATCH 29/34] al;l of the stuff is worky hooray --- gradle/libs.versions.toml | 2 +- .../java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java | 8 +++++++- .../oneconfig/api/ui/v1/internal/GLRendererImpl.kt | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 547c6fb8d..12153281a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2" kotlinx-atomicfu = "0.29.0" fabric-language-kotlin = "1.13.8+kotlin.2.3.0" google-ksp = "2.2.10-2.0.2" -polyui = "2.0.7" +polyui = "2.1.1" annotations = "24.1.0" hypixel-modapi = "1.0.1" hypixel-data = "0.2.0" # Dep of hypixel-modapi diff --git a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java index e911aa8a7..6a236d011 100644 --- a/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java +++ b/modules/ui/src/main/java/org/polyfrost/oneconfig/api/ui/v1/UIManager.java @@ -59,6 +59,7 @@ import org.polyfrost.polyui.data.Font; import org.polyfrost.polyui.renderer.Renderer; import org.polyfrost.polyui.renderer.Window; +import org.polyfrost.polyui.unit.Vec2; import java.util.ServiceLoader; import java.util.function.Consumer; @@ -190,7 +191,12 @@ default PolyUI createDefault() { EventManager.register(ResizeEvent.class, event -> { float ratio = Platform.screen().pixelRatio(); polyUI.resize(event.newWidth, event.newHeight, false); - framebuffer.resize((int) (polyUI.getMaster().getWidth() * ratio), (int) (polyUI.getMaster().getHeight() * ratio)); + + long visibleSize = polyUI.getVisibleSize(); + int polyUiWidth = (int) Vec2.getX(visibleSize); + int polyUiHeight = (int) Vec2.getY(visibleSize); + System.out.println("Resizing to: " + polyUiWidth + "x" + polyUiHeight + " with ratio " + ratio); + framebuffer.resize(polyUiWidth, polyUiHeight); polyUI.getWindow().setPixelRatio(ratio); }); diff --git a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt index 14db6be4f..4df148238 100644 --- a/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt +++ b/modules/ui/src/main/kotlin/org/polyfrost/oneconfig/api/ui/v1/internal/GLRendererImpl.kt @@ -16,6 +16,7 @@ import org.lwjgl.opengl.GL13.* import org.lwjgl.opengl.GL14.* import org.lwjgl.opengl.GL15.* import org.lwjgl.opengl.GL20.* +import org.lwjgl.opengl.GL33.glBindSampler import org.polyfrost.oneconfig.api.platform.v1.Platform import org.polyfrost.oneconfig.api.ui.v1.UIManager import org.polyfrost.oneconfig.api.ui.v1.api.NanoSvgApi @@ -502,6 +503,7 @@ class GLRendererImpl(private val nsvg: NanoSvgApi, private val stb: StbApi) : Re glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, atlas) + glBindSampler(0, 0) // asm: on VAO the state is stored, so we only need to set it up once if (!GlCapabilities.isGl3Available) { From 309e9655c1b323cead22f9888f211e6bb475e08e Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sat, 24 Jan 2026 13:27:33 -0500 Subject: [PATCH 30/34] Add version '26.1-fabric' to settings.gradle.kts --- settings.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index b11d6d9c5..7867db321 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -133,6 +133,7 @@ listOf( "1.21.8-fabric", "1.21.10-fabric", "1.21.11-fabric", + "26.1-fabric" ).contains(version)) { include(bootstrapProj) project(bootstrapProj).apply { From 95bf6c54b5af3c04207a3048f647920e352376c1 Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sat, 24 Jan 2026 13:38:28 -0500 Subject: [PATCH 31/34] Update Java version from 21 to 25 in build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc1919a99..480965bfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: - name: Setup Java uses: actions/setup-java@v4 with: - java-version: 21 + java-version: 25 distribution: temurin - name: Setup Gradle From 571217dfe39002a0ab931f7c78f3e911b328a98c Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sat, 24 Jan 2026 13:53:13 -0500 Subject: [PATCH 32/34] Create gradle.properties --- bootstrap/versions/26.1-fabric/gradle.properties | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 bootstrap/versions/26.1-fabric/gradle.properties diff --git a/bootstrap/versions/26.1-fabric/gradle.properties b/bootstrap/versions/26.1-fabric/gradle.properties new file mode 100644 index 000000000..18f4546dc --- /dev/null +++ b/bootstrap/versions/26.1-fabric/gradle.properties @@ -0,0 +1,4 @@ +fabric.loom.disableObfuscation=true +dgt.loom.mappings.use=false +minecraft.version=26.1-snapshot-3 +dgt.fabric.api.version=0.141.3+26.1 \ No newline at end of file From fe6cb684eef4cd9a4f7d72897a976b66f841e010 Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sat, 24 Jan 2026 13:55:02 -0500 Subject: [PATCH 33/34] Update build.gradle.kts --- modules/dependencies/legacy/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dependencies/legacy/build.gradle.kts b/modules/dependencies/legacy/build.gradle.kts index 27ed664f7..edd26cd99 100644 --- a/modules/dependencies/legacy/build.gradle.kts +++ b/modules/dependencies/legacy/build.gradle.kts @@ -1,7 +1,7 @@ import org.polyfrost.gradle.provideIncludedDependencies plugins { - id("dev.deftu.gradle.loom") + id("gg.essential.loom") } repositories { From 641a8cb0d041a4c4bd5cc91f97fbb236e5dbf1eb Mon Sep 17 00:00:00 2001 From: Wyvest Date: Sat, 24 Jan 2026 15:00:24 -0500 Subject: [PATCH 34/34] Add bootstrap node for fabric version 26.1 --- bootstrap/root.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap/root.gradle.kts b/bootstrap/root.gradle.kts index 066c73440..0d5c78439 100644 --- a/bootstrap/root.gradle.kts +++ b/bootstrap/root.gradle.kts @@ -22,6 +22,7 @@ preprocess { val fabric12108 = createNode("bootstrap-1.21.8-fabric", 1_21_08, "yarn") val fabric12110 = createNode("bootstrap-1.21.10-fabric", 1_21_10, "yarn") val fabric12111 = createNode("bootstrap-1.21.11-fabric", 1_21_11, "yarn") + val fabric261 = createNode("bootstrap-26.1-fabric", 26_01_00, "yarn") forge11202.link(forge10809) forge11605.link(forge11202) @@ -32,6 +33,7 @@ preprocess { fabric12108.link(fabric12105) fabric12110.link(fabric12108) fabric12111.link(fabric12110) + fabric261.link(fabric12111) strictExtraMappings.set(true) }