Skip to content

Commit d32c36b

Browse files
committed
randompatches begone
1 parent 4911d77 commit d32c36b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ curseForgeProjectId = 624243
149149
curseForgeRelations = req:mixin-booter;\
150150
opt:inventory-bogosorter;\
151151
opt:jei;\
152-
opt:blur
152+
opt:blur;\
153+
fail:randompatches
153154

154155
# This project's release type on CurseForge and/or Modrinth
155156
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.

src/main/java/com/cleanroommc/modularui/ModularUI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@Mod(modid = ModularUI.ID,
1515
name = ModularUI.NAME,
1616
version = ModularUI.VERSION,
17+
acceptedMinecraftVersions = "[1.12,)",
1718
dependencies = "required-after:mixinbooter@[8.0,);" +
1819
"after:bogorter@[1.4.0,);")
1920
public class ModularUI {

src/main/java/com/cleanroommc/modularui/core/ModularUICore.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public String getSetupClass() {
4040

4141
@Override
4242
public void injectData(Map<String, Object> data) {
43+
// this checks needs to happen this early
44+
// randompatches would otherwise crash shortly after this
45+
if (classExists("com.therandomlabs.randompatches.core.RPCore")) {
46+
throw new IllegalStateException("ModularUI is incompatible with RandomPatches. Please remove RandomPatches or replace it with UniversalTweaks as most features are replaced by it.");
47+
}
4348
for (IClassTransformer transformer : Launch.classLoader.getTransformers()) {
4449
String name = transformer.getClass().getName();
4550
if (name.endsWith("appeng.core.transformer.AE2ELTransformer")) {
@@ -59,4 +64,13 @@ public String getAccessTransformerClass() {
5964
public List<String> getMixinConfigs() {
6065
return Collections.singletonList("mixin.modularui.json");
6166
}
67+
68+
private static boolean classExists(String className) {
69+
try {
70+
Class.forName(className, false, Launch.classLoader);
71+
return true;
72+
} catch (ClassNotFoundException e) {
73+
return false;
74+
}
75+
}
6276
}

0 commit comments

Comments
 (0)