aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/MiscUtils.java
blob: cfb7944c8e6d5baea050b65bb20d746348eaea51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package miscutil;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import miscutil.core.commands.CommandMath;
import miscutil.core.common.CommonProxy;
import miscutil.core.creativetabs.AddToCreativeTab;
import miscutil.core.handler.CraftingManager;
import miscutil.core.lib.Strings;
import miscutil.core.util.Utils;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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.event.FMLServerStoppingEvent;

@Mod(modid=Strings.MODID, name="Misc. Utils", version=Strings.VERSION, dependencies="required-after:gregtech")
public class MiscUtils
implements ActionListener
{ 

	//Vars
	//EnumBuster EB = new EnumBuster(gregtech.api.enums.Materials, null);
	
	@Mod.Instance(Strings.MODID)
	public static MiscUtils instance;

	@SidedProxy(clientSide="miscutil.core.proxy.ClientProxy", serverSide="miscutil.core.proxy.ServerProxy")
	public static CommonProxy proxy;


	//Pre-Init
	@Mod.EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		/*try {
			MaterialsNew.getGregMaterials();
		} catch (IllegalAccessException | IllegalArgumentException
				| InvocationTargetException | NoSuchMethodException | SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		//java.lang.reflect.Array.get(Materials, index)
		Utils.LOG_INFO("Doing some house cleaning.");
		AddToCreativeTab.initialiseTabs();
		//TMEntity.mainRegistry();
		CraftingManager.mainRegistry();
		//TMWorld.mainRegistry();
		//TMHooks.mainRegistry();
		proxy.registerTileEntities();
		proxy.registerRenderThings();
		proxy.preInit(event);



	}

	//Init
	@Mod.EventHandler
	public void init(FMLInitializationEvent event)
	{
		/*		Utils.LOG_INFO("Double checking floating point precision.");
		try {
			Thread.sleep(100);
			Benchmark GammeRayBurst = new Benchmark();
			GammeRayBurst.math();
		} catch (InterruptedException | ParseException | NumberFormatException | UnknownFormatConversionException | MissingFormatArgumentException e) {
			if (Strings.DEBUG){
				e.printStackTrace();
				Utils.LOG_INFO("Math went wrong somewhere.");
			}
			;
		}*/
		proxy.init(event);
		/*if (Strings.DEBUG){
			Benchmark GammeRayBurst = new Benchmark();
			String Insight = GammeRayBurst.superhash("This is Absolution");
			FMLLog.info(Insight);
			Utils.LOG_INFO("Math is ok.");
		}*/

		MinecraftForge.EVENT_BUS.register(this);
		FMLCommonHandler.instance().bus().register(this);
		proxy.registerNetworkStuff();
	}

	//Post-Init
	@Mod.EventHandler
	public void postInit(FMLPostInitializationEvent event) {
		Utils.LOG_INFO("Tidying things up.");
		proxy.postInit(event);
	}

	@EventHandler
	public void serverStarting(FMLServerStartingEvent event)
	{

		event.registerServerCommand(new CommandMath());
		
		//while (Strings.DEBUG){
		//Thread.setDefaultUncaughtExceptionHandler(null);
		//}

	}

	@Mod.EventHandler
	public void serverStopping(FMLServerStoppingEvent event)
	{


	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub

	}

}