ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/ActuallyAdditions.java

136 lines
5.4 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* This file ("ActuallyAdditions.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2015-11-02 20:55:19 +01:00
* © 2015 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2015-03-07 12:51:28 +01:00
package ellpeck.actuallyadditions;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.blocks.InitBlocks;
2015-06-28 03:12:32 +02:00
import ellpeck.actuallyadditions.communication.InterModCommunications;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.config.ConfigurationHandler;
import ellpeck.actuallyadditions.crafting.CrusherCrafting;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.crafting.InitCrafting;
2015-06-21 02:28:49 +02:00
import ellpeck.actuallyadditions.crafting.ItemCrafting;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.event.InitEvents;
import ellpeck.actuallyadditions.gen.InitVillager;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.gen.OreGen;
import ellpeck.actuallyadditions.inventory.GuiHandler;
2015-07-12 22:05:34 +02:00
import ellpeck.actuallyadditions.items.InitForeignPaxels;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.items.InitItems;
2015-06-12 21:29:21 +02:00
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.material.InitArmorMaterials;
import ellpeck.actuallyadditions.material.InitToolMaterials;
2015-11-01 10:34:17 +01:00
import ellpeck.actuallyadditions.misc.DispenserHandlerEmptyBucket;
import ellpeck.actuallyadditions.misc.DispenserHandlerFertilize;
import ellpeck.actuallyadditions.misc.DispenserHandlerFillBucket;
import ellpeck.actuallyadditions.misc.WorldData;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.ore.InitOreDict;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.proxy.IProxy;
2015-05-20 22:39:43 +02:00
import ellpeck.actuallyadditions.recipe.FuelHandler;
2015-06-28 03:12:32 +02:00
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
2015-07-10 13:08:20 +02:00
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.update.UpdateChecker;
2015-03-29 15:29:05 +02:00
import ellpeck.actuallyadditions.util.ModUtil;
2015-03-07 12:51:28 +01:00
import ellpeck.actuallyadditions.util.Util;
2015-10-29 19:51:00 +01:00
import ellpeck.actuallyadditions.util.playerdata.PersistentServerData;
import net.minecraft.init.Items;
import net.minecraft.server.MinecraftServer;
2015-10-02 16:48:01 +02:00
// So that BuildCraft Oil always gets used
@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION, dependencies = "after:BuildCraft|Energy", canBeDeactivated = false, guiFactory = "ellpeck.actuallyadditions.config.GuiFactory")
2015-03-07 12:51:28 +01:00
public class ActuallyAdditions{
2015-03-29 15:29:05 +02:00
@Instance(ModUtil.MOD_ID)
2015-03-07 12:51:28 +01:00
public static ActuallyAdditions instance;
2015-03-07 12:51:28 +01:00
@SidedProxy(clientSide = "ellpeck.actuallyadditions.proxy.ClientProxy", serverSide = "ellpeck.actuallyadditions.proxy.ServerProxy")
public static IProxy proxy;
2015-06-21 02:28:49 +02:00
@EventHandler
public void preInit(FMLPreInitializationEvent event){
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
2015-07-17 11:17:55 +02:00
new ConfigurationHandler(event.getSuggestedConfigurationFile());
PacketHandler.init();
InitToolMaterials.init();
InitArmorMaterials.init();
InitBlocks.init();
InitItems.init();
2015-05-20 22:39:43 +02:00
FuelHandler.init();
UpdateChecker.init();
proxy.preInit(event);
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("PreInitialization Finished.");
}
2015-06-21 02:28:49 +02:00
@EventHandler
public void init(FMLInitializationEvent event){
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("Starting Initialization Phase...");
InitOreDict.init();
InitAchievements.init();
2014-12-18 19:24:06 +01:00
GuiHandler.init();
OreGen.init();
TileEntityBase.init();
InitEvents.init();
InitCrafting.init();
2015-04-26 20:07:57 +02:00
FMLInterModComms.sendMessage("Waila", "register", "ellpeck.actuallyadditions.waila.WailaDataProvider.register");
proxy.init(event);
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("Initialization Finished.");
}
2015-06-21 02:28:49 +02:00
@EventHandler
public void postInit(FMLPostInitializationEvent event){
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("Starting PostInitialization Phase...");
InitVillager.init();
2015-06-12 21:29:21 +02:00
ItemCoffee.initIngredients();
CrusherCrafting.init();
2015-06-21 02:28:49 +02:00
ItemCrafting.initMashedFoodRecipes();
2015-06-28 03:12:32 +02:00
HairyBallHandler.init();
2015-07-10 13:08:20 +02:00
TreasureChestHandler.init();
2015-07-12 22:05:34 +02:00
InitForeignPaxels.init();
proxy.postInit(event);
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("PostInitialization Finished.");
}
2015-06-28 03:12:32 +02:00
@EventHandler
public void onIMCReceived(FMLInterModComms.IMCEvent event){
InterModCommunications.processIMC(event.getMessages());
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event){
2015-07-01 21:32:48 +02:00
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
Util.registerDispenserHandler(Items.bucket, new DispenserHandlerFillBucket());
2015-07-01 21:32:48 +02:00
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
}
@EventHandler
public void serverStarted(FMLServerStartedEvent event){
WorldData.init(MinecraftServer.getServer());
}
@EventHandler
public void serverStopped(FMLServerStoppedEvent event){
2015-10-29 19:51:00 +01:00
//Clear Data so that it won't be carried over to other worlds
PersistentServerData.playerSaveData.clear();
}
}