Search in sources :

Example 31 with EventHandler

use of net.minecraftforge.fml.common.Mod.EventHandler in project Geolosys by oitsjustjose.

the class Geolosys method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    LOGGER = event.getModLog();
    MinecraftForge.EVENT_BUS.register(new Config(event.getSuggestedConfigurationFile()));
    configOres = getOresConfig(event.getModConfigurationDirectory());
    clientRegistry = new ClientRegistry();
    MinecraftForge.EVENT_BUS.register(clientRegistry);
    chunkOreGen = new ChunkData();
    userStates = new ArrayList<>();
    ORE = new BlockOre();
    ORE_VANILLA = new BlockOreVanilla();
    ORE_SAMPLE = new BlockSample();
    ORE_SAMPLE_VANILLA = new BlockSampleVanilla();
    CLUSTER = new ItemCluster();
    ALMANAC = new ItemFieldManual();
    if (Config.getInstance().enableIngots) {
        INGOT = new ItemIngot();
    }
    if (Config.getInstance().enableCoals) {
        COAL = new ItemCoal();
    }
    if (Config.getInstance().enableProPick) {
        PRO_PICK = new ItemProPick();
    }
    registerGeolosysOreGen();
    registerVanillaOreGen();
}
Also used : ChunkData(com.oitsjustjose.geolosys.world.ChunkData) BlockOre(com.oitsjustjose.geolosys.blocks.BlockOre) BlockSample(com.oitsjustjose.geolosys.blocks.BlockSample) BlockOreVanilla(com.oitsjustjose.geolosys.blocks.BlockOreVanilla) BlockSampleVanilla(com.oitsjustjose.geolosys.blocks.BlockSampleVanilla) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Example 32 with EventHandler

use of net.minecraftforge.fml.common.Mod.EventHandler in project malmo by Microsoft.

the class MalmoMod method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    if (!SchemaHelper.testSchemaVersionNumbers(Loader.instance().activeModContainer().getVersion()))
        throw new RuntimeException("This mod has been incorrectly built; check schema version numbers.");
    if (event.getModMetadata().version.equals("${version}")) {
        // The mcmod.info version number is populated by gradle; if we've been built without gradle,
        // via eclipse say, then we can just use the internal version number instead, which comes to us from the version.properties file.
        // (There's no real benefit to doing this; it just looks nicer in the Mod GUI if the version number is filled in.)
        event.getModMetadata().version = Loader.instance().activeModContainer().getVersion();
    }
    // Load the correct configs (client or server)
    File configDir = event.getModConfigurationDirectory();
    File sessionConfigFile = new File(configDir, MODID + event.getSide().toString() + ".cfg");
    File permanentConfigFile = new File(configDir, MODID + event.getSide().toString() + "Permanent.cfg");
    this.sessionConfig = new Configuration(sessionConfigFile);
    this.sessionConfig.load();
    this.permanentConfig = new Configuration(permanentConfigFile);
    this.permanentConfig.load();
    AddressHelper.update(this.sessionConfig);
    ScreenHelper.update(this.permanentConfig);
    TCPUtils.update(this.permanentConfig);
    network = NetworkRegistry.INSTANCE.newSimpleChannel("Malmo");
    network.registerMessage(ObservationFromFullStatsImplementation.FullStatsRequestMessageHandler.class, ObservationFromFullStatsImplementation.FullStatsRequestMessage.class, 1, Side.SERVER);
    network.registerMessage(ObservationFromGridImplementation.GridRequestMessageHandler.class, ObservationFromGridImplementation.GridRequestMessage.class, 2, Side.SERVER);
    // Malmo messages from server to client
    network.registerMessage(MalmoMessageHandler.class, MalmoMessage.class, 3, Side.CLIENT);
    network.registerMessage(SimpleCraftCommandsImplementation.CraftMessageHandler.class, SimpleCraftCommandsImplementation.CraftMessage.class, 4, Side.SERVER);
    network.registerMessage(AbsoluteMovementCommandsImplementation.TeleportMessageHandler.class, AbsoluteMovementCommandsImplementation.TeleportMessage.class, 5, Side.SERVER);
    // Malmo messages from client to server
    network.registerMessage(MalmoMessageHandler.class, MalmoMessage.class, 6, Side.SERVER);
    network.registerMessage(InventoryCommandsImplementation.InventoryMessageHandler.class, InventoryCommandsImplementation.InventoryMessage.class, 7, Side.SERVER);
    network.registerMessage(DiscreteMovementCommandsImplementation.UseActionMessageHandler.class, DiscreteMovementCommandsImplementation.UseActionMessage.class, 8, Side.SERVER);
    network.registerMessage(DiscreteMovementCommandsImplementation.AttackActionMessageHandler.class, DiscreteMovementCommandsImplementation.AttackActionMessage.class, 9, Side.SERVER);
    network.registerMessage(ObservationFromFullInventoryImplementation.InventoryRequestMessageHandler.class, ObservationFromFullInventoryImplementation.InventoryRequestMessage.class, 10, Side.SERVER);
    network.registerMessage(InventoryCommandsImplementation.InventoryChangeMessageHandler.class, InventoryCommandsImplementation.InventoryChangeMessage.class, 11, Side.CLIENT);
    network.registerMessage(ObservationFromSystemImplementation.SystemRequestMessageHandler.class, ObservationFromSystemImplementation.SystemRequestMessage.class, 12, Side.SERVER);
}
Also used : ObservationFromGridImplementation(com.microsoft.Malmo.MissionHandlers.ObservationFromGridImplementation) ObservationFromFullInventoryImplementation(com.microsoft.Malmo.MissionHandlers.ObservationFromFullInventoryImplementation) Configuration(net.minecraftforge.common.config.Configuration) AbsoluteMovementCommandsImplementation(com.microsoft.Malmo.MissionHandlers.AbsoluteMovementCommandsImplementation) InventoryCommandsImplementation(com.microsoft.Malmo.MissionHandlers.InventoryCommandsImplementation) ObservationFromFullStatsImplementation(com.microsoft.Malmo.MissionHandlers.ObservationFromFullStatsImplementation) ObservationFromSystemImplementation(com.microsoft.Malmo.MissionHandlers.ObservationFromSystemImplementation) File(java.io.File) SimpleCraftCommandsImplementation(com.microsoft.Malmo.MissionHandlers.SimpleCraftCommandsImplementation) DiscreteMovementCommandsImplementation(com.microsoft.Malmo.MissionHandlers.DiscreteMovementCommandsImplementation) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Example 33 with EventHandler

