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;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
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.achievement.InitAchievements;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
|
|
|
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.crafting.InitCrafting;
|
2016-12-28 14:55:03 +01:00
|
|
|
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;
|
2016-11-26 21:32:27 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
2016-11-23 17:46:08 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
2016-05-05 19:50:59 +02:00
|
|
|
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;
|
2016-12-18 17:50:31 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
2016-12-04 15:03:01 +01:00
|
|
|
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.ore.InitOreDict;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
|
2016-08-03 04:01:47 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.recipe.FuelHandler;
|
|
|
|
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;
|
2016-11-19 21:54:43 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
2016-12-28 14:55:03 +01:00
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.world.World;
|
2016-05-06 22:23:41 +02:00
|
|
|
import net.minecraftforge.fluids.FluidRegistry;
|
2016-12-28 14:55:03 +01:00
|
|
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
2016-07-25 02:07:16 +02:00
|
|
|
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;
|
2016-12-28 14:55:03 +01:00
|
|
|
import net.minecraftforge.fml.common.event.*;
|
2015-10-02 16:48:01 +02:00
|
|
|
|
2015-08-03 09:01:13 +02:00
|
|
|
// So that BuildCraft Oil always gets used
|
2016-01-05 04:52:53 +01:00
|
|
|
@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION, dependencies = "after:BuildCraft|Energy", guiFactory = "de.ellpeck.actuallyadditions.mod.config.GuiFactory")
|
2015-03-07 12:51:28 +01:00
|
|
|
public class ActuallyAdditions{
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2015-03-29 15:29:05 +02:00
|
|
|
@Instance(ModUtil.MOD_ID)
|
2015-03-07 12:51:28 +01:00
|
|
|
public static ActuallyAdditions instance;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
2016-05-13 23:19:30 +02:00
|
|
|
@SidedProxy(clientSide = ModUtil.PROXY_CLIENT, serverSide = ModUtil.PROXY_SERVER)
|
2014-12-03 21:55:53 +01:00
|
|
|
public static IProxy proxy;
|
|
|
|
|
2016-07-25 02:07:16 +02:00
|
|
|
public static boolean teslaLoaded;
|
2017-02-04 14:12:17 +01:00
|
|
|
public static boolean commonCapsLoaded;
|
2016-07-25 02:07:16 +02:00
|
|
|
|
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
|
2014-11-10 16:47:04 +01:00
|
|
|
public void preInit(FMLPreInitializationEvent event){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
|
2015-02-09 17:25:05 +01:00
|
|
|
|
2016-05-14 13:51:18 +02:00
|
|
|
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
2016-07-30 17:07:32 +02:00
|
|
|
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
2016-05-15 12:01:26 +02:00
|
|
|
Lenses.init();
|
|
|
|
InitBooklet.preInit();
|
2016-05-14 13:51:18 +02:00
|
|
|
|
2017-02-04 14:12:17 +01:00
|
|
|
teslaLoaded = Loader.isModLoaded("tesla");
|
|
|
|
commonCapsLoaded = Loader.isModLoaded("commoncapabilities");
|
2016-07-25 02:07:16 +02:00
|
|
|
|
2015-07-17 11:17:55 +02:00
|
|
|
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
2015-06-12 19:12:06 +02:00
|
|
|
PacketHandler.init();
|
2015-07-11 05:24:04 +02:00
|
|
|
InitToolMaterials.init();
|
|
|
|
InitArmorMaterials.init();
|
2014-11-10 16:47:04 +01:00
|
|
|
InitBlocks.init();
|
2016-01-29 17:38:31 +01:00
|
|
|
InitFluids.init();
|
2014-11-10 16:47:04 +01:00
|
|
|
InitItems.init();
|
2015-05-20 22:39:43 +02:00
|
|
|
FuelHandler.init();
|
2016-05-13 23:19:30 +02:00
|
|
|
BannerHelper.init();
|
2016-05-11 15:28:46 +02:00
|
|
|
SoundHandler.init();
|
2016-07-03 20:57:00 +02:00
|
|
|
new UpdateChecker();
|
2015-08-30 19:10:10 +02:00
|
|
|
proxy.preInit(event);
|
2015-02-09 17:25:05 +01:00
|
|
|
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("PreInitialization Finished.");
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
|
|
|
|
2015-06-21 02:28:49 +02:00
|
|
|
@EventHandler
|
2014-11-10 16:47:04 +01:00
|
|
|
public void init(FMLInitializationEvent event){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("Starting Initialization Phase...");
|
2015-02-09 17:25:05 +01:00
|
|
|
|
2015-07-02 10:45:15 +02:00
|
|
|
InitOreDict.init();
|
2015-02-09 17:25:05 +01: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();
|
2015-03-07 02:23:31 +01:00
|
|
|
InitCrafting.init();
|
2016-07-22 20:23:51 +02:00
|
|
|
InitEntities.init();
|
2016-05-17 15:59:12 +02:00
|
|
|
|
2016-11-22 22:25:46 +01:00
|
|
|
proxy.init(event);
|
|
|
|
|
|
|
|
ModUtil.LOGGER.info("Initialization Finished.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void postInit(FMLPostInitializationEvent event){
|
|
|
|
ModUtil.LOGGER.info("Starting PostInitialization Phase...");
|
|
|
|
|
2016-11-16 19:08:56 +01:00
|
|
|
InitVillager.init();
|
|
|
|
ItemCoffee.initIngredients();
|
|
|
|
CrusherCrafting.init();
|
|
|
|
HairyBallHandler.init();
|
|
|
|
TreasureChestHandler.init();
|
|
|
|
LensRecipeHandler.init();
|
|
|
|
EmpowererHandler.init();
|
2016-11-23 17:46:08 +01:00
|
|
|
LensMining.init();
|
2016-11-16 19:08:56 +01:00
|
|
|
|
2016-11-22 22:54:35 +01:00
|
|
|
InitBooklet.postInit();
|
2015-08-30 19:10:10 +02:00
|
|
|
proxy.postInit(event);
|
2015-02-09 17:25:05 +01:00
|
|
|
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("PostInitialization Finished.");
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|
2015-06-28 03:12:32 +02:00
|
|
|
|
2016-12-28 14:55:03 +01:00
|
|
|
@EventHandler
|
|
|
|
public void serverStarted(FMLServerStartedEvent event){
|
|
|
|
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
|
|
|
if(server != null){
|
|
|
|
World world = server.getEntityWorld();
|
|
|
|
if(world != null){
|
|
|
|
WorldData.get(world, true).markDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-13 15:23:28 +01:00
|
|
|
@EventHandler
|
|
|
|
public void serverStopped(FMLServerStoppedEvent event){
|
|
|
|
WorldData.clear();
|
|
|
|
}
|
|
|
|
|
2015-12-17 22:05:42 +01:00
|
|
|
@EventHandler
|
|
|
|
public void missingMapping(FMLMissingMappingsEvent event){
|
2016-11-19 21:54:43 +01:00
|
|
|
int totalRemaps = 0;
|
|
|
|
int workedRemaps = 0;
|
|
|
|
|
2016-01-10 19:32:21 +01:00
|
|
|
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
|
2016-11-19 21:54:43 +01:00
|
|
|
totalRemaps++;
|
|
|
|
|
|
|
|
if(ItemUtil.remapName(mapping)){
|
|
|
|
workedRemaps++;
|
2015-12-17 22:05:42 +01:00
|
|
|
}
|
|
|
|
}
|
2016-11-19 21:54:43 +01:00
|
|
|
|
|
|
|
if(totalRemaps > 0){
|
|
|
|
ModUtil.LOGGER.info("Successfully remapped "+workedRemaps+" out of "+totalRemaps+" blocks and items to match the 1.11 naming conventions.");
|
|
|
|
}
|
2015-12-17 22:05:42 +01:00
|
|
|
}
|
2014-11-10 16:47:04 +01:00
|
|
|
}
|