mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
Fix #556 Crash when disabling PluginFactory
This commit is contained in:
1 parent
c780ec6aaf
commit
d59072b771
4 files changed
+198
-10
No files matched your search
@@ -44,13 +44,16 @@ public abstract class ForestryPlugin {
|
||||
protected void preInit() {
|
||||
}
|
||||
|
||||
protected void disabledPreInit() {
|
||||
}
|
||||
|
||||
protected void doInit() {
|
||||
}
|
||||
|
||||
protected void postInit() {
|
||||
}
|
||||
|
||||
protected void disabledInit() {
|
||||
protected void disabledPostInit() {
|
||||
}
|
||||
|
||||
public boolean processIMCMessage(IMCMessage message) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import forestry.core.items.ItemNBTTile;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.RecipeUtil;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.DummyManagers;
|
||||
import forestry.factory.GuiHandlerFactory;
|
||||
import forestry.factory.gadgets.MachineBottler;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
@@ -66,6 +67,21 @@ public class PluginFactory extends ForestryPlugin {
|
||||
public static MachineDefinition definitionRaintank;
|
||||
public static MachineDefinition definitionWorktable;
|
||||
|
||||
@Override
|
||||
protected void disabledPreInit() {
|
||||
super.disabledPreInit();
|
||||
|
||||
RecipeManagers.craftingProviders = Arrays.asList(
|
||||
RecipeManagers.carpenterManager = new DummyManagers.CarpenterManager(),
|
||||
RecipeManagers.centrifugeManager = new DummyManagers.CentrifugeManager(),
|
||||
RecipeManagers.fabricatorManager = new DummyManagers.FabricatorManager(),
|
||||
RecipeManagers.fermenterManager = new DummyManagers.FermenterManager(),
|
||||
RecipeManagers.moistenerManager = new DummyManagers.MoistenerManager(),
|
||||
RecipeManagers.squeezerManager = new DummyManagers.SqueezerManager(),
|
||||
RecipeManagers.stillManager = new DummyManagers.StillManager()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PluginManager {
|
||||
|
||||
public enum Stage {
|
||||
|
||||
SETUP, PRE_INIT, INIT, POST_INIT, INIT_DISABLED, FINISHED
|
||||
SETUP, PRE_INIT, PRE_INIT_DISABLED, INIT, POST_INIT, POST_INIT_DISABLED, FINISHED
|
||||
}
|
||||
|
||||
public enum Module {
|
||||
@@ -137,10 +137,6 @@ public class PluginManager {
|
||||
return loadedModules.contains(module);
|
||||
}
|
||||
|
||||
public static void addPlugin(ForestryPlugin plugin) {
|
||||
|
||||
}
|
||||
|
||||
public static void runPreInit() {
|
||||
stage = Stage.SETUP;
|
||||
Locale locale = Locale.getDefault();
|
||||
@@ -209,6 +205,14 @@ public class PluginManager {
|
||||
plugin.registerItems();
|
||||
Proxies.log.fine("Pre-Init Complete: {0}", plugin);
|
||||
}
|
||||
|
||||
stage = Stage.PRE_INIT_DISABLED;
|
||||
for (Module m : unloadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
Proxies.log.fine("Disabled-Pre-Init Start: {0}", plugin);
|
||||
plugin.disabledPreInit();
|
||||
Proxies.log.fine("Disabled-Pre-Init Complete: {0}", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadPlugin(ForestryPlugin plugin) {
|
||||
@@ -276,12 +280,12 @@ public class PluginManager {
|
||||
Proxies.log.fine("Post-Init Complete: {0}", plugin);
|
||||
}
|
||||
|
||||
stage = Stage.INIT_DISABLED;
|
||||
stage = Stage.POST_INIT_DISABLED;
|
||||
for (Module m : unloadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
Proxies.log.fine("Disabled-Init Start: {0}", plugin);
|
||||
plugin.disabledInit();
|
||||
Proxies.log.fine("Disabled-Init Complete: {0}", plugin);
|
||||
Proxies.log.fine("Disabled-Post-Init Start: {0}", plugin);
|
||||
plugin.disabledPostInit();
|
||||
Proxies.log.fine("Disabled-Post-Init Complete: {0}", plugin);
|
||||
}
|
||||
stage = Stage.FINISHED;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user