Refactor GUI handling code

This commit is contained in:
mezz committed 2015-11-19 20:37:33 -08:00
1 parent 31231db459
commit 408a66bb40
97 files changed
+1053 -1729

No files matched your search

@@ -20,7 +20,6 @@ import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import forestry.core.GuiHandlerBase;
import forestry.core.IPickupHandler;
import forestry.core.IResupplyHandler;
import forestry.core.ISaveEventHandler;
@@ -96,10 +95,6 @@ public abstract class ForestryPlugin {
Log.warning(invalidIMCMessageText);
}
public GuiHandlerBase getGuiHandler() {
return null;
}
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@@ -63,7 +63,6 @@ import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.apiculture.ArmorApiaristHelper;
import forestry.apiculture.GuiHandlerApiculture;
import forestry.apiculture.SaveEventHandlerApiculture;
import forestry.apiculture.VillageHandlerApiculture;
import forestry.apiculture.blocks.BlockAlveary;
@@ -104,7 +103,6 @@ import forestry.apiculture.worldgen.HiveDecorator;
import forestry.apiculture.worldgen.HiveDescription;
import forestry.apiculture.worldgen.HiveGenHelper;
import forestry.apiculture.worldgen.HiveRegistry;
import forestry.core.GuiHandlerBase;
import forestry.core.ISaveEventHandler;
import forestry.core.blocks.BlockCoreType;
import forestry.core.config.Config;
@@ -385,11 +383,6 @@ public class PluginApiculture extends ForestryPlugin {
}
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerApiculture();
}
@Override
public IPacketRegistry getPacketRegistry() {
return new PacketRegistryApiculture();
@@ -38,7 +38,6 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.arboriculture.GuiHandlerArboriculture;
import forestry.arboriculture.VillageHandlerArboriculture;
import forestry.arboriculture.WoodItemAccess;
import forestry.arboriculture.blocks.BlockArboricultureType;
@@ -61,7 +60,6 @@ import forestry.arboriculture.tiles.TileFruitPod;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.arboriculture.tiles.TileSapling;
import forestry.arboriculture.tiles.TileWood;
import forestry.core.GuiHandlerBase;
import forestry.core.blocks.BlockCoreType;
import forestry.core.config.Config;
import forestry.core.config.Constants;
@@ -361,11 +359,6 @@ public class PluginArboriculture extends ForestryPlugin {
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 5), TreeDefinition.DarkOak.getIndividual());
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerArboriculture();
}
@Override
public IFuelHandler getFuelHandler() {
return new FuelHandler();
@@ -18,7 +18,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import cpw.mods.fml.common.IFuelHandler;
@@ -28,7 +27,6 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.multiblock.MultiblockManager;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.core.GuiHandlerBase;
import forestry.core.IPickupHandler;
import forestry.core.ISaveEventHandler;
import forestry.core.PickupHandlerCore;
@@ -56,7 +54,6 @@ import forestry.core.network.IPacketRegistry;
import forestry.core.network.PacketRegistryCore;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.tiles.MachineDefinition;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.ForestryModEnvWarningCallable;
@@ -123,11 +120,6 @@ public class PluginCore extends ForestryPlugin {
return true;
}
@Override
public GuiHandlerBase getGuiHandler() {
return null;
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return new SaveEventHandlerCore();
@@ -16,10 +16,8 @@ import net.minecraft.init.Items;
import cpw.mods.fml.common.SidedProxy;
import forestry.api.core.ForestryAPI;
import forestry.core.GuiHandlerBase;
import forestry.core.config.Constants;
import forestry.core.recipes.RecipeUtil;
import forestry.energy.GuiHandlerEnergy;
import forestry.energy.blocks.BlockEngineType;
import forestry.energy.blocks.BlockRegistryEnergy;
import forestry.energy.proxy.ProxyEnergy;
@@ -89,9 +87,4 @@ public class PluginEnergy extends ForestryPlugin {
'V', Blocks.piston);
}
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerEnergy();
}
}
@@ -32,7 +32,6 @@ import forestry.api.fuels.RainSubstrate;
import forestry.api.recipes.ICraftingProvider;
import forestry.api.recipes.RecipeManagers;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.GuiHandlerBase;
import forestry.core.blocks.BlockCoreType;
import forestry.core.blocks.BlockSoil;
import forestry.core.circuits.Circuit;
@@ -53,7 +52,6 @@ import forestry.core.utils.ModUtil;
import forestry.core.utils.datastructures.FluidMap;
import forestry.core.utils.datastructures.ItemStackMap;
import forestry.factory.DummyManagers;
import forestry.factory.GuiHandlerFactory;
import forestry.factory.blocks.BlockFactoryPlainType;
import forestry.factory.blocks.BlockFactoryTesrType;
import forestry.factory.blocks.BlockRegistryFactory;
@@ -538,10 +536,4 @@ public class PluginFactory extends ForestryPlugin {
'W', "craftingTableWood",
'C', "chestWood");
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerFactory();
}
}
@@ -33,15 +33,12 @@ import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.farming.Farmables;
import forestry.api.farming.IFarmable;
import forestry.core.GuiHandlerBase;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.CircuitLayout;
import forestry.core.config.Constants;
import forestry.core.items.EnumElectronTube;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.utils.Log;
import forestry.farming.GuiHandlerFarming;
import forestry.farming.blocks.BlockFarmType;
import forestry.farming.blocks.BlockRegistryFarming;
import forestry.farming.circuits.CircuitFarmLogic;
@@ -270,11 +267,6 @@ public class PluginFarming extends ForestryPlugin {
return false;
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerFarming();
}
@Override
protected void registerRecipes() {
@@ -16,13 +16,11 @@ import net.minecraft.item.ItemStack;
import forestry.api.food.BeverageManager;
import forestry.apiculture.items.EnumPollenCluster;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.GuiHandlerBase;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.fluids.LiquidRegistryHelper;
import forestry.core.recipes.RecipeUtil;
import forestry.food.BeverageEffect;
import forestry.food.GuiHandlerFood;
import forestry.food.InfuserIngredientManager;
import forestry.food.InfuserMixtureManager;
import forestry.food.items.EnumBeverage;
@@ -73,9 +71,4 @@ public class PluginFood extends ForestryPlugin {
'#', "ingotIron",
'X', "ingotBronze");
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerFood();
}
}
@@ -26,7 +26,6 @@ import forestry.api.arboriculture.TreeManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.recipes.RecipeManagers;
import forestry.core.GuiHandlerBase;
import forestry.core.config.Constants;
import forestry.core.config.LocalizedConfiguration;
import forestry.core.fluids.Fluids;
@@ -34,7 +33,6 @@ import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.MachineDefinition;
import forestry.core.utils.EntityUtil;
import forestry.lepidopterology.ButterflySpawner;
import forestry.lepidopterology.GuiHandlerLepidopterology;
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
import forestry.lepidopterology.commands.CommandButterfly;
@@ -143,11 +141,6 @@ public class PluginLepidopterology extends ForestryPlugin {
'Y', "chestWood");
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerLepidopterology();
}
public static boolean isPollinationAllowed() {
return allowPollination;
}
@@ -19,7 +19,6 @@ import forestry.api.mail.EnumAddressee;
import forestry.api.mail.PostManager;
import forestry.api.recipes.RecipeManagers;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.GuiHandlerBase;
import forestry.core.ISaveEventHandler;
import forestry.core.circuits.EnumCircuitBoardType;
import forestry.core.config.Config;
@@ -29,7 +28,6 @@ import forestry.core.items.EnumElectronTube;
import forestry.core.network.IPacketRegistry;
import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.MachineDefinition;
import forestry.mail.GuiHandlerMail;
import forestry.mail.PostRegistry;
import forestry.mail.PostalCarrier;
import forestry.mail.SaveEventHandlerMail;
@@ -91,11 +89,6 @@ public class PluginMail extends ForestryPlugin {
blocks.mail.init();
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerMail();
}
@Override
public IPacketRegistry getPacketRegistry() {
return new PacketRegistryMail();
@@ -38,7 +38,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
import forestry.Forestry;
import forestry.api.core.ForestryAPI;
import forestry.core.GuiHandlerBase;
import forestry.core.IPickupHandler;
import forestry.core.IResupplyHandler;
import forestry.core.ISaveEventHandler;
@@ -67,7 +66,6 @@ public class PluginManager {
private static final String MODULE_CONFIG_FILE_NAME = "modules.cfg";
private static final String CATEGORY_MODULES = "modules";
public static final ArrayList<GuiHandlerBase> guiHandlers = Lists.newArrayList();
public static final ArrayList<IPickupHandler> pickupHandlers = Lists.newArrayList();
public static final ArrayList<ISaveEventHandler> saveEventHandlers = Lists.newArrayList();
public static final ArrayList<IResupplyHandler> resupplyHandlers = Lists.newArrayList();
@@ -167,11 +165,6 @@ public class PluginManager {
private static void registerHandlers(ForestryPlugin plugin) {
Log.fine("Registering Handlers for Plugin: {0}", plugin);
GuiHandlerBase guiHandler = plugin.getGuiHandler();
if (guiHandler != null) {
guiHandlers.add(guiHandler);
}
plugin.getPacketRegistry().registerPackets();
IPickupHandler pickupHandler = plugin.getPickupHandler();
@@ -56,7 +56,6 @@ import forestry.api.storage.BackpackManager;
import forestry.api.storage.IBackpackDefinition;
import forestry.api.storage.StorageManager;
import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.core.GuiHandlerBase;
import forestry.core.IPickupHandler;
import forestry.core.IResupplyHandler;
import forestry.core.config.Constants;
@@ -74,7 +73,6 @@ import forestry.storage.BackpackDefinition.BackpackDefinitionApiarist;
import forestry.storage.BackpackDefinition.BackpackDefinitionLepidopterist;
import forestry.storage.BackpackInterface;
import forestry.storage.CrateRegistry;
import forestry.storage.GuiHandlerStorage;
import forestry.storage.PickupHandlerStorage;
import forestry.storage.ResupplyHandler;
import forestry.storage.items.ItemRegistryStorage;
@@ -486,11 +484,6 @@ public class PluginStorage extends ForestryPlugin {
return new PickupHandlerStorage();
}
@Override
public GuiHandlerBase getGuiHandler() {
return new GuiHandlerStorage();
}
@Override
public IResupplyHandler getResupplyHandler() {
return new ResupplyHandler();