From a854deebd5e1118da630673b0090fd121d47117a Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Mon, 14 Sep 2026 20:44:09 -0400 Subject: [PATCH] 26.3 --- .../main/kotlin/moulconfig.fabric.gradle.kts | 2 +- .../moulconfig/common/IKeyboardConstants.java | 49 +++++++ .../moulconfig/common/IKeyboardConstants.kt | 32 ----- .../moulconfig/common/IMinecraft.java | 2 + .../moulconfig/common/MouseConstants.java | 9 ++ .../gui/component/ColorSelectComponent.java | 2 +- .../gui/component/SliderComponent.kt | 5 +- .../gui/component/SliderWithTextComponent.kt | 4 +- .../gui/component/SwitchComponent.java | 3 +- .../gui/editors/GuiOptionEditorAccordion.java | 3 +- .../gui/editors/GuiOptionEditorButton.java | 2 +- .../gui/editors/GuiOptionEditorColour.java | 3 +- .../gui/editors/GuiOptionEditorDropdown.java | 2 +- .../gui/editors/GuiOptionEditorKeybind.java | 2 +- .../internal/ForgeKeyboardConstants.java | 125 ++++++++++++++++++ .../internal/ForgeKeyboardConstants.kt | 53 -------- .../moulconfig/internal/ForgeMinecraft.kt | 6 +- .../internal/ForgeMouseConstants.java | 24 ++++ modern/26.3/build.gradle.kts | 8 ++ modern/26.3/gradle.properties | 5 + .../main/resources/moulconfig.accesswidener | 10 ++ .../platform/ModernMouseConstants.java | 25 ++++ .../platform/MoulConfigPlatform.java | 21 +++ .../platform/MoulConfigRenderContext.java | 8 ++ .../moulconfig/test/TestCategoryA.kt | 6 +- settings.gradle.kts | 3 +- 26 files changed, 312 insertions(+), 102 deletions(-) create mode 100644 common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.java delete mode 100644 common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.kt create mode 100644 common/src/main/java/io/github/notenoughupdates/moulconfig/common/MouseConstants.java create mode 100644 legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.java delete mode 100644 legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.kt create mode 100644 legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMouseConstants.java create mode 100644 modern/26.3/build.gradle.kts create mode 100644 modern/26.3/gradle.properties create mode 100644 modern/26.3/src/main/resources/moulconfig.accesswidener create mode 100644 modern/templates/java/io/github/notenoughupdates/moulconfig/platform/ModernMouseConstants.java diff --git a/build-src/src/main/kotlin/moulconfig.fabric.gradle.kts b/build-src/src/main/kotlin/moulconfig.fabric.gradle.kts index 7c57af41a..498246e09 100644 --- a/build-src/src/main/kotlin/moulconfig.fabric.gradle.kts +++ b/build-src/src/main/kotlin/moulconfig.fabric.gradle.kts @@ -29,7 +29,7 @@ the().minecraft { } fabric { - loader("0.18.4") + loader("0.19.5") if (hasAW) accessWidener(aF) } diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.java new file mode 100644 index 000000000..17f5674b9 --- /dev/null +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.java @@ -0,0 +1,49 @@ +package io.github.notenoughupdates.moulconfig.common; + +public interface IKeyboardConstants { + int getBackSpace(); + + int getCtrlLeft(); + + int getCtrlRight(); + + int getCmdLeft(); + + int getCmdRight(); + + int getShiftLeft(); + + int getShiftRight(); + + int getEscape(); + + int getNone(); + + int getEnter(); + + int getDelete(); + + int getUp(); + + int getDown(); + + int getLeft(); + + int getRight(); + + int getHome(); + + int getEnd(); + + int getKeyA(); + + int getKeyC(); + + int getKeyX(); + + int getKeyV(); + + int getKeyN(); + + int getKeyF(); +} diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.kt b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.kt deleted file mode 100644 index d6eb1bcb3..000000000 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IKeyboardConstants.kt +++ /dev/null @@ -1,32 +0,0 @@ -package io.github.notenoughupdates.moulconfig.common - -/** - * Not for manual implementation. This should be implemented by the corresponding platform. - * @see IMinecraft.keyboardConstants - * @see KeyboardConstants - */ -interface IKeyboardConstants { - val backSpace: Int - val ctrlLeft: Int - val ctrlRight: Int - val cmdLeft: Int - val cmdRight: Int - val shiftLeft: Int - val shiftRight: Int - val escape: Int - val none: Int - val enter: Int - val delete: Int - val up: Int - val down: Int - val right: Int - val left: Int - val home: Int - val end: Int - val keyA: Int - val keyC: Int - val keyX: Int - val keyV: Int - val keyN: Int - val keyF: Int -} diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IMinecraft.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IMinecraft.java index 354fc0044..ce4594205 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IMinecraft.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/IMinecraft.java @@ -67,6 +67,8 @@ default double getMouseYHF() { IKeyboardConstants getKeyboardConstants(); + MouseConstants getMouseConstants(); + int getScaledWidth(); int getScaledHeight(); diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/common/MouseConstants.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/MouseConstants.java new file mode 100644 index 000000000..3b9ec8644 --- /dev/null +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/common/MouseConstants.java @@ -0,0 +1,9 @@ +package io.github.notenoughupdates.moulconfig.common; + +public interface MouseConstants { + int left(); + + int middle(); + + int right(); +} diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/ColorSelectComponent.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/ColorSelectComponent.java index a84a90580..15cb099f5 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/ColorSelectComponent.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/ColorSelectComponent.java @@ -398,7 +398,7 @@ public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateC } if (context.isHovered() && click.getMouseState()) requestFocus(); - if (focusedSubComponent != null && !click.getMouseState() && click.getMouseButton() == 0) { + if (focusedSubComponent != null && !click.getMouseState() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left()) { focusedSubComponent = null; return true; } diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderComponent.kt b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderComponent.kt index 927c43fe7..cb8e68923 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderComponent.kt +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderComponent.kt @@ -1,6 +1,7 @@ package io.github.notenoughupdates.moulconfig.gui.component import io.github.notenoughupdates.moulconfig.GuiTextures +import io.github.notenoughupdates.moulconfig.common.IMinecraft import io.github.notenoughupdates.moulconfig.gui.GuiComponent import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext import io.github.notenoughupdates.moulconfig.gui.MouseEvent @@ -66,8 +67,8 @@ open class SliderComponent( } override fun mouseEvent(mouseEvent: MouseEvent, context: GuiImmediateContext): Boolean { - if (!context.renderContext.isMouseButtonDown(0)) clicked = false - if (context.isHovered && mouseEvent is MouseEvent.Click && mouseEvent.mouseState && mouseEvent.mouseButton == 0) { + if (!context.renderContext.isMouseButtonDown(IMinecraft.INSTANCE.getMouseConstants().left())) clicked = false + if (context.isHovered && mouseEvent is MouseEvent.Click && mouseEvent.mouseState && mouseEvent.mouseButton == IMinecraft.INSTANCE.getMouseConstants().left()) { clicked = true } if (clicked) { diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderWithTextComponent.kt b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderWithTextComponent.kt index 5fc8991c3..2b02648ec 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderWithTextComponent.kt +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderWithTextComponent.kt @@ -33,8 +33,8 @@ open class SliderWithTextComponent( } override fun mouseEvent(mouseEvent: MouseEvent, context: GuiImmediateContext): Boolean { - if (!context.renderContext.isMouseButtonDown(0)) clicked = false - if (context.isHovered() && mouseEvent is MouseEvent.Click && mouseEvent.mouseState && mouseEvent.mouseButton == 0) { + if (!context.renderContext.isMouseButtonDown(IMinecraft.INSTANCE.getMouseConstants().left())) clicked = false + if (context.isHovered() && mouseEvent is MouseEvent.Click && mouseEvent.mouseState && mouseEvent.mouseButton == IMinecraft.INSTANCE.getMouseConstants().left()) { clicked = true } if (clicked) { diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SwitchComponent.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SwitchComponent.java index 8be1a1062..f34034e1d 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SwitchComponent.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SwitchComponent.java @@ -21,6 +21,7 @@ package io.github.notenoughupdates.moulconfig.gui.component; import io.github.notenoughupdates.moulconfig.GuiTextures; +import io.github.notenoughupdates.moulconfig.common.IMinecraft; import io.github.notenoughupdates.moulconfig.common.MyResourceLocation; import io.github.notenoughupdates.moulconfig.gui.GuiComponent; import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext; @@ -93,7 +94,7 @@ public boolean mouseEvent(MouseEvent event, GuiImmediateContext context) { super.mouseEvent(event, context); if (!(event instanceof MouseEvent.Click)) return false; var click = (MouseEvent.Click) event; - if (context.isHovered() && click.getMouseButton() == 0 && click.getMouseState()) { + if (context.isHovered() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left() && click.getMouseState()) { value.set(!value.get()); return true; } diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorAccordion.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorAccordion.java index 4945b9361..67ba2fbdf 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorAccordion.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorAccordion.java @@ -20,6 +20,7 @@ package io.github.notenoughupdates.moulconfig.gui.editors; +import io.github.notenoughupdates.moulconfig.common.IMinecraft; import io.github.notenoughupdates.moulconfig.gui.GuiComponent; import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext; import io.github.notenoughupdates.moulconfig.gui.MouseEvent; @@ -58,7 +59,7 @@ public void render(@NotNull GuiImmediateContext context) { public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateContext context) { if (mouseEvent instanceof MouseEvent.Click) { val click = (MouseEvent.Click) mouseEvent; - if (click.getMouseState() && context.isHovered() && click.getMouseButton() == 0) { + if (click.getMouseState() && context.isHovered() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left()) { accordionToggled = !accordionToggled; return true; } diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorButton.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorButton.java index 62125b920..7503f9dd7 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorButton.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorButton.java @@ -133,7 +133,7 @@ public void render(@NotNull GuiImmediateContext context) { public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateContext context) { if (mouseEvent instanceof MouseEvent.Click) { val click = (MouseEvent.Click) mouseEvent; - if (click.getMouseState() && context.isHovered() && click.getMouseButton() == 0) { + if (click.getMouseState() && context.isHovered() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left()) { onClick(); return true; } diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorColour.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorColour.java index fac19fda7..2133af6da 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorColour.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorColour.java @@ -22,6 +22,7 @@ import io.github.notenoughupdates.moulconfig.ChromaColour; import io.github.notenoughupdates.moulconfig.GuiTextures; +import io.github.notenoughupdates.moulconfig.common.IMinecraft; import io.github.notenoughupdates.moulconfig.gui.GuiComponent; import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext; import io.github.notenoughupdates.moulconfig.gui.MouseEvent; @@ -71,7 +72,7 @@ public void render(@NotNull GuiImmediateContext context) { public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateContext context) { if (mouseEvent instanceof MouseEvent.Click) { val click = ((MouseEvent.Click) mouseEvent); - if (click.getMouseState() && click.getMouseButton() == 0 && context.isHovered()) { + if (click.getMouseState() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left() && context.isHovered()) { ColorSelectComponent colorSelectComponent = new ColorSelectComponent(0, 0, get().toLegacyString(), newString -> set(newString), () -> { closeOverlay(); }); diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorDropdown.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorDropdown.java index 2a632ecde..470edb6a2 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorDropdown.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorDropdown.java @@ -83,7 +83,7 @@ public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateC if (click.getMouseState()) { closeOverlay(); } - if (click.getMouseState() && click.getMouseButton() == 0 && context.isHovered()) { + if (click.getMouseState() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left() && context.isHovered()) { int top = 0; int mouseY = context.getMouseY(); int dropdownY = 13; diff --git a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorKeybind.java b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorKeybind.java index 142f27d71..a300cd2b9 100644 --- a/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorKeybind.java +++ b/common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors/GuiOptionEditorKeybind.java @@ -79,7 +79,7 @@ public boolean mouseEvent(@NotNull MouseEvent mouseEvent, @NotNull GuiImmediateC return true; } - if (click.getMouseState() && click.getMouseButton() == 0) { + if (click.getMouseState() && click.getMouseButton() == IMinecraft.INSTANCE.getMouseConstants().left()) { int height = getHeight(); int width = getHeight(); int mouseX = context.getMouseX(); diff --git a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.java b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.java new file mode 100644 index 000000000..c3708cc5a --- /dev/null +++ b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.java @@ -0,0 +1,125 @@ +package io.github.notenoughupdates.moulconfig.internal; + +import io.github.notenoughupdates.moulconfig.common.IKeyboardConstants; +import org.lwjgl.input.Keyboard; + +public final class ForgeKeyboardConstants implements IKeyboardConstants { + public static final ForgeKeyboardConstants INSTANCE = new ForgeKeyboardConstants(); + + private ForgeKeyboardConstants() {} + + @Override + public int getBackSpace() { + return Keyboard.KEY_BACK; + } + + @Override + public int getCtrlLeft() { + return Keyboard.KEY_LCONTROL; + } + + @Override + public int getCtrlRight() { + return Keyboard.KEY_RCONTROL; + } + + @Override + public int getCmdLeft() { + return Keyboard.KEY_LMETA; + } + + @Override + public int getCmdRight() { + return Keyboard.KEY_RMETA; + } + + @Override + public int getShiftLeft() { + return Keyboard.KEY_LSHIFT; + } + + @Override + public int getShiftRight() { + return Keyboard.KEY_RSHIFT; + } + + @Override + public int getEscape() { + return Keyboard.KEY_ESCAPE; + } + + @Override + public int getNone() { + return Keyboard.KEY_NONE; + } + + @Override + public int getEnter() { + return Keyboard.KEY_RETURN; + } + + @Override + public int getDelete() { + return Keyboard.KEY_DELETE; + } + + @Override + public int getUp() { + return Keyboard.KEY_UP; + } + + @Override + public int getDown() { + return Keyboard.KEY_DOWN; + } + + @Override + public int getLeft() { + return Keyboard.KEY_LEFT; + } + + @Override + public int getRight() { + return Keyboard.KEY_RIGHT; + } + + @Override + public int getHome() { + return Keyboard.KEY_HOME; + } + + @Override + public int getEnd() { + return Keyboard.KEY_END; + } + + @Override + public int getKeyA() { + return Keyboard.KEY_A; + } + + @Override + public int getKeyC() { + return Keyboard.KEY_C; + } + + @Override + public int getKeyX() { + return Keyboard.KEY_X; + } + + @Override + public int getKeyV() { + return Keyboard.KEY_V; + } + + @Override + public int getKeyN() { + return Keyboard.KEY_N; + } + + @Override + public int getKeyF() { + return Keyboard.KEY_F; + } +} diff --git a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.kt b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.kt deleted file mode 100644 index 28fd90611..000000000 --- a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeKeyboardConstants.kt +++ /dev/null @@ -1,53 +0,0 @@ -package io.github.notenoughupdates.moulconfig.internal - -import io.github.notenoughupdates.moulconfig.common.IKeyboardConstants -import org.lwjgl.input.Keyboard - -object ForgeKeyboardConstants : IKeyboardConstants { - override val backSpace: Int - get() = Keyboard.KEY_BACK - override val ctrlLeft: Int - get() = Keyboard.KEY_LCONTROL - override val ctrlRight: Int - get() = Keyboard.KEY_RCONTROL - override val cmdLeft: Int - get() = Keyboard.KEY_LMETA - override val cmdRight: Int - get() = Keyboard.KEY_RMETA - override val shiftLeft: Int - get() = Keyboard.KEY_LSHIFT - override val shiftRight: Int - get() = Keyboard.KEY_RSHIFT - override val escape: Int - get() = Keyboard.KEY_ESCAPE - override val none: Int - get() = Keyboard.KEY_NONE - override val enter: Int - get() = Keyboard.KEY_RETURN - override val delete: Int - get() = Keyboard.KEY_DELETE - override val up: Int - get() = Keyboard.KEY_UP - override val down: Int - get() = Keyboard.KEY_DOWN - override val right: Int - get() = Keyboard.KEY_RIGHT - override val left: Int - get() = Keyboard.KEY_LEFT - override val home: Int - get() = Keyboard.KEY_HOME - override val end: Int - get() = Keyboard.KEY_END - override val keyA: Int - get() = Keyboard.KEY_A - override val keyC: Int - get() = Keyboard.KEY_C - override val keyX: Int - get() = Keyboard.KEY_X - override val keyV: Int - get() = Keyboard.KEY_V - override val keyN: Int - get() = Keyboard.KEY_N - override val keyF: Int - get() = Keyboard.KEY_F -} diff --git a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMinecraft.kt b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMinecraft.kt index 47818636c..368949f11 100644 --- a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMinecraft.kt +++ b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMinecraft.kt @@ -242,6 +242,10 @@ class ForgeMinecraft : IMinecraft { } override fun getKeyboardConstants(): IKeyboardConstants { - return ForgeKeyboardConstants + return ForgeKeyboardConstants.INSTANCE; + } + + override fun getMouseConstants(): MouseConstants { + return ForgeMouseConstants.INSTANCE; } } diff --git a/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMouseConstants.java b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMouseConstants.java new file mode 100644 index 000000000..974593cc3 --- /dev/null +++ b/legacy/src/main/java/io/github/notenoughupdates/moulconfig/internal/ForgeMouseConstants.java @@ -0,0 +1,24 @@ +package io.github.notenoughupdates.moulconfig.internal; + +import io.github.notenoughupdates.moulconfig.common.MouseConstants; + +public final class ForgeMouseConstants implements MouseConstants { + protected static final ForgeMouseConstants INSTANCE = new ForgeMouseConstants(); + + private ForgeMouseConstants() {} + + @Override + public int left() { + return 0; + } + + @Override + public int middle() { + return 2; + } + + @Override + public int right() { + return 1; + } +} diff --git a/modern/26.3/build.gradle.kts b/modern/26.3/build.gradle.kts new file mode 100644 index 000000000..446f5e0f1 --- /dev/null +++ b/modern/26.3/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("moulconfig.fabric") +} +fabricDeps { + impl("fabric-command-api-v2") +} + +java.toolchain.languageVersion.set(JavaLanguageVersion.of(25)) \ No newline at end of file diff --git a/modern/26.3/gradle.properties b/modern/26.3/gradle.properties new file mode 100644 index 000000000..c8e4e4b82 --- /dev/null +++ b/modern/26.3/gradle.properties @@ -0,0 +1,5 @@ +moulconfig.minecraft=26.3-rc-2 +moulconfig.yarn=2 +moulconfig.fabric=0.160.2+26.3 +moulconfig.rlv1=true +moulconfig.deobfuscated=true \ No newline at end of file diff --git a/modern/26.3/src/main/resources/moulconfig.accesswidener b/modern/26.3/src/main/resources/moulconfig.accesswidener new file mode 100644 index 000000000..f19e35ea6 --- /dev/null +++ b/modern/26.3/src/main/resources/moulconfig.accesswidener @@ -0,0 +1,10 @@ +accessWidener v2 official + +accessible field net/minecraft/client/gui/GuiGraphicsExtractor scissorStack Lnet/minecraft/client/gui/GuiGraphicsExtractor$ScissorStack; +accessible class net/minecraft/client/gui/GuiGraphicsExtractor$ScissorStack +accessible field net/minecraft/client/gui/GuiGraphicsExtractor$ScissorStack stack Ljava/util/Deque; +accessible method net/minecraft/client/gui/GuiGraphicsExtractor fill (Lcom/mojang/renderpearl/api/pipeline/RenderPipeline;IIIII)V +accessible field net/minecraft/client/renderer/RenderPipelines GUI_SNIPPET Lcom/mojang/renderpearl/api/pipeline/RenderPipeline$Snippet; +accessible field net/minecraft/client/gui/GuiGraphicsExtractor guiRenderState Lnet/minecraft/client/renderer/state/gui/GuiRenderState; +accessible method net/minecraft/client/gui/GuiGraphicsExtractor innerFill (Lcom/mojang/renderpearl/api/pipeline/RenderPipeline;Lnet/minecraft/client/gui/render/TextureSetup;IIIIILjava/lang/Integer;)V +accessible method net/minecraft/client/gui/GuiGraphicsExtractor innerBlit (Lcom/mojang/renderpearl/api/pipeline/RenderPipeline;Lcom/mojang/renderpearl/api/textures/GpuTextureView;Lcom/mojang/renderpearl/api/textures/GpuSampler;IIIIFFFFI)V \ No newline at end of file diff --git a/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/ModernMouseConstants.java b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/ModernMouseConstants.java new file mode 100644 index 000000000..8d39f624d --- /dev/null +++ b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/ModernMouseConstants.java @@ -0,0 +1,25 @@ +package io.github.notenoughupdates.moulconfig.platform; + +import io.github.notenoughupdates.moulconfig.common.MouseConstants; +import com.mojang.blaze3d.platform.InputConstants; + +public final class ModernMouseConstants implements MouseConstants { + protected static final ModernMouseConstants INSTANCE = new ModernMouseConstants(); + + private ModernMouseConstants() {} + + @Override + public int left() { + return InputConstants.MOUSE_BUTTON_LEFT; + } + + @Override + public int middle() { + return InputConstants.MOUSE_BUTTON_MIDDLE; + } + + @Override + public int right() { + return InputConstants.MOUSE_BUTTON_RIGHT; + } +} diff --git a/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigPlatform.java b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigPlatform.java index c248440fa..b29360843 100644 --- a/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigPlatform.java +++ b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigPlatform.java @@ -38,7 +38,11 @@ import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; +#if MC >= 260300 +import org.lwjgl.sdl.SDLMouse; +#else import org.lwjgl.glfw.GLFW; +#endif import java.awt.image.BufferedImage; import java.io.InputStream; @@ -207,6 +211,11 @@ public IKeyboardConstants getKeyboardConstants() { return ModernKeyboardConstants.INSTANCE; } + @Override + public MouseConstants getMouseConstants() { + return ModernMouseConstants.INSTANCE; + } + @Override public int getScaledWidth() { return mc.getWindow().getGuiScaledWidth(); @@ -236,7 +245,19 @@ public boolean isOnMacOs() { @Override public boolean isMouseButtonDown(int mouseButton) { + #if MC >= 260300 + int mask = switch (mouseButton) { + case InputConstants.MOUSE_BUTTON_LEFT -> SDLMouse.SDL_BUTTON_LMASK; + case InputConstants.MOUSE_BUTTON_MIDDLE -> SDLMouse.SDL_BUTTON_MMASK; + case InputConstants.MOUSE_BUTTON_RIGHT -> SDLMouse.SDL_BUTTON_RMASK; + case InputConstants.MOUSE_BUTTON_4 -> SDLMouse.SDL_BUTTON_X1MASK; + case InputConstants.MOUSE_BUTTON_5 -> SDLMouse.SDL_BUTTON_X2MASK; + default -> throw new IllegalArgumentException("Illegal Mouse Button " + mouseButton); + }; + return (SDLMouse.SDL_GetMouseState(null, null) & mask) != 0; + #else return GLFW.glfwGetMouseButton(#if MC < 12109 mc.getWindow().getWindow() #else mc.getWindow().handle() #endif, mouseButton) == GLFW.GLFW_PRESS; + #endif } @Override diff --git a/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigRenderContext.java b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigRenderContext.java index 53f58b771..64f309774 100644 --- a/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigRenderContext.java +++ b/modern/templates/java/io/github/notenoughupdates/moulconfig/platform/MoulConfigRenderContext.java @@ -2,8 +2,12 @@ #if MC >= 12111 import com.mojang.blaze3d.systems.RenderSystem; +#if MC >= 260300 +import com.mojang.renderpearl.api.textures.FilterMode; +#else import com.mojang.blaze3d.textures.FilterMode; #endif +#endif import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import io.github.notenoughupdates.moulconfig.common.*; @@ -39,7 +43,11 @@ #endif import org.joml.Matrix3x2f; import org.joml.Matrix3x2fStack; +#if MC >= 260300 +import com.mojang.renderpearl.api.pipeline.RenderPipeline; +#else import com.mojang.blaze3d.pipeline.RenderPipeline; +#endif import net.minecraft.client.renderer.RenderPipelines; #endif diff --git a/modern/templates/java/io/github/notenoughupdates/moulconfig/test/TestCategoryA.kt b/modern/templates/java/io/github/notenoughupdates/moulconfig/test/TestCategoryA.kt index 3941ae208..46dc90aa1 100644 --- a/modern/templates/java/io/github/notenoughupdates/moulconfig/test/TestCategoryA.kt +++ b/modern/templates/java/io/github/notenoughupdates/moulconfig/test/TestCategoryA.kt @@ -4,7 +4,7 @@ import com.google.gson.annotations.Expose import io.github.notenoughupdates.moulconfig.ChromaColour import io.github.notenoughupdates.moulconfig.annotations.* import io.github.notenoughupdates.moulconfig.observer.Property -import org.lwjgl.glfw.GLFW +import com.mojang.blaze3d.platform.InputConstants; import java.util.* class TestCategoryA { @@ -217,8 +217,8 @@ class TestCategoryA { @Expose @ConfigOption(name = "Keybind", desc = "The Number One") - @ConfigEditorKeybind(defaultKey = GLFW.GLFW_KEY_1) - var slot1: Int = GLFW.GLFW_KEY_1 + @ConfigEditorKeybind(defaultKey = InputConstants.KEY_1) + var slot1: Int = InputConstants.KEY_1 @Expose diff --git a/settings.gradle.kts b/settings.gradle.kts index 38d040f5e..2bcb33210 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,7 +38,8 @@ listOf( "1.21.10", "1.21.11", "26.1", - "26.2" + "26.2", + "26.3" ).forEach { version -> val modPath = "modern:$version" include(modPath)