Skip to content

Commit 10f1b9c

Browse files
authored
Fix magiclib-legacy-compat causing lag in cloth-config2 calls (MC 1.14) (#157)
Signed-off-by: Hendrix-Shen <[email protected]>
1 parent 0372913 commit 10f1b9c

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package top.hendrixshen.magiclib.mixin.compat.cloth.renderSystem;
2+
3+
import org.spongepowered.asm.mixin.Mixin;
4+
5+
import top.hendrixshen.magiclib.api.preprocess.DummyClass;
6+
7+
@Mixin(DummyClass.class)
8+
public class RenderHelperMixin {
9+
}

magiclib-legacy-compat/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@
3737
],
3838
"server": [
3939
"top.hendrixshen.magiclib.entrypoint.legacy.MagicLibFabric"
40-
],
41-
"modmenu": [
42-
"top.hendrixshen.magiclib.game.malilib.ModMenuImpl"
4340
]
4441
},
4542
"mixins": [
4643
"${mod_id}-carpet.mixins.json",
44+
"${mod_id}-cloth-config.mixins.json",
4745
"${mod_id}-malilib.mixins.json",
4846
"${mod_id}-minecraft-compat-api.mixins.json"
4947
],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"required": true,
3+
"package": "top.hendrixshen.magiclib.mixin.compat.cloth",
4+
"plugin": "top.hendrixshen.magiclib.impl.mixin.MagicMixinPlugin",
5+
"minVersion": "0.8",
6+
"compatibilityLevel": "JAVA_8",
7+
"injectors": {
8+
"defaultRequire": 1
9+
},
10+
"client": [
11+
"renderSystem.RenderHelperMixin"
12+
]
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package top.hendrixshen.magiclib.mixin.compat.cloth.renderSystem;
2+
3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
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+
import top.hendrixshen.magiclib.api.dependency.annotation.Dependencies;
11+
import top.hendrixshen.magiclib.api.dependency.annotation.Dependency;
12+
13+
@Dependencies(require = @Dependency(value = "cloth-config2"))
14+
@Pseudo
15+
@Mixin(targets = "me.shedaniel.math.compat.RenderHelper", remap = false)
16+
public class RenderHelperMixin {
17+
@Dynamic
18+
@WrapOperation(
19+
method = "<clinit>",
20+
at = @At(
21+
value = "INVOKE",
22+
target = "Ljava/lang/Class;forName(Ljava/lang/String;)Ljava/lang/Class;",
23+
ordinal = 0
24+
)
25+
)
26+
// We need to hide RenderSystem from cloth-api, which shouldn't be here.
27+
private static Class<?> patchReflection(String className, Operation<Class<?>> original) throws ClassNotFoundException {
28+
throw new ClassNotFoundException("com.mojang.blaze3d.systems.RenderSystem");
29+
}
30+
}

0 commit comments

Comments
 (0)