Skip to content

Commit 8d2a8dc

Browse files
committed
work around RRLS incompatibility (somewhat)
1 parent 750f32c commit 8d2a8dc

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ modstitch {
3232
if (isPropDefined("deps.reesesSodiumOptions")) configs.register("controlify-compat.reeses-sodium-options")
3333
configs.register("controlify-compat.yacl")
3434
if (isPropDefined("deps.simpleVoiceChat")) configs.register("controlify-compat.simple-voice-chat")
35+
configs.register("controlify-compat.rrls")
3536
if (modstitch.isLoom) configs.register("controlify-platform.fabric")
3637
if (modstitch.isModDevGradleRegular) configs.register("controlify-platform.neoforge")
3738
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package dev.isxander.controlify.compatibility.rrls;
2+
3+
import dev.isxander.controlify.compatibility.CompatMixinPlugin;
4+
5+
public class RrlsMixinPlugin extends CompatMixinPlugin {
6+
@Override
7+
protected String getModId() {
8+
return "rrls";
9+
}
10+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package dev.isxander.controlify.compatibility.rrls.mixins;
2+
3+
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
4+
import dev.isxander.controlify.utils.CUtil;
5+
import org.spongepowered.asm.mixin.Dynamic;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.Pseudo;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
10+
@Pseudo
11+
@Mixin(targets = "org.redlance.dima_dencep.mods.rrls.config.HideType")
12+
public class HideTypeMixin {
13+
/**
14+
* RRLS calls onGameLoadFinished before resource loaders have finished.
15+
* This causes a crash because Controlify initialises on a hook into this method,
16+
* and expects DefaultConfigManager to have loaded default configs, causing the following crash:
17+
* <code>Attempted to fetch default config before DefaultConfigManager was ready!</code>
18+
* <p>
19+
* Developer was unwilling to add an official API for Controlify to use to accomplish this,
20+
* so this mixin prevents RRLS ever removing the loading screen from the initial load.
21+
*/
22+
@Dynamic
23+
@ModifyReturnValue(method = "canHide", at = @At("RETURN"), require = 0)
24+
private boolean preventInitialHide(boolean original, boolean reloading) {
25+
if (!reloading && original) {
26+
CUtil.LOGGER.error("Controlify has prevented Remove Reloading Screen (rrls) mod from removing the initial loading screen due to an incompatibility.");
27+
return false;
28+
}
29+
30+
return original;
31+
}
32+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"package": "dev.isxander.controlify.compatibility.rrls.mixins",
3+
"required": false,
4+
"minVersion": "0.8",
5+
"mixinextras": {
6+
"minVersion": "0.5.0"
7+
},
8+
"injectors": {
9+
"defaultRequire": 0
10+
},
11+
"plugin": "dev.isxander.controlify.compatibility.rrls.RrlsMixinPlugin",
12+
"compatibilityLevel": "JAVA_25",
13+
"client": [
14+
],
15+
"mixins": [
16+
"HideTypeMixin"
17+
]
18+
}

0 commit comments

Comments
 (0)