From 78d84f7848a5ba57b3a9760ea29a1345520a15af Mon Sep 17 00:00:00 2001 From: Prototik Date: Fri, 29 May 2015 17:24:31 +0700 Subject: [PATCH] Support to disable fastcraft 1.22+ --- .../common/discovery/ModDiscoverer.java.patch | 32 +++++++++++++------ .../fml/relauncher/CoreModManager.java.patch | 19 ++++++++--- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/patches/cpw/mods/fml/common/discovery/ModDiscoverer.java.patch b/patches/cpw/mods/fml/common/discovery/ModDiscoverer.java.patch index 6a5c96b..166470a 100644 --- a/patches/cpw/mods/fml/common/discovery/ModDiscoverer.java.patch +++ b/patches/cpw/mods/fml/common/discovery/ModDiscoverer.java.patch @@ -1,18 +1,30 @@ --- ../src-base/minecraft/cpw/mods/fml/common/discovery/ModDiscoverer.java +++ ../src-work/minecraft/cpw/mods/fml/common/discovery/ModDiscoverer.java -@@ -147,6 +147,15 @@ - Throwables.propagate(t); +@@ -16,7 +16,9 @@ + import java.util.List; + import java.util.regex.Matcher; + import java.util.regex.Pattern; ++ + import org.apache.logging.log4j.Level; ++ + import com.google.common.base.Throwables; + import com.google.common.collect.ImmutableList; + import com.google.common.collect.Lists; +@@ -148,6 +150,17 @@ } } -+ -+ java.util.Iterator iterator = modList.iterator(); -+ while(iterator.hasNext()) { -+ ModContainer container = iterator.next(); -+ if ("FastCraft".equals(container.getModId())) { -+ FMLLog.log(Level.WARN, "Found FastCraft mod, removing it..."); -+ iterator.remove(); + ++ if (!"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) { ++ java.util.Iterator iterator = modList.iterator(); ++ while(iterator.hasNext()) { ++ ModContainer container = iterator.next(); ++ if ("FastCraft".equals(container.getModId())) { ++ FMLLog.log(Level.WARN, "Found FastCraft mod, removing it..."); ++ iterator.remove(); ++ } + } + } - ++ return modList; } + diff --git a/patches/cpw/mods/fml/relauncher/CoreModManager.java.patch b/patches/cpw/mods/fml/relauncher/CoreModManager.java.patch index b764319..f5e1e1f 100644 --- a/patches/cpw/mods/fml/relauncher/CoreModManager.java.patch +++ b/patches/cpw/mods/fml/relauncher/CoreModManager.java.patch @@ -70,18 +70,29 @@ } -@@ -322,6 +344,10 @@ +@@ -293,6 +315,10 @@ + String cascadedTweaker = mfAttributes.getValue("TweakClass"); + if (cascadedTweaker != null) + { ++ if ("fastcraft.Tweaker".equals(cascadedTweaker) && !"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) { ++ FMLRelaunchLog.info("Found FastCraft tweaker, skipping..."); ++ continue; ++ } + FMLRelaunchLog.info("Loading tweaker %s from %s", cascadedTweaker, coreMod.getName()); + Integer sortOrder = Ints.tryParse(Strings.nullToEmpty(mfAttributes.getValue("TweakOrder"))); + sortOrder = (sortOrder == null ? Integer.valueOf(0) : sortOrder); +@@ -322,6 +348,10 @@ FMLRelaunchLog.fine("Not found coremod data in %s", coreMod.getName()); continue; } -+ if ("fastcraft.LoadingPlugin".equals(fmlCorePlugin)) { -+ FMLRelaunchLog.warning("Found FastCraft coremod, ignoring..."); ++ if ("fastcraft.LoadingPlugin".equals(fmlCorePlugin) && !"false".equals(System.getProperty("kcauldron.fastcraft.disable", "true"))) { ++ FMLRelaunchLog.warning("Found FastCraft coremod, skipping..."); + continue; + } // Support things that are mod jars, but not FML mod jars try { -@@ -424,8 +450,11 @@ +@@ -424,8 +454,11 @@ MCVersion requiredMCVersion = coreModClazz.getAnnotation(IFMLLoadingPlugin.MCVersion.class); if (!Arrays.asList(rootPlugins).contains(coreModClass) && (requiredMCVersion == null || Strings.isNullOrEmpty(requiredMCVersion.value()))) {