Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
11ba1b7
glide wheel scrolling in lists added by mods
Deftu Nov 13, 2026
debcaad
add opt-in marker for oneconfig's internal ui api
Deftu Nov 13, 2026
f2aaecc
add theme tokens, prefs and click primitive to the ui kit
Deftu Nov 13, 2026
b7c950b
add unified buttons, tabs and text fields to the ui kit
Deftu Nov 13, 2026
ac1e8a9
add typed destinations, text, icon, colour picker and player head apis
Deftu Nov 13, 2026
8a5077f
add switch, checkbox, slider, radio and keybind field controls
Deftu Nov 13, 2026
10120f4
add dialogs, tooltips, confirm, toasts and status messages
Deftu Nov 13, 2026
23b915f
add layout, selection, focus, image and progress components
Deftu Nov 13, 2026
2c002bd
add menu entries, dropdowns and keyboard navigation
Deftu Nov 13, 2026
8ec5b89
add context menu state, text field menu and menu contributors
Deftu Nov 13, 2026
e5ac6ed
add select, multi select, split button and more button
Deftu Nov 13, 2026
ce787c1
move kit components onto the new text and icon apis
Deftu Nov 13, 2026
95aaf68
add oneconfig compose screen, screen helpers and early init
Deftu Nov 13, 2026
8b94aa1
add compose hud layers and inline poly canvas
Deftu Nov 13, 2026
6760fd1
add offscreen rendering and entity preview
Deftu Nov 13, 2026
70a9d52
add smooth scrolling, themed surfaces and checkerboard to the kit
Deftu Nov 13, 2026
fa2bef6
fix entity preview warnings on 1.8.9 and 1.21.1
Deftu Nov 13, 2026
3cb7b0f
add typed config metadata keys and tree builders
Deftu Nov 13, 2026
b10b9bf
add self-updating config dependencies and share codes
Deftu Nov 13, 2026
d006369
add per-profile config migrations
Deftu Nov 13, 2026
6283d0e
show group toggles, header icons and full-width options in the config…
Deftu Nov 13, 2026
d30b3d9
add property state, page arguments and read-only mod toggles
Deftu Nov 13, 2026
e11bd9b
add shared hud styles, border, cloning and position tracking
Deftu Nov 13, 2026
56c869b
add styled text runs, hud icons and shape drawing helpers
Deftu Nov 13, 2026
3f94def
add hud registration checks, suppression, previews and click regions
Deftu Nov 13, 2026
e6ea8a4
add vanilla hud element hiding and replacement
Deftu Nov 13, 2026
48b89c1
let keybinds opt out of vanilla mirroring and sync with vanilla keys
Deftu Nov 13, 2026
31087ee
add notification handles, warnings and theme colours
Deftu Nov 13, 2026
e3feb8d
add attack, place, turn and block update events and fix the reload event
Deftu Nov 13, 2026
0ef82a7
add post helpers and translated formatters to utils
Deftu Nov 13, 2026
74ac185
route oneconfig clicks, tooltips and motion through the kit
Deftu Nov 13, 2026
60a1406
move the config screen, option menus and keybinds onto the kit
Deftu Nov 13, 2026
ea15e70
move settings controls and text fields onto the kit
Deftu Nov 13, 2026
a8757ef
move the mods page, header and sidebar onto the kit
Deftu Nov 13, 2026
366251c
move profiles, notifications and changelog onto the kit
Deftu Nov 13, 2026
8b37d47
move the themes page and theme editor onto the kit
Deftu Nov 13, 2026
0c604fc
move the hud editor onto the kit
Deftu Nov 13, 2026
cccf03f
fill the select field to its set width
Deftu Nov 13, 2026
9ab5a09
draw context menus with their trigger's theme and scale
Deftu Nov 13, 2026
cba8057
drop check marks from the about menu
Deftu Nov 13, 2026
659b1d9
keep icon button corners proportional on small sizes
Deftu Nov 13, 2026
d68c17d
show confirm dialogs on the open screen's host
Deftu Nov 13, 2026
5741445
delay the profile busy overlay
Deftu Nov 13, 2026
0416c01
fade dialog panels with the scrim
Deftu Nov 13, 2026
90d1582
recover from disposed popup layers without rebuilding the screen
Deftu Nov 13, 2026
dd4b340
restore the mod toggle ring shade
Deftu Nov 13, 2026
12d3c73
match the favorite star corner to the mod card
Deftu Nov 13, 2026
ef396b3
stop config migrations when their version cannot be saved
Deftu Nov 14, 2026
de312e4
run pending migrations before direct config reads
Deftu Nov 14, 2026
915ce7b
fix share code imports of maps, keybinds and object lists
Deftu Nov 14, 2026
68fb1f3
store numeric meta keys as floats and check meta key types
Deftu Nov 14, 2026
c9f412e
save raw values for string dropdowns set through setOptions
Deftu Nov 14, 2026
51e817e
update group children after a cancelled toggle
Deftu Nov 14, 2026
ba68575
restore source compat for legacy notification overloads
Deftu Nov 14, 2026
c45e48f
keep progress toasts alive when their supplier fails
Deftu Nov 14, 2026
6809466
pass route objects through the oneconfig ui open calls again
Deftu Nov 14, 2026
ac32d63
hold back keybinds while input is captured
Deftu Nov 14, 2026
e59a766
read the settled value in property state and flows
Deftu Nov 14, 2026
f758903
step number fields from the typed value
Deftu Nov 14, 2026
cebf3f4
scroll keyboard-highlighted menu items into view
Deftu Nov 14, 2026
5b1945d
select the old query when focusing header search
Deftu Nov 14, 2026
eefc0c7
fix hud suppression, unsupported hud loading and default padding
Deftu Nov 14, 2026
92753fc
split merged hud backgrounds when a border is enabled
Deftu Nov 14, 2026
be6db80
copy text hud runs before caching them
Deftu Nov 14, 2026
3179e67
only replace vanilla hud elements while vanilla would draw them
Deftu Nov 14, 2026
e0e1017
accept translatable page text for kit labels
Deftu Nov 14, 2026
45313a4
rewrite the ui module readme for mod authors
Deftu Nov 14, 2026
4e52177
bump version to 1.8.0
Deftu Nov 14, 2026
a33a2cb
fix config migrations, share codes and defaults
Deftu Nov 14, 2026
02c4783
fix hud suppression, cloning and click regions
Deftu Nov 14, 2026
bc18e5b
take notification alpha from the theme and keep legacy overloads
Deftu Nov 14, 2026
8680ae1
fill gaps in kit controls and keep 1.7.1 looks
Deftu Nov 14, 2026
05da490
move settings options onto kit controls
Deftu Nov 14, 2026
826526a
use kit buttons and motion in the hud editor
Deftu Nov 14, 2026
2e1ffa8
add crosshair and attack indicator hooks
Deftu Nov 14, 2026
103422f
use kit popups, motion and translations in the shell
Deftu Nov 14, 2026
73f8f91
make the sidebar info button a real button
Deftu Nov 14, 2026
f1954ff
keep profile names clear of the keybind field
Deftu Nov 14, 2026
d5cf5d0
add the 1.8.0 changelog
Deftu Nov 14, 2026
d4ee35f
fix detekt failures
Deftu Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ All notable changes to OneConfig are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.0] - 2026-11-14

