Java Code Examples for cpw.mods.fml.common.Mod.EventHandler

The following examples show how to use cpw.mods.fml.common.Mod.EventHandler. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: GTNEIOrePlugin   Source File: GTNEIOrePlugin.java    License: MIT License 6 votes vote down vote up
@EventHandler
public void onLoadComplete(FMLLoadCompleteEvent event) {
    if (event.getSide() == Side.CLIENT) {
        try {
            Class clazzGT6API = Class.forName("gregapi.GT_API");
            GTVersion = "GT6";
        } catch (ClassNotFoundException e) {}
        if (GTVersion.equals("GT5")) {
            new GT5OreLayerHelper();
            new GT5OreSmallHelper();
        }
        else { 
            new GT6OreLayerHelper();
            new GT6OreSmallHelper();
            new GT6OreBedrockHelper();
        }
    }
}
 
Example 2
@EventHandler
  public void serverLoad(FMLServerStartingEvent event)
  {
      // register server commands
  	event.registerServerCommand(new CommandTeleport());
  	event.registerServerCommand(new CommandSmoothMove());
  	event.registerServerCommand(new CommandAStar());
  	event.registerServerCommand(new CommandBFS());
  	event.registerServerCommand(new CommandVI());
  	event.registerServerCommand(new CommandRMax());
  	event.registerServerCommand(new CommandCreateDungeons());
      event.registerServerCommand(new CommandInventory());
      event.registerServerCommand(new CommandCheckState());
      event.registerServerCommand(new CommandResetDungeon());
      event.registerServerCommand(new CommandCheckProps());
  	event.registerServerCommand(new CommandTest());
  	event.registerServerCommand(new CommandTerminalExplore());
      event.registerServerCommand(new CommandCurrentPath());
event.registerServerCommand(new CommandReachable());
      
  }
 
Example 3
Source Project: BigReactors   Source File: BRLoader.java    License: MIT License 6 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	BigReactors.registerOres(0, true);
	BigReactors.registerIngots(0);
	BigReactors.registerFuelRods(0, true);
	BigReactors.registerReactorPartBlocks(0, true);
	BigReactors.registerTurbineParts();
	BigReactors.registerDevices(0,  true);
	BigReactors.registerFluids(0,  true);
	BigReactors.registerCreativeParts(0, true);
	BigReactors.registerItems();

	StandardReactants.register();
	
	BigReactors.eventHandler = new BREventHandler();
	MinecraftForge.EVENT_BUS.register(BigReactors.eventHandler);
	MinecraftForge.EVENT_BUS.register(proxy);
	
	multiblockEventHandler = new MultiblockEventHandler();
	MinecraftForge.EVENT_BUS.register(multiblockEventHandler);
	
	proxy.preInit();
	
	Fluid waterFluid = FluidRegistry.WATER; // Force-load water to prevent startup crashes
}
 
Example 4
Source Project: Et-Futurum   Source File: EtFuturum.java    License: The Unlicense 6 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

	ModRecipes.init();

	proxy.registerEvents();
	proxy.registerEntities();
	proxy.registerRenderers();

	if (ModEntityList.hasEntitiesWithEggs()) {
		ModEntityList.entity_egg = new ItemEntityEgg();
		GameRegistry.registerItem(ModEntityList.entity_egg, "entity_egg");
		OreDictionary.registerOre("mobEgg", ModEntityList.entity_egg);
	}

	isTinkersConstructLoaded = Loader.isModLoaded("TConstruct");
}
 
Example 5
Source Project: Et-Futurum   Source File: EtFuturum.java    License: The Unlicense 6 votes vote down vote up
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	Items.blaze_rod.setFull3D();
	Blocks.trapped_chest.setCreativeTab(CreativeTabs.tabRedstone);

	if (enableUpdatedFoodValues) {
		setFinalField(ItemFood.class, Items.carrot, 3, "healAmount", "field_77853_b");
		setFinalField(ItemFood.class, Items.baked_potato, 5, "healAmount", "field_77853_b");
	}

	if (enableUpdatedHarvestLevels) {
		Blocks.packed_ice.setHarvestLevel("pickaxe", 0);
		Blocks.ladder.setHarvestLevel("axe", 0);
		Blocks.melon_block.setHarvestLevel("axe", 0);
	}
}
 
