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

149 lines
5.5 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
2016-05-16 22:52:27 +02:00
* This file ("ActuallyAdditions.java") is part of the Actually Additions mod for Minecraft.
2015-08-29 14:33:25 +02:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2015-08-29 14:33:25 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2017-01-01 16:23:26 +01:00
* © 2015-2017 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod;
2016-05-14 13:51:18 +02:00
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
2016-07-22 20:23:51 +02:00
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
2016-07-03 20:57:00 +02:00
import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
2016-01-29 17:38:31 +01:00
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
2016-05-15 12:01:26 +02:00
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
2016-10-31 19:05:29 +01:00
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
2017-04-01 19:40:39 +02:00
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
2016-05-06 22:23:41 +02:00
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
2016-01-07 18:20:59 +01:00
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.*;
2015-10-02 16:48:01 +02:00
2017-08-24 07:02:52 +02:00
@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION, guiFactory = "de.ellpeck.actuallyadditions.mod.config.GuiFactory", acceptedMinecraftVersions = "[1.12, 1.13)")
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;
2016-05-13 23:19:30 +02:00
@SidedProxy(clientSide = ModUtil.PROXY_CLIENT, serverSide = ModUtil.PROXY_SERVER)
public static IProxy proxy;
public static boolean commonCapsLoaded;
2016-05-06 22:23:41 +02:00
static{
//For some reason, this has to be done here
FluidRegistry.enableUniversalBucket();
}
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...");
2016-05-14 13:51:18 +02:00
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
2016-05-15 12:01:26 +02:00
Lenses.init();
InitBooklet.preInit();
2016-05-14 13:51:18 +02:00
commonCapsLoaded = Loader.isModLoaded("commoncapabilities");
MinecraftForge.EVENT_BUS.register(new RegistryHandler());
2015-07-17 11:17:55 +02:00
new ConfigurationHandler(event.getSuggestedConfigurationFile());
PacketHandler.init();
InitToolMaterials.init();
InitArmorMaterials.init();
2016-01-29 17:38:31 +01:00
InitFluids.init();
2016-07-03 20:57:00 +02:00
new UpdateChecker();
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...");
BannerHelper.init();
2017-06-17 00:48:49 +02:00
//InitAchievements.init();
2014-12-18 19:24:06 +01:00
GuiHandler.init();
2016-07-03 20:57:00 +02:00
new OreGen();
2014-12-18 19:24:06 +01:00
TileEntityBase.init();
2016-07-03 20:57:00 +02:00
new CommonEvents();
2016-07-22 20:23:51 +02:00
InitEntities.init();
2017-04-01 19:40:39 +02:00
CompatUtil.registerCraftingTweaksCompat();
proxy.init(event);
RegistryHandler.BLOCKS_TO_REGISTER.clear();
ModUtil.LOGGER.info("Initialization Finished.");
}
@EventHandler
public void postInit(FMLPostInitializationEvent event){
ModUtil.LOGGER.info("Starting PostInitialization Phase...");
ItemCoffee.initIngredients();
CrusherCrafting.init();
HairyBallHandler.init();
TreasureChestHandler.init();
LensRecipeHandler.init();
EmpowererHandler.init();
LensMining.init();
2016-11-22 22:54:35 +01:00
InitBooklet.postInit();
proxy.postInit(event);
ConfigurationHandler.redefineConfigs();
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("PostInitialization Finished.");
}
2015-06-28 03:12:32 +02:00
@EventHandler
public void serverStarted(FMLServerStartedEvent event){
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
if(server != null){
World world = server.getEntityWorld();
2017-04-01 19:40:39 +02:00
if(world != null && !world.isRemote){
WorldData.get(world, true).markDirty();
}
}
}
@EventHandler
public void serverStopped(FMLServerStoppedEvent event){
WorldData.clear();
}
}