Skip to content

Commit 82a6f0d

Browse files
committed
ouuugggghhhh
- bump dgt to 2.57.0 - add 1.21.9 support (fabric and neoforge). some mixins are still broken - bump textile to 0.25.0 - bump omnicore to beta 17 - return typed screens from ui managers and oneconfig - don't open oneconfig ui by default, just hand it to the user - rewrite oneconfig command handler - add createScreen extension to Tree and Config - temporarily disasble mod menu compat on 1.21.9+
1 parent 31e5563 commit 82a6f0d

File tree

22 files changed

+280
-162
lines changed

22 files changed

+280
-162
lines changed

buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ private val fabricApiModuleVersions = mapOf(
4040
"api-base-12106" to "0.4.64+9ec45cd896", // 1.21.6
4141
"api-base-12107" to "0.4.64+9ec45cd86c", // 1.21.7
4242
"api-base-12108" to "0.4.64+9ec45cd8f3", // 1.21.8
43+
"api-base-12109" to "0.5.2+2fa446b294", // 1.21.9
4344
"lifecycle-events-v1-common" to "1.1.0+2c3f108c81e6", // Common (Legacy Fabric API)
4445
"lifecycle-events-v1-10809" to "1.1.0+1.8.9+2c3f108c81e6", // 1.8.9
4546
"lifecycle-events-v1-11202" to "1.1.0+1.12.2+2c3f108c81e6", // 1.12.2
@@ -59,6 +60,7 @@ private val fabricApiModuleVersions = mapOf(
5960
"lifecycle-events-v1-12106" to "2.6.3+db4dfd8596", // 1.21.6
6061
"lifecycle-events-v1-12107" to "2.6.3+db4dfd856c", // 1.21.7
6162
"lifecycle-events-v1-12108" to "2.6.3+db4dfd85f3", // 1.21.8
63+
"lifecycle-events-v1-12109" to "2.6.8+33df5e6e94", // 1.21.9
6264
"keybindings-api-v1-common" to "1.1.1+281301ea81e6", // Common (Legacy Fabric API)
6365
"keybindings-api-v1-10809" to "1.1.1+1.8.9+2c3f108c81e6", // 1.8.9
6466
"keybindings-api-v1-11202" to "1.1.1+1.12.2+2c3f108c81e6", // 1.12.2
@@ -78,6 +80,7 @@ private val fabricApiModuleVersions = mapOf(
7880
"key-binding-api-v1-12106" to "1.0.65+946bf4c396", // 1.21.6
7981
"key-binding-api-v1-12107" to "1.0.65+946bf4c36c", // 1.21.7
8082
"key-binding-api-v1-12108" to "1.0.65+946bf4c3f3", // 1.21.8
83+
"key-binding-api-v1-12109" to "1.1.0+4ec8267494", // 1.21.9
8184
"rendering-api-v1-common" to "1.0.0+7c545fdb81e6", // Common (Legacy Fabric API)
8285
"rendering-api-v1-10809" to "1.0.0+1.8.9+2c3f108c81e6", // 1.8.9
8386
"rendering-api-v1-11202" to "1.0.0+1.8.9+2c3f108c81e6", // 1.12.2
@@ -97,6 +100,7 @@ private val fabricApiModuleVersions = mapOf(
97100
"rendering-v1-12106" to "12.4.0+e8d43c7696", // 1.21.6
98101
"rendering-v1-12107" to "12.4.0+e8d43c766c", // 1.21.7
99102
"rendering-v1-12108" to "12.4.0+e8d43c76f3", // 1.21.8
103+
"rendering-v1-12109" to "15.0.2+9bce411b94", // 1.21.9
100104
"screen-api-v1-11605" to "1.0.1+3cc0f0907d", // 1.16.5
101105
"screen-api-v1-11701" to "1.0.5+cf39a74318", // 1.17.1
102106
"screen-api-v1-11802" to "1.0.11+d882b91560", // 1.18.2
@@ -113,6 +117,7 @@ private val fabricApiModuleVersions = mapOf(
113117
"screen-api-v1-12106" to "2.0.51+946bf4c396", // 1.21.6
114118
"screen-api-v1-12107" to "2.1.0+277ecf7d6c", // 1.21.7
115119
"screen-api-v1-12108" to "2.1.0+277ecf7df3", // 1.21.8
120+
"screen-api-v1-12109" to "3.0.2+86b3ae5794", // 1.21.9
116121
"command-api-v1-11605" to "1.1.3+3cc0f0907d", // 1.16.5
117122
"command-api-v1-11701" to "1.1.4+cf39a74318", // 1.17.1
118123
"command-api-v1-11802" to "1.1.10+d7c144a860", // 1.18.2
@@ -129,6 +134,7 @@ private val fabricApiModuleVersions = mapOf(
129134
"command-api-v2-12106" to "2.2.53+946bf4c396", // 1.21.6
130135
"command-api-v2-12107" to "2.2.53+946bf4c36c", // 1.21.7
131136
"command-api-v2-12108" to "2.2.53+946bf4c3f3", // 1.21.8
137+
"command-api-v2-12109" to "2.3.5+33df5e6e94", // 1.21.9
132138
"transitive-access-wideners-v1-11802" to "1.1.0+e747827960", // 1.18.2
133139
"transitive-access-wideners-v1-11902" to "1.3.3+08b73de490", // 1.19.2
134140
"transitive-access-wideners-v1-11904" to "3.3.0+1b5f819af4", // 1.19.4
@@ -142,7 +148,8 @@ private val fabricApiModuleVersions = mapOf(
142148
"transitive-access-wideners-v1-12105" to "6.3.17+f17a180c49", // 1.21.5
143149
"transitive-access-wideners-v1-12106" to "6.4.1+ac3e15d196", // 1.21.6
144150
"transitive-access-wideners-v1-12107" to "6.4.1+ac3e15d16c", // 1.21.7
145-
"transitive-access-wideners-v1-12108" to "6.4.1+ac3e15d1f3" // 1.21.8
151+
"transitive-access-wideners-v1-12108" to "6.4.1+ac3e15d1f3", // 1.21.8
152+
"transitive-access-wideners-v1-12109" to "6.5.2+5d9dbead94" // 1.21.9
146153
)
147154

148155
/**

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ copycat = "0.1.3"
2121
copycat-image-awt = "0.1.1"
2222

2323
# Per version
24-
textile = "0.25.0-beta.1"
25-
omnicore = "1.0.0-beta.14"
24+
textile = "0.25.0"
25+
omnicore = "1.0.0-beta.17"
2626
lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader
2727

2828
# Legacy only
@@ -34,7 +34,7 @@ brigadier = "1.0.18"
3434
oneconfig-loader = "1.1.0-alpha.48"
3535

3636
# Gradle
37-
dgt = "2.51.0"
37+
dgt = "2.57.0"
3838
kotlinx-abi = "0.18.1"
3939
licenser = "2.1.1"
4040
jetbrains-idea-ext = "1.3"

minecraft/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ dependencies {
203203
rconfig("1.21.6", "3.6.2"),
204204
rconfig("1.21.7", "3.7.2"),
205205
rconfig("1.21.8", "3.7.2", "1.21.7"),
206+
rconfig("1.21.9", "3.9.0")
206207
)
207208

208209
compileOnlyCompat(rconfig[mcVersionString])
@@ -243,6 +244,7 @@ dependencies {
243244
yacl("1.21.6", "3.7.1"),
244245
yacl("1.21.7", "3.7.1", "1.21.6"),
245246
yacl("1.21.8", "3.7.1", "1.21.6"),
247+
yacl("1.21.9", "3.8.0", "1.21.6")
246248
)
247249
compileOnlyCompat(yacl[mcVersionString])
248250

minecraft/root.gradle.kts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,29 @@ preprocess {
1414
strictExtraMappings.set(true)
1515
// FOR ALL NEW VERSIONS ENSURE TO UPDATE settings.gradle.kts !
1616

17-
"1.21.8-fabric"(1_21_08, "yarn") {
18-
"1.21.8-neoforge"(1_21_08, "srg") {
19-
"1.21.5-neoforge"(1_21_05, "srg") {
20-
"1.21.5-fabric"(1_21_05, "yarn") {
21-
"1.21.4-fabric"(1_21_04, "yarn") {
22-
"1.21.4-neoforge"(1_21_04, "srg") {
23-
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
24-
"1.21.1-fabric"(1_21_01, "yarn") {
25-
"1.20.4-fabric"(1_20_04, "yarn") {
26-
"1.20.4-neoforge"(1_20_04, "srg") {
27-
"1.20.4-forge"(1_20_04, "srg") {
28-
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
29-
"1.20.1-fabric"(1_20_01, "yarn") {
30-
"1.16.5-fabric"(1_16_05, "yarn", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
31-
"1.16.5-forge"(1_16_05, "srg") {
32-
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
33-
"1.12.2-fabric"(1_12_02, "yarn") {
34-
"1.8.9-fabric"(1_08_09, "yarn"){
35-
"1.8.9-forge"(1_08_09, "srg")
17+
"1.21.9-neoforge"(1_21_09, "srg") {
18+
"1.21.9-fabric"(1_21_09, "yarn") {
19+
"1.21.8-fabric"(1_21_08, "yarn") {
20+
"1.21.8-neoforge"(1_21_08, "srg") {
21+
"1.21.5-neoforge"(1_21_05, "srg") {
22+
"1.21.5-fabric"(1_21_05, "yarn") {
23+
"1.21.4-fabric"(1_21_04, "yarn") {
24+
"1.21.4-neoforge"(1_21_04, "srg") {
25+
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
26+
"1.21.1-fabric"(1_21_01, "yarn") {
27+
"1.20.4-fabric"(1_20_04, "yarn") {
28+
"1.20.4-neoforge"(1_20_04, "srg") {
29+
"1.20.4-forge"(1_20_04, "srg") {
30+
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
31+
"1.20.1-fabric"(1_20_01, "yarn") {
32+
"1.16.5-fabric"(1_16_05, "yarn", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
33+
"1.16.5-forge"(1_16_05, "srg") {
34+
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
35+
"1.12.2-fabric"(1_12_02, "yarn") {
36+
"1.8.9-fabric"(1_08_09, "yarn") {
37+
"1.8.9-forge"(1_08_09, "srg")
38+
}
39+
}
3640
}
3741
}
3842
}

minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import dev.deftu.omnicore.api.client.render.pipeline.OmniRenderPipeline;
4343
import dev.deftu.omnicore.api.client.render.pipeline.OmniRenderPipelines;
4444
import dev.deftu.omnicore.api.client.render.state.OmniBlendState;
45+
import dev.deftu.omnicore.api.client.screen.OmniScreen;
4546
import net.minecraft.client.Minecraft;
4647
import org.apache.logging.log4j.LogManager;
4748
import org.apache.logging.log4j.Logger;
@@ -144,7 +145,7 @@ public TinyFdApi getTinyFD() {
144145
}
145146

146147
@Override
147-
public Object createPolyUIScreen(@NotNull PolyUI polyUI, float designedWidth, float designedHeight, boolean pauses, boolean blurs, Consumer<PolyUI> onClose) {
148+
public OmniScreen createPolyUIScreen(@NotNull PolyUI polyUI, float designedWidth, float designedHeight, boolean pauses, boolean blurs, Consumer<PolyUI> onClose) {
148149
return new PolyUIScreen(polyUI, designedWidth, designedHeight, pauses, blurs, onClose);
149150
}
150151

minecraft/src/main/java/org/polyfrost/oneconfig/internal/OneConfig.java

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@
2727
package org.polyfrost.oneconfig.internal;
2828

2929
import com.mojang.brigadier.Command;
30-
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
31-
import com.mojang.brigadier.tree.CommandNode;
30+
import com.mojang.brigadier.tree.LiteralCommandNode;
3231
import dev.deftu.clipboard.Clipboard;
3332
import dev.deftu.omnicore.api.client.OmniClient;
3433
import dev.deftu.omnicore.api.client.chat.OmniClientChat;
34+
import dev.deftu.omnicore.api.client.commands.OmniClientCommandSource;
35+
import dev.deftu.omnicore.api.client.commands.OmniClientCommands;
3536
import dev.deftu.omnicore.api.client.screen.OmniScreens;
3637
import dev.deftu.omnicore.api.loader.ModInfo;
3738
import dev.deftu.omnicore.api.loader.OmniLoader;
3839
import dev.deftu.omnicore.internal.client.commands.ClientCommandInternals;
3940
import dev.deftu.textile.minecraft.MCSimpleTextHolder;
4041
import dev.deftu.textile.minecraft.MCTextFormat;
4142
import kotlin.Unit;
42-
import net.minecraft.client.gui.GuiChat;
4343
import org.apache.logging.log4j.LogManager;
4444
import org.apache.logging.log4j.Logger;
45-
import org.polyfrost.oneconfig.api.commands.v1.CommandManager;
4645
import org.polyfrost.oneconfig.api.config.v1.ConfigManager;
4746
import org.polyfrost.oneconfig.api.config.v1.internal.ConfigVisualizer;
4847
import org.polyfrost.oneconfig.api.event.v1.EventManager;
@@ -72,8 +71,6 @@
7271

7372
import java.util.concurrent.atomic.AtomicBoolean;
7473

75-
import static org.polyfrost.oneconfig.api.commands.v1.CommandManager.literal;
76-
7774
/**
7875
* The main class of OneConfig.
7976
*/
@@ -179,38 +176,33 @@ private static void registerCommands() {
179176
// //$$ }
180177
// //#endif
181178

182-
LiteralArgumentBuilder b = literal("oneconfig");
183-
b.executes(cmd -> {
184-
OneConfigUI.INSTANCE.open();
185-
return 1;
186-
});
187-
188-
b.then(literal("debug").executes(ctx -> {
189-
OneConfigUI.INSTANCE.open();
190-
OneConfigUI.INSTANCE.toggleDebug();
191-
return ctx.getSource().replyChat("OK");
192-
}));
193-
194-
b.then(literal("locraw").executes(ctx -> {
195-
return ctx.getSource().replyChat(HypixelUtils.getLocation().toString());
196-
}));
197-
198-
b.then(literal("hud").executes(ctx -> {
199-
Platform.screen().display(HudManager.INSTANCE.getWithEditor());
200-
return Command.SINGLE_SUCCESS;
201-
}));
202-
203-
b.then(literal("delete").executes(ctx -> {
204-
OneConfigUI.INSTANCE.invalidateCache();
205-
ConfigVisualizer.INSTANCE.clearCache();
206-
return ctx.getSource().replyChat("Deleted OneConfig UI. Please make a report if you were having issues!");
207-
}));
179+
Command<OmniClientCommandSource> executor = (ctx) -> ctx.getSource().openScreen(OneConfigUI.INSTANCE.create());
208180

209-
CommandNode node = b.build();
210-
CommandManager.register(b);
211-
CommandManager.register(literal("ocfg").redirect(node));
212-
CommandManager.register(literal("oneconfig").redirect(node));
213-
CommandManager.register(literal("oc").redirect(node));
181+
LiteralCommandNode<OmniClientCommandSource> node = OmniClientCommands.literal("oneconfig")
182+
.executes(executor)
183+
.then(OmniClientCommands.literal("delete")
184+
.executes((ctx) -> {
185+
OneConfigUI.INSTANCE.invalidateCache();
186+
ConfigVisualizer.INSTANCE.clearCache();
187+
return ctx.getSource().replyChat("Deleted OneConfig UI. Please make a report if you were having issues!");
188+
})
189+
)
190+
.then(OmniClientCommands.literal("hud")
191+
.executes((ctx) -> ctx.getSource().openScreen(HudManager.INSTANCE.getWithEditor()))
192+
)
193+
.then(OmniClientCommands.literal("locraw")
194+
.executes((ctx) -> ctx.getSource().replyChat(HypixelUtils.getLocation().toString()))
195+
)
196+
.then(OmniClientCommands.literal("debug")
197+
.executes((ctx) -> {
198+
OneConfigUI.INSTANCE.create();
199+
OneConfigUI.INSTANCE.toggleDebug();
200+
return ctx.getSource().replyChat("OK");
201+
})
202+
)
203+
.build();
204+
OmniClientCommands.register(node);
205+
OmniClientCommands.register(OmniClientCommands.literal("ocfg").executes(executor).redirect(node));
214206
}
215207

216208
private static void registerKeybinds() {
@@ -229,7 +221,7 @@ private static void registerKeybinds() {
229221
}
230222

231223
try {
232-
OneConfigUI.INSTANCE.open();
224+
Platform.screen().display(OneConfigUI.INSTANCE.create());
233225
} catch (Throwable t) {
234226
OmniClientChat.displayChatMessage(new MCSimpleTextHolder("Failed to open OneConfig UI: " + t.getMessage() + ". Please report this!").withFormatting(MCTextFormat.RED));
235227
// propagate for proper error handling
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,31 @@
11
package org.polyfrost.oneconfig.internal.mixin.events;
22

3-
//#if MC >= 1.16.5
4-
//$$ import org.spongepowered.asm.mixin.injection.ModifyVariable;
5-
//$$ import net.minecraft.client.KeyboardHandler;
6-
//#else
73
import net.minecraft.client.Minecraft;
8-
//#endif
9-
4+
import org.lwjgl.input.Keyboard;
105
import org.polyfrost.oneconfig.api.event.v1.EventManager;
116
import org.polyfrost.oneconfig.api.event.v1.events.KeyInputEvent;
127
import org.spongepowered.asm.mixin.Mixin;
138
import org.spongepowered.asm.mixin.injection.At;
149
import org.spongepowered.asm.mixin.injection.Inject;
1510
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1611

17-
//#if MC >= 1.16.5
18-
//$$ @Mixin(KeyboardHandler.class)
19-
//#else
2012
@Mixin(Minecraft.class)
21-
//#endif
2213
public class Mixin_KeyInputEvent {
23-
24-
//#if MC >= 1.16.5
25-
//$$ @ModifyVariable(method = "keyPress", at = @At(value = "STORE"), ordinal = 0)
26-
//$$ private boolean keyCallback(boolean original, long windowPointer, int key, int scanCode, int action, int modifiers) {
27-
//$$ EventManager.INSTANCE.post(new KeyInputEvent(key, (char) 0, action));
28-
//$$ return original;
29-
//$$ }
30-
//$$
31-
//$$ @ModifyVariable(method = "charTyped", at = @At(value = "STORE"), ordinal = 0)
32-
//$$ private boolean charCallback(boolean original, long windowPointer, char key, int code, int modifiers) {
33-
//$$ EventManager.INSTANCE.post(new KeyInputEvent(0, key, 1));
34-
//$$ return original;
35-
//$$ }
36-
//#else
37-
38-
//@formatter:off
3914
//#if MC <= 1.8.9
4015
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/settings/KeyBinding;setKeyBindState(IZ)V", ordinal = 1))
4116
//#else
4217
//$$ @Inject(method = "tickKeyboard", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;f3CTime:J", opcode = org.objectweb.asm.Opcodes.PUTFIELD))
4318
//#endif
44-
//@formatter:on
4519
private void keyCallback(CallbackInfo ci) {
4620
int state = 0;
47-
if (org.lwjgl.input.Keyboard.getEventKeyState()) {
48-
if (org.lwjgl.input.Keyboard.isRepeatEvent()) {
21+
if (Keyboard.getEventKeyState()) {
22+
if (Keyboard.isRepeatEvent()) {
4923
state = 2;
5024
} else {
5125
state = 1;
5226
}
5327
}
54-
EventManager.INSTANCE.post(new KeyInputEvent(org.lwjgl.input.Keyboard.getEventKey(), org.lwjgl.input.Keyboard.getEventCharacter(), state));
55-
}
56-
57-
//#endif
5828

29+
EventManager.INSTANCE.post(new KeyInputEvent(Keyboard.getEventKey(), Keyboard.getEventCharacter(), state));
30+
}
5931
}

0 commit comments

Comments
 (0)