Example 6
Source Project: OpenPeripheral   Source File: OpenPeripheralCore.java    License: MIT License 6 votes vote down vote up
@EventHandler
public void processMessage(FMLInterModComms.IMCEvent event) {
	for (FMLInterModComms.IMCMessage m : event.getMessages()) {
		if (m.isStringMessage()) {
			if (Constants.IMC_IGNORE.equalsIgnoreCase(m.key)) {
				TileEntityBlacklist.INSTANCE.addToBlacklist(m.getStringValue());
			} else if (Constants.IMC_NAME_CLASS.equalsIgnoreCase(m.key)) {
				String value = m.getStringValue();
				String[] fields = value.split("\\s+");
				if (fields.length != 2) {
					Log.warn("Invalid IMC from %s: can't decode type '%s'", m.getSender(), value);
				} else {
					PeripheralTypeProvider.INSTANCE.setType(fields[0], fields[1]);
				}
			}
		}
	}
}
 
Example 7
Source Project: Chisel-2   Source File: Chisel.java    License: GNU General Public License v2.0 6 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {

	File configFile = event.getSuggestedConfigurationFile();
	Configurations.configExists = configFile.exists();
	Configurations.config = new Configuration(configFile);
	Configurations.config.load();
	Configurations.refreshConfig();

	ChiselTabs.preInit();
	Features.preInit();
	Statistics.init();
	PacketHandler.init();
	ChiselController.INSTANCE.preInit();
	if (Loader.isModLoaded("ForgeMultipart")) {
		new FMPCompat().init();
	}
	proxy.preInit();
}
 
Example 8
Source Project: MyTown2   Source File: MyTown.java    License: The Unlicense 6 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent ev) {
    // Setup Loggers
    LOG = ev.getModLog();

    Constants.CONFIG_FOLDER = ev.getModConfigurationDirectory().getPath() + "/MyTown/";

    // Read Configs
    Config.instance.init(Constants.CONFIG_FOLDER + "/MyTown.cfg", Constants.MODID);
    LOCAL = new Local(Constants.CONFIG_FOLDER+"/localization/", Config.instance.localization.get(), "/mytown/localization/", MyTown.class);
    LocalManager.register(LOCAL, "mytown");

    registerHandlers();

    // Register ICrashCallable's
    FMLCommonHandler.instance().registerCrashCallable(new DatasourceCrashCallable());
}
 
Example 9
Source Project: ExtraCells1   Source File: Extracells.java    License: MIT License 6 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event)
{
	proxy.RegisterItems();
	proxy.RegisterBlocks();
	proxy.RegisterRenderers();
	proxy.RegisterTileEntities();
	proxy.addRecipes();
	if (!debug)
		Util.addBasicBlackList(ItemEnum.FLUIDDISPLAY.getItemInstance().itemID, OreDictionary.WILDCARD_VALUE);
	Util.getCellRegistry().addCellHandler(new FluidCellHandler());
	LanguageRegistry.instance().addStringLocalization("itemGroup.Extra_Cells", "en_US", "Extra Cells");
	renderID = RenderingRegistry.getNextAvailableRenderId();
	RenderHandler handler = new RenderHandler(renderID);
	RenderingRegistry.registerBlockHandler(handler);

	// WAILA Support
	FMLInterModComms.sendMessage("Waila", "register", "extracells.integration.WAILA.WailaDataProvider.callbackRegister");

	
	// AE Spatial Storage Support
	proxy.registerMovables();
}
 
Example 10
@EventHandler
public void load(FMLInitializationEvent event) {
    ElectroMagicTools.logger.info(localize("console.EMT.init.begin"));

    ElectroMagicTools.logger.info(localize("console.EMT.init.loadProxies"));
    proxy.load();
    ElectroMagicTools.logger.info(localize("console.EMT.init.mobDrops"));
    MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
    ElectroMagicTools.logger.info(localize("console.EMT.init.loot"));
    DungeonChestGenerator.generateLoot();

    ElectroMagicTools.logger.info(localize("console.EMT.init.entities"));
    BaseEntityRegistry.registerEMTEntities();
    ElectroMagicTools.logger.info(localize("console.EMT.init.guiHandler"));
    NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);

    ElectroMagicTools.logger.info(localize("console.EMT.init.end"));
}
 