### Added
- Mod cards and list entries can be moved with the keyboard: focus one and press Alt+Up or Alt+Down
- Multi-select options have a Select all row
- Deleting a profile now asks you to confirm first
- API: The UI kit has enough controls to build a whole mod screen, including select fields, split buttons, dialogs, toasts, grid reordering and progress bars
- API: `OneConfigComposeScreen`, HUD layers, inline canvases, offscreen rendering and entity previews for drawing with Compose in your own screens and HUDs
- API: Theme tokens for state colours, typography, spacing, shapes and surfaces, and read-only player preferences such as Reduced Motion
- API: Typed config metadata keys, a tree builder with group enable toggles, self-updating dependencies, share codes and per-profile config migrations
- API: Custom pages that take an argument, typed destinations for `OneConfigUI.open` and read-only mod toggles
- API: HUD styles, borders, cloning, click regions, styled text runs and icons
- API: HUDs can hide or replace vanilla HUD elements, including the crosshair and attack indicator
- API: Attack, place block, player turn and block update events
- API: Keybinds can stay out of Minecraft's controls screen
- API: Notification handles, a warning type and theme colours for notifications

### Changed
- Every OneConfig screen now uses the same controls, so buttons, menus, fields and tooltips look and behave the same everywhere
- Menus open from the control you clicked, follow the theme's shape and panels, and give keyboard focus back when they close
- Tooltips wait 300 ms before they show
- A disabled option now dims its label and control instead of greying out the whole card
- Number fields drop trailing zeros, so 0.50 shows as 0.5
- Scrolling glides in lists added by mods
- The HUD editor's selection box follows your theme's accent colour
- Reduced Motion now also applies to page slides, scrolling and the HUD editor
- API: The `Notifications` calls that take a float duration are deprecated in favour of `durationMillis`. Mods built against older versions keep working

