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