Example 11
@EventHandler
public void prelude(FMLPreInitializationEvent event) {
    instance = this;
    Config.configurate(event.getSuggestedConfigurationFile());
    if (Config.wrathCage)
        crysTab = new CreativeTabs("mobcrystal"){
            @Override
            public Item getTabIconItem() {
                return ForbiddenItems.mobCrystal;
            }
        };
    Compat.initiate();
    DarkAspects.initAspects();
    Config.spawnilify();
    ForbiddenItems.addItems();
    ForbiddenBlocks.addBlocks();
    DarkEnchantments.hex();
    if(Compat.bm)
        DarkPotions.alchemize();
    proxy.registerRenderInfo();
}
 
Example 12
@EventHandler
public void postInit(FMLPostInitializationEvent event){

    //Add these later so we include other mod's storage recipes.
    // CraftingRegistrator.addPressureChamberStorageBlockRecipes();
    CraftingRegistrator.addAssemblyCombinedRecipes();
    HeatExchangerManager.getInstance().init();
    FluidFuelManager.registerFuels();

    ThirdPartyManager.instance().postInit();
    proxy.postInit();
    Config.postInit();
    AmadronOfferManager.getInstance().shufflePeriodicOffers();
    AmadronOfferManager.getInstance().recompileOffers();
    CraftingRegistrator.addProgrammingPuzzleRecipes();
}
 
Example 13
Source Project: LookingGlass   Source File: LookingGlass.java    License: GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void preinit(FMLPreInitializationEvent event) {
	//Initialize the packet handling
	LookingGlassPacketManager.registerPacketHandler(new PacketCreateView(), (byte) 10);
	LookingGlassPacketManager.registerPacketHandler(new PacketCloseView(), (byte) 11);
	LookingGlassPacketManager.registerPacketHandler(new PacketWorldInfo(), (byte) 100);
	LookingGlassPacketManager.registerPacketHandler(new PacketChunkInfo(), (byte) 101);
	LookingGlassPacketManager.registerPacketHandler(new PacketTileEntityNBT(), (byte) 102);
	LookingGlassPacketManager.registerPacketHandler(new PacketRequestWorldInfo(), (byte) 200);
	LookingGlassPacketManager.registerPacketHandler(new PacketRequestChunk(), (byte) 201);
	LookingGlassPacketManager.registerPacketHandler(new PacketRequestTE(), (byte) 202);

	LookingGlassPacketManager.bus = NetworkRegistry.INSTANCE.newEventDrivenChannel(LookingGlassPacketManager.CHANNEL);
	LookingGlassPacketManager.bus.register(new LookingGlassPacketManager());

	// Load our basic configs
	ModConfigs.loadConfigs(new Configuration(event.getSuggestedConfigurationFile()));

	// Here we use the recommended config file to establish a good place to put a log file for any proxy world error logs.  Used primarily to log the full errors when ticking or rendering proxy worlds. 
	File configroot = event.getSuggestedConfigurationFile().getParentFile();
	// Main tick handler. Handles FML events.
	FMLCommonHandler.instance().bus().register(new LookingGlassEventHandler(new File(configroot.getParentFile(), "logs/proxyworlds.log")));
	// Forge event handler
	MinecraftForge.EVENT_BUS.register(new LookingGlassForgeEventHandler());

	// Initialize the API provider system.  Beware, this way be dragons.
	APIProviderImpl.init();
}
 
Example 14
Source Project: LookingGlass   Source File: LookingGlass.java    License: GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
	// Our one and only entity.
	EntityRegistry.registerModEntity(com.xcompwiz.lookingglass.entity.EntityPortal.class, "lookingglass.portal", 216, this, 64, 10, false);

	sidedProxy.init();
}
 
Example 15
Source Project: LookingGlass   Source File: LookingGlass.java    License: GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void serverStart(FMLServerStartingEvent event) {
	MinecraftServer mcserver = event.getServer();
	// Register commands
	((ServerCommandManager) mcserver.getCommandManager()).registerCommand(new CommandCreateView());
	// Start up the packet dispatcher we use for throttled data to client.
	ServerPacketDispatcher.getInstance().start(); //Note: This might need to be preceded by a force init of the ServerPacketDispatcher.  Doesn't seem to currently have any issues, though.
}
 