### Fixed
- Fixed the keyboard focus ring never showing in the Minecraft themes
- Colours stored inside a config object now load their saved value instead of the default
- The resource reload event no longer fires a second time for server datapack reloads

## [1.7.1] - 2026-11-12

### Fixed
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/OneConfigSetupPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ class OneConfigSetupPlugin : Plugin<Project> {
tasks.withType<KotlinCompile>().configureEach {
// FixedScrollConfig relies on Compose internals, for which there is no public alternative
compilerOptions.freeCompilerArgs.add("-Xdont-warn-on-error-suppression")
compilerOptions.optIn.add("org.polyfrost.oneconfig.api.ui.v1.InternalOneConfigUiApi")
}

tasks.withType<Jar>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4096m

group=org.polyfrost.oneconfig
version=1.7.1
version=1.8.0
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static MinecraftKeybindBridgeImpl instance() {

@Override
public synchronized void register(OneConfigKeybind bind) {
if (bind.getName() == null) return;
if (bind.getName() == null || !bind.getMirrorToVanilla()) return;
KeyMapping existing = mappings.get(bind);
if (existing != null) {
applyKeyTo(existing, bind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public class OneConfig implements ClientModInitializer {
private static final Logger LOGGER = LogManager.getLogger("OneConfig");
private boolean initialized = false;

public static boolean isInitialized() {
return INSTANCE.initialized;
}

private static void registerCommands() {
Command<FabricClientCommandSource> executor = (c) -> {
OneConfigUIScreen.openLastSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public List<String> getMixins() {
mixins.add("events.Mixin_ModernWindowFocusEvent");

mixins.add("skia.Mixin_SkiaFrame");
mixins.add("render.Mixin_FramePresentHooks");
mixins.add("render.Mixin_EntityPreviewNameTag");
mixins.add("render.Mixin_HudFrameState");
mixins.add("render.Mixin_VanillaHudElements");
//? if >= 26.1 {
mixins.add("blaze3d.GpuDeviceAccessor");
mixins.add("blaze3d.GlDeviceAccessor");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
package org.polyfrost.oneconfig.internal.mixin;

import net.minecraft.server.packs.resources.ReloadInstance;
import net.minecraft.server.packs.resources.SimpleReloadInstance;
import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.ResourceFinishedLoading;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

//~ if = 1.8.9 'SimpleReloadInstance' -> 'SimpleReloadableResourceManager'
@Mixin(SimpleReloadInstance.class)
//? if > 1.8.9 {
import net.minecraft.server.packs.resources.ReloadableResourceManager;

@Mixin(ReloadableResourceManager.class)
public class Mixin_SimpleReloadInstance {

//~ if = 1.8.9 'create' -> 'startReload'
@Inject(method = "create", at = @At("RETURN"))
//~ if = 1.8.9 'ReloadInstance' -> 'ResourceReload'
private static void oneconfig$onResourceFinishedLoading(CallbackInfoReturnable<ReloadInstance> cir) {
//~ if = 1.8.9 'done()' -> 'result()'
@Inject(method = "createReload", at = @At("RETURN"))
private void oneconfig$onResourceFinishedLoading(CallbackInfoReturnable<ReloadInstance> cir) {
cir.getReturnValue().done().whenComplete((result, throwable) -> {
if (throwable != null) return;
EventManager.INSTANCE.post(ResourceFinishedLoading.INSTANCE);
});
}

}
//?} else {
/*import net.minecraft.server.packs.resources.SimpleReloadInstance;

@Mixin(SimpleReloadableResourceManager.class)
public class Mixin_SimpleReloadInstance {

@Inject(
method = "startReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/ornithemc/osl/resource/loader/api/resource/reload/ResourceReload;",
at = @At("RETURN")
)
private void oneconfig$onResourceFinishedLoading(CallbackInfoReturnable<ResourceReload> cir) {
if ((Object) this != SimpleReloadableResourceManager.client()) return;
cir.getReturnValue().result().whenComplete((result, throwable) -> {
if (throwable != null) return;
EventManager.INSTANCE.post(ResourceFinishedLoading.INSTANCE);
});
}

}
*///?}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.polyfrost.oneconfig.internal.mixin.events;

import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.AttackEntityEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//? if > 1.8.9 {
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
//?} else {
/*import net.minecraft.client.ClientPlayerInteractionManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.living.player.PlayerEntity;
*///?}

//? if > 1.8.9 {
@Mixin(MultiPlayerGameMode.class)
public class Mixin_AttackEntityEvent {
@Inject(method = "attack", at = @At("HEAD"), cancellable = true)
private void ocfg$onAttack(Player player, Entity target, CallbackInfo ci) {
AttackEntityEvent event = new AttackEntityEvent(player, target);
EventManager.INSTANCE.post(event);
if (event.cancelled) {
ci.cancel();
}
}
}
//?} else {
/*@Mixin(ClientPlayerInteractionManager.class)
public class Mixin_AttackEntityEvent {
@Inject(method = "attackEntity", at = @At("HEAD"), cancellable = true)
private void ocfg$onAttack(PlayerEntity player, Entity target, CallbackInfo ci) {
AttackEntityEvent event = new AttackEntityEvent(player, target);
EventManager.INSTANCE.post(event);
if (event.cancelled) {
ci.cancel();
}
}
}
*///?}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.polyfrost.oneconfig.internal.mixin.events;

import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.BlockUpdateEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//? if > 1.8.9 {
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
import net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket;

@Mixin(ClientPacketListener.class)
public class Mixin_BlockUpdateEvent {
@Inject(method = "handleBlockUpdate", at = @At("TAIL"))
private void ocfg$onBlockUpdate(ClientboundBlockUpdatePacket packet, CallbackInfo ci) {
if (!EventManager.INSTANCE.hasListeners(BlockUpdateEvent.class)) return;
EventManager.INSTANCE.post(new BlockUpdateEvent(packet.getPos(), packet.getBlockState()));
}

@Inject(method = "handleChunkBlocksUpdate", at = @At("TAIL"))
private void ocfg$onSectionBlocksUpdate(ClientboundSectionBlocksUpdatePacket packet, CallbackInfo ci) {
if (!EventManager.INSTANCE.hasListeners(BlockUpdateEvent.class)) return;
packet.runUpdates((pos, state) -> EventManager.INSTANCE.post(new BlockUpdateEvent(pos.immutable(), state)));
}
}
//?} else {
/*import net.minecraft.client.network.handler.ClientPlayNetworkHandler;
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.BlocksUpdateS2CPacket;

@Mixin(ClientPlayNetworkHandler.class)
public class Mixin_BlockUpdateEvent {
@Inject(method = "handleBlockUpdate", at = @At("TAIL"))
private void ocfg$onBlockUpdate(BlockUpdateS2CPacket packet, CallbackInfo ci) {
if (!EventManager.INSTANCE.hasListeners(BlockUpdateEvent.class)) return;
EventManager.INSTANCE.post(new BlockUpdateEvent(packet.getPos(), packet.getBlockState()));
}

@Inject(method = "handleBlocksUpdate", at = @At("TAIL"))
private void ocfg$onSectionBlocksUpdate(BlocksUpdateS2CPacket packet, CallbackInfo ci) {
if (!EventManager.INSTANCE.hasListeners(BlockUpdateEvent.class)) return;
for (BlocksUpdateS2CPacket.BlockUpdate update : packet.getUpdates()) {
EventManager.INSTANCE.post(new BlockUpdateEvent(update.getBlockPos(), update.getBlockState()));
}
}
}
*///?}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.KeyInputEvent;
import org.polyfrost.oneconfig.api.platform.v1.Platform;
import org.polyfrost.oneconfig.api.ui.v1.platform.ComposeHudInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -22,6 +23,7 @@

//? if = 1.8.9 {
/*import org.lwjgl.input.Keyboard;
import org.polyfrost.oneconfig.internal.legacy.KeyCodes;
import org.polyfrost.oneconfig.internal.legacy.LegacyInputEvents;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
*///?}
Expand All @@ -31,6 +33,13 @@
public class Mixin_KeyInputEvent {

//? if >= 1.21.10 {
@Inject(method = "keyPress", at = @At("HEAD"), cancellable = true)
private void oneconfig$hudEscape(long handle, int action, KeyEvent event, CallbackInfo ci) {
if (handle == Platform.compatibility().windowHandle() && ComposeHudInput.consumeKey(event.key(), oneconfig$state(action))) {
ci.cancel();
}
}

@ModifyVariable(method = "keyPress", at = @At(value = "STORE"), ordinal = 0)
private boolean keyCallback(boolean original, long handle, int action, KeyEvent event) {
EventManager.INSTANCE.post(new KeyInputEvent(event.key(), (char) 0, oneconfig$state(action)));
Expand All @@ -46,8 +55,12 @@ private void charCallback(long handle, CharacterEvent event, CallbackInfo ci) {
EventManager.INSTANCE.post(new KeyInputEvent(0, (char) event.codepoint(), KeyInputEvent.PRESSED));
}
//?} elif > 1.8.9 {
/*@Inject(method = "keyPress", at = @At("HEAD"))
/*@Inject(method = "keyPress", at = @At("HEAD"), cancellable = true)
private void keyCallback(long window, int key, int scancode, int action, int mods, CallbackInfo ci) {
if (window == Platform.compatibility().windowHandle() && ComposeHudInput.consumeKey(key, oneconfig$state(action))) {
ci.cancel();
return;
}
EventManager.INSTANCE.post(new KeyInputEvent(key, (char) 0, oneconfig$state(action)));
}

Expand All @@ -59,9 +72,22 @@ private void charCallback(long window, int codepoint, int mods, CallbackInfo ci)
EventManager.INSTANCE.post(new KeyInputEvent(0, (char) codepoint, KeyInputEvent.PRESSED));
}
*///?} else {
/*@Inject(method = "next", at = @At("RETURN"), remap = false)
/*@Inject(method = "next", at = @At("RETURN"), remap = false, cancellable = true)
private static void keyCallback(CallbackInfoReturnable<Boolean> cir) {
if (cir.getReturnValue() && !LegacyInputEvents.deferred) LegacyInputEvents.postKeyboard();
if (!cir.getReturnValue() || LegacyInputEvents.deferred) return;
if (oneconfig$hudConsumesLegacy()) {
cir.setReturnValue(Keyboard.next());
return;
}
LegacyInputEvents.postKeyboard();
}

@Unique
private static boolean oneconfig$hudConsumesLegacy() {
int keyCode = Keyboard.getEventKey();
if (keyCode <= 0) return false;
int state = Keyboard.isRepeatEvent() ? KeyInputEvent.REPEAT : Keyboard.getEventKeyState() ? KeyInputEvent.PRESSED : KeyInputEvent.RELEASED;
return ComposeHudInput.consumeKey(KeyCodes.fromLegacy(keyCode).getValue(), state);
}
*///?}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.MouseInputEvent;
import org.polyfrost.oneconfig.api.notifications.v1.NotificationsRenderer;
import org.polyfrost.oneconfig.api.ui.v1.platform.ComposeHudInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -22,6 +23,7 @@

//? if = 1.8.9 {
/*import org.lwjgl.input.Mouse;
import org.polyfrost.oneconfig.internal.legacy.KeyCodes;
import org.polyfrost.oneconfig.internal.legacy.LegacyInputEvents;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
*///?}
Expand All @@ -34,7 +36,7 @@ public class Mixin_MouseInputEvent {
//? if >= 1.21.10 {
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
private void mouseCallback(long window, MouseButtonInfo buttonInfo, int action, CallbackInfo ci) {
if (oneconfig$toastConsumes(buttonInfo.button(), action)) {
if (oneconfig$toastConsumes(buttonInfo.button(), action) || oneconfig$hudConsumes(buttonInfo.button(), action)) {
ci.cancel();
return;
}
Expand All @@ -56,7 +58,7 @@ private void mouseMoveCallback(long handle, double x, double y, double xrel, dou
//?} elif > 1.8.9 {
/*@Inject(method = "onPress", at = @At("HEAD"), cancellable = true)
private void mouseCallback(long handle, int button, int action, int mods, CallbackInfo ci) {
if (oneconfig$toastConsumes(button, action)) {
if (oneconfig$toastConsumes(button, action) || oneconfig$hudConsumes(button, action)) {
ci.cancel();
return;
}
Expand All @@ -72,14 +74,27 @@ private void mouseMoveCallback(long handle, double x, double y, CallbackInfo ci)
*///?} else {
/*@Inject(method = "next", at = @At("RETURN"), remap = false, cancellable = true)
private static void mouseCallback(CallbackInfoReturnable<Boolean> cir) {
if (cir.getReturnValue() && !LegacyInputEvents.deferred && LegacyInputEvents.postMouse()) cir.setReturnValue(Mouse.next());
if (cir.getReturnValue() && !LegacyInputEvents.deferred && (oneconfig$hudConsumesLegacy() || LegacyInputEvents.postMouse())) cir.setReturnValue(Mouse.next());
}

@Unique
private static boolean oneconfig$hudConsumesLegacy() {
int button = Mouse.getEventButton();
if (button >= 0) {
boolean pressed = Mouse.getEventButtonState();
if (pressed && NotificationsRenderer.isPointerOverToast()) return false;
return ComposeHudInput.consumeButton(KeyCodes.mouseFromLegacy(button), pressed);
}
double wheel = Mouse.getEventDWheelPrecise();
if (wheel == 0.0 || NotificationsRenderer.isPointerOverToast()) return false;
return ComposeHudInput.consumeScroll(0.0, wheel);
}
*///? }

//? if > 1.8.9 {
@Inject(method = "onScroll", at = @At("HEAD"), cancellable = true)
private void oneconfig$captureRawScroll(long window, double x, double y, CallbackInfo ci) {
if (NotificationsRenderer.isPointerOverToast()) {
if (NotificationsRenderer.isPointerOverToast() || ComposeHudInput.consumeScroll(x, y)) {
ci.cancel();
return;
}
Expand All @@ -94,6 +109,12 @@ private static void mouseCallback(CallbackInfoReturnable<Boolean> cir) {
return NotificationsRenderer.consumeMouseButton(button, action == InputConstants.PRESS);
}

@Unique
private static boolean oneconfig$hudConsumes(int button, int action) {
if (action != InputConstants.PRESS && action != InputConstants.RELEASE) return false;
return ComposeHudInput.consumeButton(button, action == InputConstants.PRESS);
}

@Unique
private static int oneconfig$state(int action) {
if (action == InputConstants.PRESS) return MouseInputEvent.PRESSED;
Expand Down
Loading