Professional Documents
Culture Documents
Twisted Mod An Example Main Class File For Java Minecraft Modding
Twisted Mod An Example Main Class File For Java Minecraft Modding
for more detail see the github (just search for mrgreaper to find it :) ) package com.mrgreaper.twisted; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import import import import import import import import import import import import import import import import import import import import com.mrgreaper.twisted.blocks.Blocks; com.mrgreaper.twisted.client.interfaces.GuiHandler; com.mrgreaper.twisted.client.sounds.SpeechHandler; com.mrgreaper.twisted.config.ConfigHandler; com.mrgreaper.twisted.config.configInfo; com.mrgreaper.twisted.entities.Entities; com.mrgreaper.twisted.items.Items; com.mrgreaper.twisted.items.recipies; com.mrgreaper.twisted.network.ModInformation; com.mrgreaper.twisted.network.PacketHandler; com.mrgreaper.twisted.proxies.CommonProxy; cpw.mods.fml.common.Loader; cpw.mods.fml.common.Mod; cpw.mods.fml.common.Mod.EventHandler; cpw.mods.fml.common.Mod.Instance; cpw.mods.fml.common.SidedProxy; cpw.mods.fml.common.event.FMLInitializationEvent; cpw.mods.fml.common.event.FMLPreInitializationEvent; cpw.mods.fml.common.network.NetworkMod; cpw.mods.fml.common.registry.LanguageRegistry;
@Mod( name = ModInformation.NAME, modid = ModInformation.ID, version = ModInform ation.VERSION) @NetworkMod(channels = {ModInformation.CHANNEL}, clientSideRequired = true, serv erSideRequired =false, packetHandler = PacketHandler.class ) public class TwistedMod { public static CreativeTabs tabTwisted = new CreativeTabs("tabTwisted") { public ItemStack getIconItemStack() { //return new ItemStack(Item.carrot, 1, 0); return new ItemStack(Items.bunnyd, 1, 0); } }; @Instance(ModInformation.ID) public static TwistedMod instance; @SidedProxy(clientSide = "com.mrgreaper.twisted.proxies.ClientProxy", serverSide = "com.mrgreaper.twisted.proxies.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event){ //in here stuff is loaded like loading textures and sounds, aking config s etc ConfigHandler.init(event.getSuggestedConfigurationFile());
if (configInfo.DEBUG){ System.out.println("++++ Twisted Mod ++++"); System.out.println("++++DEBUG MODE ON++++"); }else{ System.out.println("---- Twisted Mod ---"); System.out.println("-----DEBUG MODE OFF----"); } System.out.println("By Mr G Reaper...WARNING may contain bunnys!"); Items.init(); Blocks.init(); proxy.initSounds(); proxy.initRenderers(); proxy.registerServerTickHandler(); } @EventHandler public void load(FMLInitializationEvent event){ Items.addNames(); recipies.registerRecipes(); Blocks.addNames(); Blocks.registerTileEntities(); LanguageRegistry.instance().addStringLocalization("itemGroup.tabTwisted", "en_ US", "Mr G Reapers Twisted Tab"); Entities.init(); // new GenerationHandeler(); new GuiHandler(); //SpeechHandler.speechSynth(null, null, 2, 10, 10, 10, "speech is on"); } @EventHandler public void modsLoaded(FMLPreInitializationEvent event){ if (Loader.isModLoaded("AppliedEnergistics")) { try { configInfo.appEngLoaded = true; System.out.println( "AppliedEnergistics detected by twis ted mod"); } catch (Exception e) { System.out.println("Could not load appeng settings"); e.printStackTrace(System.err); } }else{ configInfo.appEngLoaded = false; } if (Loader.isModLoaded("IC2")) { try { configInfo.IC2Loaded = true; System.out.println( "ic2 detected by twisted mod"); } catch (Exception e) { System.out.println("Could not load appeng settings"); e.printStackTrace(System.err); } }else{
configInfo.appEngLoaded = false; } }