Example 16
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	

	burlapStone = new BlockBurlapStone();
	redRock = new BlockRedRock();
	blueRock = new BlockBlueRock();
	orangeRock = new BlockOrangeRock();
	greenRock = new BlockGreenRock();
	mineableRedRock = new BlockMineableRedRock();
	mineableOrangeRock = new BlockMineableOrangeRock();
	mineableGreenRock = new BlockMineableGreenRock();
	mineableBlueRock = new BlockMineableBlueRock();
	
	// make sure minecraft knows
	GameRegistry.registerBlock(burlapStone, "burlapstone");
	GameRegistry.registerBlock(redRock, "redrock");
	GameRegistry.registerBlock(blueRock, "bluerock");
	GameRegistry.registerBlock(greenRock, "greenrock");
	GameRegistry.registerBlock(orangeRock, "orangerock");
	GameRegistry.registerBlock(mineableRedRock, "mineableRedRock");
	GameRegistry.registerBlock(mineableGreenRock, "mineableGreenRock");
	GameRegistry.registerBlock(mineableBlueRock, "mineableBlueRock");
	GameRegistry.registerBlock(mineableOrangeRock, "mineableOrangeRock");
	GameRegistry.registerWorldGenerator(genHandler, 0);
	
	MinecraftForge.EVENT_BUS.register(eventHandler);
	// FMLCommonHandler.instance().bus().register(fmlHandler);
	
}
 
Example 17
Source Project: OpenPeripheral-Addons   Source File: OpenPeripheralAddons.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent evt) {
	proxy.init();
	proxy.registerRenderInformation();

	OpcAccess.checkApiPresent();

	OpcAccess.adapterRegistry.register(new AdapterSensor());

	OpcAccess.itemStackMetaBuilder.register(new ItemTerminalMetaProvider());
	OpcAccess.itemStackMetaBuilder.register(new NbtTerminalMetaProvider());

	if (Loader.isModLoaded(Mods.COMPUTERCRAFT)) ModuleComputerCraft.init();
}
 
Example 18
Source Project: Et-Futurum   Source File: EtFuturum.java    License: The Unlicense 5 votes vote down vote up
@EventHandler
public void processIMCRequests(IMCEvent event) {
	for (IMCMessage message : event.getMessages())
		if (message.key.equals("register-brewing-fuel")) {
			NBTTagCompound nbt = message.getNBTValue();
			ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("Fuel"));
			int brews = nbt.getInteger("Brews");
			BrewingFuelRegistry.registerFuel(stack, brews);
		}
}
 
Example 19
Source Project: EnderStorage   Source File: EnderStorage.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
    loadPersonalItem();
    disableVanillaEnderChest = config.getTag("disable-vanilla").setComment("Set to true to make the vanilla enderchest unplaceable.").getBooleanValue(true);
    removeVanillaRecipe = config.getTag("disable-vanilla_recipe").setComment("Set to true to make the vanilla enderchest uncraftable.").getBooleanValue(false);
    anarchyMode = config.getTag("anarchy-mode").setComment("Causes chests to lose personal settings and drop the diamond on break").getBooleanValue(false);

    EnderStorageManager.loadConfig(config);
    EnderStorageManager.registerPlugin(new EnderItemStoragePlugin());
    EnderStorageManager.registerPlugin(new EnderLiquidStoragePlugin());

    proxy.init();
}
 
Example 20
Source Project: NEI-Integration   Source File: NEIIntegration.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
    if (evt.getSide() != Side.CLIENT) {
        return;
    }
    
    log = evt.getModLog();
    log.info("Starting NEI Integration");
    
    integrations = Integrations.getIntegrations();
    Config.preInit(evt);
}
 
Example 21
Source Project: Ex-Aliquo   Source File: exaliquo.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	Configurations.Load(event.getModConfigurationDirectory());
	Registries.exatab = new ExATab("ExA");
	Registries.oretab = new ExAOreTab("ExAOres");
	Registries.registerItems();
	Registries.registerBlocks();
	Registries.registerRecipes();
	Registries.exatab.initTab(new ItemStack(Registries.crookGold, 1, 0));
	Registries.oretab.initTab(new ItemStack(Registries.cobaltOreItem, 1, 0));
	
	MinecraftForge.EVENT_BUS.register(new AliquoEvents());
	TickRegistry.registerTickHandler(new AliquoTickHandler(), Side.CLIENT);
}
 
