equivalent-exchange-3/ee3_common/com/pahimar/ee3/EquivalentExchange3.java

182 lines
6.5 KiB
Java
Raw Normal View History

package com.pahimar.ee3;
2013-02-16 23:49:33 +01:00
import java.io.File;
import net.minecraft.creativetab.CreativeTabs;
2013-03-08 04:45:55 +01:00
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.MinecraftForge;
import com.pahimar.ee3.block.ModBlocks;
import com.pahimar.ee3.command.CommandHandler;
import com.pahimar.ee3.configuration.ConfigurationHandler;
import com.pahimar.ee3.core.handlers.ActionRequestHandler;
import com.pahimar.ee3.core.handlers.AddonHandler;
import com.pahimar.ee3.core.handlers.CraftingHandler;
import com.pahimar.ee3.core.handlers.EntityLivingHandler;
import com.pahimar.ee3.core.handlers.FuelHandler;
2013-06-07 21:57:31 +02:00
import com.pahimar.ee3.core.handlers.InterModCommsHandler;
import com.pahimar.ee3.core.handlers.ItemEventHandler;
import com.pahimar.ee3.core.handlers.LocalizationHandler;
import com.pahimar.ee3.core.handlers.PlayerDestroyItemHandler;
import com.pahimar.ee3.core.handlers.VersionCheckTickHandler;
import com.pahimar.ee3.core.handlers.WorldTransmutationHandler;
import com.pahimar.ee3.core.proxy.CommonProxy;
import com.pahimar.ee3.core.util.LogHelper;
import com.pahimar.ee3.core.util.VersionHelper;
import com.pahimar.ee3.creativetab.CreativeTabEE3;
import com.pahimar.ee3.emc.DynEMC;
import com.pahimar.ee3.item.ModItems;
2013-03-08 04:45:55 +01:00
import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes;
import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.network.PacketHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.FingerprintWarning;
2013-06-07 21:57:31 +02:00
import cpw.mods.fml.common.Mod.IMCCallback;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.Mod.ServerStarting;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
2013-06-07 21:57:31 +02:00
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
2012-08-25 08:07:59 +02:00
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* Equivalent-Exchange-3
*
* EquivalentExchange3
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION_NUMBER, dependencies = Reference.DEPENDENCIES, certificateFingerprint = Reference.FINGERPRINT)
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class EquivalentExchange3 {
@Instance(Reference.MOD_ID)
public static EquivalentExchange3 instance;
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID);
@FingerprintWarning
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
// Report (log) to the user that the version of Equivalent Exchange 3 they are using has been changed/tampered with
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
}
@ServerStarting
public void serverStarting(FMLServerStartingEvent event) {
// Initialize the custom commands
CommandHandler.initCommands(event);
}
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// Initialize the log helper
LogHelper.init();
// Load the localization files into the LanguageRegistry
LocalizationHandler.loadLanguages();
// Initialize the configuration
ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME + File.separator + Reference.MOD_ID + ".cfg"));
// Conduct the version check and log the result
VersionHelper.execute();
// Initialize the Version Check Tick Handler (Client only)
TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT);
// Initialize the Render Tick Handler (Client only)
2012-11-26 15:31:47 +01:00
proxy.registerRenderTickHandler();
// Register the KeyBinding Handler (Client only)
proxy.registerKeyBindingHandler();
// Register the Sound Handler (Client only)
proxy.registerSoundHandler();
// Initialize mod blocks
ModBlocks.init();
// Initialize mod items
ModItems.init();
}
2013-03-08 04:45:55 +01:00
@SuppressWarnings("unchecked")
@Init
public void load(FMLInitializationEvent event) {
// Register the GUI Handler
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
2012-09-07 22:18:11 +02:00
// Register the PlayerDestroyItem Handler
MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler());
// Register the Item Pickup Handler
MinecraftForge.EVENT_BUS.register(new ItemEventHandler());
// Register the EntityLiving Handler
MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());
MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());
MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());
2013-02-19 02:13:24 +01:00
GameRegistry.registerCraftingHandler(new CraftingHandler());
// Register the DrawBlockHighlight Handler
proxy.registerDrawBlockHighlightHandler();
2012-08-29 22:02:30 +02:00
// Initialize mod tile entities
2013-04-16 22:06:30 +02:00
proxy.registerTileEntities();
2012-09-11 04:07:59 +02:00
// Initialize custom rendering and pre-load textures (Client only)
proxy.initRenderingAndTextures();
// Load the Transmutation Stone recipes
//RecipesTransmutationStone.init();
2013-03-08 04:45:55 +01:00
// Add in the ability to dye Alchemical Bags
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
2012-10-03 04:00:43 +02:00
// Register the Fuel Handler
GameRegistry.registerFuelHandler(new FuelHandler());
}
@PostInit
public void modsLoaded(FMLPostInitializationEvent event) {
// Initialize the Addon Handler
AddonHandler.init();
2013-06-03 04:11:11 +02:00
// Initialize the DynEMC system
2013-06-19 04:20:50 +02:00
@SuppressWarnings("unused")
2013-06-03 04:11:11 +02:00
DynEMC dynEMC = DynEMC.getInstance();
}
2013-06-07 21:57:31 +02:00
@IMCCallback
public void handleIMCMessages(IMCEvent event) {
InterModCommsHandler.processIMCMessages(event);
}
}