2013-09-11 14:20:15 +02:00
|
|
|
package com.pahimar.ee3;
|
|
|
|
|
|
|
|
import com.pahimar.ee3.block.ModBlocks;
|
|
|
|
import com.pahimar.ee3.command.CommandHandler;
|
|
|
|
import com.pahimar.ee3.configuration.ConfigurationHandler;
|
2013-12-16 02:26:42 +01:00
|
|
|
import com.pahimar.ee3.core.handler.*;
|
2013-12-16 21:50:23 +01:00
|
|
|
import com.pahimar.ee3.addon.AddonIMCHandler;
|
|
|
|
import com.pahimar.ee3.core.helper.DebugHelper;
|
2013-10-18 02:53:08 +02:00
|
|
|
import com.pahimar.ee3.core.helper.LogHelper;
|
|
|
|
import com.pahimar.ee3.core.helper.VersionHelper;
|
2013-09-11 14:20:15 +02:00
|
|
|
import com.pahimar.ee3.core.proxy.CommonProxy;
|
|
|
|
import com.pahimar.ee3.creativetab.CreativeTabEE3;
|
2013-10-27 23:18:09 +01:00
|
|
|
import com.pahimar.ee3.emc.EmcRegistry;
|
2013-11-23 07:29:49 +01:00
|
|
|
import com.pahimar.ee3.imc.InterModCommsHandler;
|
2013-09-11 14:20:15 +02:00
|
|
|
import com.pahimar.ee3.item.ModItems;
|
|
|
|
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.EventHandler;
|
|
|
|
import cpw.mods.fml.common.Mod.Instance;
|
|
|
|
import cpw.mods.fml.common.SidedProxy;
|
2013-12-16 02:26:42 +01:00
|
|
|
import cpw.mods.fml.common.event.*;
|
2013-09-11 14:20:15 +02:00
|
|
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
|
|
|
import cpw.mods.fml.common.network.NetworkMod;
|
|
|
|
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;
|
2013-12-16 02:26:42 +01:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.crafting.CraftingManager;
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
|
|
|
|
import java.io.File;
|
2013-09-11 14:20:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Equivalent-Exchange-3
|
2013-12-16 02:26:42 +01:00
|
|
|
* <p/>
|
2013-09-11 14:20:15 +02:00
|
|
|
* EquivalentExchange3
|
2013-12-16 02:26:42 +01:00
|
|
|
*
|
2013-09-11 14:20:15 +02:00
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*/
|
2013-12-13 10:45:03 +01:00
|
|
|
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, dependencies = Reference.DEPENDENCIES, certificateFingerprint = Reference.FINGERPRINT)
|
2013-12-16 02:26:42 +01:00
|
|
|
@NetworkMod(channels = {Reference.CHANNEL_NAME}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
|
|
|
public class EquivalentExchange3
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
@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);
|
|
|
|
|
|
|
|
@EventHandler
|
2013-12-16 02:26:42 +01:00
|
|
|
public void invalidFingerprint(FMLFingerprintViolationEvent event)
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
// Report (log) to the user that the version of Equivalent Exchange 3
|
|
|
|
// they are using has been changed/tampered with
|
2013-12-16 02:26:42 +01:00
|
|
|
if (Reference.FINGERPRINT.equals("@FINGERPRINT@"))
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
LogHelper.warning(Strings.NO_FINGERPRINT_MESSAGE);
|
|
|
|
}
|
2013-12-16 02:26:42 +01:00
|
|
|
else
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2013-12-16 02:26:42 +01:00
|
|
|
public void serverStarting(FMLServerStartingEvent event)
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
// Initialize the custom commands
|
|
|
|
CommandHandler.initCommands(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2013-12-16 02:26:42 +01:00
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
2013-12-13 10:45:03 +01:00
|
|
|
// set version number
|
|
|
|
event.getModMetadata().version = Reference.VERSION_NUMBER;
|
2013-09-11 14:20:15 +02:00
|
|
|
|
|
|
|
// Initialize the log helper
|
|
|
|
LogHelper.init();
|
|
|
|
|
|
|
|
// Initialize the configuration
|
2013-10-18 02:07:59 +02:00
|
|
|
ConfigurationHandler.init(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME.toLowerCase() + File.separator);
|
2013-09-11 14:20:15 +02:00
|
|
|
|
|
|
|
// Conduct the version check and log the result
|
|
|
|
VersionHelper.execute();
|
|
|
|
|
|
|
|
// Initialize the Version Check Tick Handler (Client only)
|
|
|
|
TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT);
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-11-23 07:29:49 +01:00
|
|
|
// Initialize the InterModCommunications Tick Handler (Server only)
|
|
|
|
TickRegistry.registerScheduledTickHandler(new InterModCommsHandler(), Side.SERVER);
|
2013-09-11 14:20:15 +02:00
|
|
|
|
|
|
|
// Initialize the Render Tick Handler (Client only)
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
@SuppressWarnings("unchecked")
|
2013-12-16 02:26:42 +01:00
|
|
|
public void load(FMLInitializationEvent event)
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
// Register the GUI Handler
|
|
|
|
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
|
|
|
|
|
|
|
|
// 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-10-17 04:27:07 +02:00
|
|
|
|
2013-10-16 21:55:14 +02:00
|
|
|
MinecraftForge.EVENT_BUS.register(new ItemTooltipEventHandler());
|
2013-09-11 14:20:15 +02:00
|
|
|
|
|
|
|
GameRegistry.registerCraftingHandler(new CraftingHandler());
|
|
|
|
|
|
|
|
// Register the DrawBlockHighlight Handler
|
|
|
|
proxy.registerDrawBlockHighlightHandler();
|
|
|
|
|
|
|
|
// Initialize mod tile entities
|
|
|
|
proxy.registerTileEntities();
|
|
|
|
|
|
|
|
// Initialize custom rendering and pre-load textures (Client only)
|
|
|
|
proxy.initRenderingAndTextures();
|
|
|
|
|
|
|
|
// Add in the ability to dye Alchemical Bags
|
|
|
|
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
|
2013-12-16 02:26:42 +01:00
|
|
|
|
2013-11-23 07:29:49 +01:00
|
|
|
// Initialize addons (which work with IMC, and must be used in Init)
|
2013-10-28 20:22:23 +01:00
|
|
|
AddonIMCHandler.init();
|
2013-09-11 14:20:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2013-12-16 02:26:42 +01:00
|
|
|
public void modsLoaded(FMLPostInitializationEvent event)
|
|
|
|
{
|
2013-10-28 00:55:53 +01:00
|
|
|
EmcRegistry.lazyInit();
|
2013-09-11 14:20:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2013-12-16 02:26:42 +01:00
|
|
|
public void handleIMCMessages(IMCEvent event)
|
|
|
|
{
|
2013-09-11 14:20:15 +02:00
|
|
|
InterModCommsHandler.processIMCMessages(event);
|
|
|
|
}
|
|
|
|
}
|