Example 22
Source Project: Chisel-2   Source File: Chisel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event) {
	BlockNameConversion.init();

	for (MissingMapping m : event.get()) {
		// This bug was introduced along with Chisel 1.5.2, and was fixed in
		// 1.5.3.
		// Ice Stairs were called null.0-7 instead of other names, and
		// Marble/Limestone stairs did not exist.
		// This fixes the bug.
		if (m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
			m.warn();// (Action.WARN);
		}

		// Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs,
		// marbleStairs when loading an old (1.5.4) save
		else if (m.type == Type.BLOCK) {
			final Block block = BlockNameConversion.findBlock(m.name);

			if (block != null) {
				m.remap(block);
				FMLLog.getLogger().info("Remapping block " + m.name + " to " + General.getName(block));
			} else
				FMLLog.getLogger().warn("Block " + m.name + " could not get remapped.");
		} else if (m.type == Type.ITEM) {
			final Item item = BlockNameConversion.findItem(m.name);

			if (item != null) {
				m.remap(item);
				FMLLog.getLogger().info("Remapping item " + m.name + " to " + General.getName(item));

			} else
				FMLLog.getLogger().warn("Item " + m.name + " could not get remapped.");
		}
	}
}
 
Example 23
Source Project: Chisel-2   Source File: Chisel.java    License: GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	ChiselTabs.postInit();
	Compatibility.init(event);
	FMLLog.severe("Unable to lookup chisel:... is not an error, please do not treat it as such");
	FMLLog.bigWarning("In case you didn't see the red above I suggest you read it - Cricket");
}
 
Example 24
Source Project: SimplyJetpacks   Source File: SimplyJetpacks.java    License: MIT License 5 votes vote down vote up
@EventHandler
public static void preInit(FMLPreInitializationEvent evt) {
    logger = evt.getModLog();
    logger.info("Starting Simply Jetpacks");
    
    checkCoFHLib();
    
    Packs.preInit();
    Config.preInit(evt);
    ModItems.preInit();
}
 
Example 25
Source Project: SimplyJetpacks   Source File: SimplyJetpacks.java    License: MIT License 5 votes vote down vote up
@EventHandler
public static void init(FMLInitializationEvent evt) {
    RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped");
    proxy.registerHandlers();
    PacketHandler.init();
    ModItems.init();
    ModEnchantments.init();
}
 
Example 26
Source Project: NBTEdit   Source File: NBTEdit.java    License: GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event){
	ModMetadata modMeta = event.getModMetadata();
	modMeta.authorList = Arrays.asList(new String[] { "Davidee" });
	modMeta.autogenerated = false;
	modMeta.credits = "Thanks to Mojang, Forge, and all your support.";
	modMeta.description = "Allows you to edit NBT Tags in-game.\nPlease visit the URL above for help.";
	modMeta.url = "http://www.minecraftforum.net/topic/1558668-151/";
	
	
	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
	config.load();
	opOnly = config.get("General", "opOnly", true, "true if only Ops can NBTEdit; false allows users in creative mode to NBTEdit").getBoolean(true);
	config.save();
}
 
Example 27
Source Project: NBTEdit   Source File: NBTEdit.java    License: GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
	MinecraftServer server= event.getServer();
	ServerCommandManager serverCommandManager = (ServerCommandManager) server.getCommandManager();
	serverCommandManager.registerCommand(new CommandNBTEdit());
	logger.fine("Server Starting -- Added \"/nbtedit\" command");
}
 
Example 28
Source Project: Artifacts   Source File: DragonArtifacts.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void PostInit(FMLPostInitializationEvent event) 
{
	baublesLoaded = Loader.isModLoaded("Baubles");
	mystcraftLoaded = Loader.isModLoaded("Mystcraft");
	//System.out.println("[Artifacts] Is Baubles Loaded? " + baublesLoaded);
	//System.out.println("[Artifacts] Is Mystcraft Loaded? " + mystcraftLoaded);
}
 
Example 29
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    ElectroMagicTools.logger.info(localize("console.EMT.preInit.begin"));

    ConfigHandler.init(event.getSuggestedConfigurationFile());
    FMLCommonHandler.instance().bus().register(new EventHandlerEMT());
 ModuleRegistry.registerModules();
    EssentiasOutputs.addPrimalOutputs();
    EssentiasOutputs.addOutputs();

    ElectroMagicTools.logger.info(localize("console.EMT.preInit.end"));
}
 
Example 30
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    ElectroMagicTools.logger.info(localize("console.EMT.postInit.begin"));

 ModuleRegistry.registerLateModules();
    RegistryHandler.registerIc2PostRegistrys();

    ElectroMagicTools.logger.info(localize("console.EMT.postInit.end"));
}