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

147 lines
6 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
2016-01-03 16:05:51 +01:00
* http://ellpeck.de/actaddlicense/
2015-08-29 14:33:25 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-01-03 16:05:51 +01:00
* © 2016 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod;
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;
import de.ellpeck.actuallyadditions.mod.crafting.ItemCrafting;
import de.ellpeck.actuallyadditions.mod.event.InitEvents;
import de.ellpeck.actuallyadditions.mod.gen.InitVillager;
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.lens.LensNoneRecipeHandler;
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials;
import de.ellpeck.actuallyadditions.mod.misc.*;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.ore.InitOreDict;
import de.ellpeck.actuallyadditions.mod.proxy.IProxy;
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;
import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.init.Items;
import net.minecraft.server.MinecraftServer;
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
2015-12-28 19:01:36 +01:00
import java.util.Locale;
// So that BuildCraft Oil always gets used
@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{
2015-03-29 15:29:05 +02:00
@Instance(ModUtil.MOD_ID)
2015-03-07 12:51:28 +01:00
public static ActuallyAdditions instance;
@SidedProxy(clientSide = "de.ellpeck.actuallyadditions.mod.proxy.ClientProxy", serverSide = "de.ellpeck.actuallyadditions.mod.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();
2016-01-05 14:57:50 +01:00
InitBooklet.preInit();
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-11-15 19:24:36 +01:00
DungeonLoot.init();
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();
LensNoneRecipeHandler.init();
2015-07-12 22:05:34 +02:00
InitForeignPaxels.init();
2016-01-05 14:57:50 +01:00
InitBooklet.postInit();
proxy.postInit(event);
2015-07-01 21:32:48 +02:00
ModUtil.LOGGER.info("PostInitialization Finished.");
2015-12-16 14:59:03 +01:00
FakePlayerUtil.info();
}
2015-06-28 03:12:32 +02:00
@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){
if(LaserRelayConnectionHandler.getInstance() == null){
LaserRelayConnectionHandler.setInstance(new LaserRelayConnectionHandler());
}
WorldData.init(MinecraftServer.getServer());
}
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event){
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
//Ignore removal of foreign paxels
2015-12-28 19:01:36 +01:00
if(mapping.name != null && mapping.name.toLowerCase(Locale.ROOT).startsWith(ModUtil.MOD_ID_LOWER+":")){
if(mapping.name.contains("paxel") || mapping.name.contains("itemSpecial") || mapping.name.contains("blockBookStand")){
mapping.ignore();
2015-12-28 19:01:36 +01:00
ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
}
}
}
}
}