use of net.minecraftforge.fml.common.Mod.EventHandler in project MorePlanets by SteveKunG.

the class MorePlanetsCore method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    ConfigManagerMP.init(new File(event.getModConfigurationDirectory(), "MorePlanets.cfg"));
    MorePlanetsCore.initModInfo(event.getModMetadata());
    MorePlanetsCore.BLOCK_TAB = new CreativeTabsMP("MorePlanetsBlocks");
    MorePlanetsCore.ITEM_TAB = new CreativeTabsMP("MorePlanetsItems");
    MPBlocks.init();
    MPItems.init();
    MPEntities.init();
    MPPlanets.init();
    MPPotions.init();
    MPBiomes.init();
    MPOthers.init();
    MorePlanetsCore.PROXY.registerPreRendering();
}
Also used : CreativeTabsMP(stevekung.mods.moreplanets.util.CreativeTabsMP) File(java.io.File) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Aggregations

EventHandler (net.minecraftforge.fml.common.Mod.EventHandler)33 ItemStack (net.minecraft.item.ItemStack)5 Configuration (net.minecraftforge.common.config.Configuration)5 File (java.io.File)3 ForgeEventHandler (net.geforcemods.securitycraft.handlers.ForgeEventHandler)3 BookshelfEvents (net.darkhax.bookshelf.BookshelfEvents)2 ChestBuilder (net.darkhax.bookshelf.builder.ChestBuilder)2 RegistryHelper (net.darkhax.bookshelf.registry.RegistryHelper)2 TeleportEventHandler (net.dyeo.teleporter.event.TeleportEventHandler)2 CommandModule (net.geforcemods.securitycraft.commands.CommandModule)2 CommandSC (net.geforcemods.securitycraft.commands.CommandSC)2 Block (net.minecraft.block.Block)2 ItemBlock (net.minecraft.item.ItemBlock)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ModMetadata (net.minecraftforge.fml.common.ModMetadata)2 WorldTypeMessageEventHandler (rtg.event.WorldTypeMessageEventHandler)2 ControlGUIHandler (ValkyrienWarfareControl.GUI.ControlGUIHandler)1 ValkyrienWarfareWorldGen (ValkyrienWarfareWorld.WorldGen.ValkyrienWarfareWorldGen)1 GuiHandler (betterwithaddons.client.GuiHandler)1 ModConfiguration (betterwithaddons.config.ModConfiguration)1