cleanup code

This commit is contained in:
FalsePattern committed 2023-07-16 13:21:51 +02:00
1 parent 6868e1f718
commit dfba569048
51 files changed
+637 -373

No files matched your search

@@ -43,8 +43,9 @@ public interface IMixin {
default boolean shouldLoad(List<ITargetedMod> loadedMods) {
val side = getSide();
return (side == Side.COMMON || side == Side.SERVER && FMLLaunchHandler.side().isServer() ||
side == Side.CLIENT && FMLLaunchHandler.side().isClient()) && getFilter().test(loadedMods);
return (side == Side.COMMON
|| side == Side.SERVER && FMLLaunchHandler.side().isServer()
|| side == Side.CLIENT && FMLLaunchHandler.side().isClient()) && getFilter().test(loadedMods);
}
@StableAPI(since = "0.10.0")
@@ -58,10 +58,7 @@ public interface IMixinPlugin extends IMixinConfigPlugin {
static File findJarOf(final ITargetedMod mod) {
File result = null;
try (val stream = walk(MODS_DIRECTORY_PATH)) {
result = stream.filter(mod::isMatchingJar)
.map(Path::toFile)
.findFirst()
.orElse(null);
result = stream.filter(mod::isMatchingJar).map(Path::toFile).findFirst().orElse(null);
} catch (Exception e) {
e.printStackTrace();
}
@@ -75,7 +72,8 @@ public interface IMixinPlugin extends IMixinConfigPlugin {
found = path.toFile();
break;
}
} catch (Exception ignored) {}
} catch (Exception ignored) {
}
}
result = found;
}
@@ -105,21 +105,27 @@ public final class MixinInfo {
}
private static MixinBootstrapperType detect() {
if (!isClassPresentSafe("org.spongepowered.asm.launch.MixinBootstrap"))
if (!isClassPresentSafe("org.spongepowered.asm.launch.MixinBootstrap")) {
return MixinBootstrapperType.None;
for (val candidate: MixinInfoCompatCompanion.UNIMIXIN_CANDIDATES) {
}
for (val candidate : MixinInfoCompatCompanion.UNIMIXIN_CANDIDATES) {
if (isClassPresentSafe(candidate)) {
return MixinBootstrapperType.UniMixin;
}
}
if (isClassPresentSafe("com.falsepattern.gasstation.GasStation"))
if (isClassPresentSafe("com.falsepattern.gasstation.GasStation")) {
return MixinBootstrapperType.GasStation;
if (isClassPresentSafe("ru.timeconqueror.spongemixins.core.SpongeMixinsCore"))
}
if (isClassPresentSafe("ru.timeconqueror.spongemixins.core.SpongeMixinsCore")) {
return MixinBootstrapperType.SpongeMixins;
if (isClassPresentSafe("io.github.crucible.grimoire.Grimoire") || isClassPresentSafe("io.github.crucible.grimoire.common.GrimoireCore"))
}
if (isClassPresentSafe("io.github.crucible.grimoire.Grimoire") || isClassPresentSafe(
"io.github.crucible.grimoire.common.GrimoireCore")) {
return MixinBootstrapperType.Grimoire;
if (isClassPresentSafe("io.github.tox1cozz.mixinbooterlegacy.MixinBooterLegacyPlugin"))
}
if (isClassPresentSafe("io.github.tox1cozz.mixinbooterlegacy.MixinBooterLegacyPlugin")) {
return MixinBootstrapperType.MixinBooterLegacy;
}
return MixinBootstrapperType.Other;
}
@@ -39,10 +39,11 @@ public class MixinInfoCompatCompanion {
* This is used to determine if a mixin plugin is unimixins. Once MixinInfo is classloaded, this list has no effect.
*/
@StableAPI.Expose
public static final List<String> UNIMIXIN_CANDIDATES = new ArrayList<>(Arrays.asList("io.github.legacymoddingmc.unimixins.compat.CompatCore",
"io.github.legacymoddingmc.unimixins.devcompat.DevCompatCore",
"io.github.legacymoddingmc.unimixins.all.AllCore",
"io.github.legacymoddingmc.unimixins.mixin.MixinModule"));
public static final List<String> UNIMIXIN_CANDIDATES = new ArrayList<>(Arrays.asList(
"io.github.legacymoddingmc.unimixins.compat.CompatCore",
"io.github.legacymoddingmc.unimixins.devcompat.DevCompatCore",
"io.github.legacymoddingmc.unimixins.all.AllCore",
"io.github.legacymoddingmc.unimixins.mixin.MixinModule"));
@Getter(onMethod_ = @StableAPI.Expose)
static boolean mixinInfoClassLoaded = false;