Java Code Examples for net.minecraftforge.fml.common.event.FMLPreInitializationEvent#getModLog()

The following examples show how to use net.minecraftforge.fml.common.event.FMLPreInitializationEvent#getModLog() . 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 check out the related API usage on the sidebar.
Example 1
Source File: CustomMainMenu.java    From Custom-Main-Menu with MIT License 7 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	configFolder = event.getModConfigurationDirectory();
	config = new Config();
	// Load Transparent
	transparentTexture = new ResourceLocation("custommainmenu:textures/gui/transparent.png");

	EVENT_HANDLER = new CMMEventHandler();
	MinecraftForge.EVENT_BUS.register(EVENT_HANDLER);
	FMLCommonHandler.instance().bus().register(EVENT_HANDLER);

	logger = event.getModLog();

	configLoader = new ConfigurationLoader(config);

	try
	{
		configLoader.load();
	}
	catch (Exception e)
	{
		logger.log(Level.ERROR, "Error while loading config file. Will have to crash here :(.");
		throw new RuntimeException(e);
	}
}
 
Example 2
Source File: GTMod.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public synchronized void preInit(FMLPreInitializationEvent event) {
	logger = event.getModLog();
	proxy.preInit(event);
	logger.info("Hello from GregTech Classic!");
	GTBlocks.registerTiles();
	GTMaterialGen.initFlags();
	GTMaterialGen.init();
	GTBlocks.registerBlocks();
	GTItems.initItems();
	GTItems.registerItems();
	GTCrops.init();
	GTOreDict.init();
	GTEventLootTableLoad.init();
	MinecraftForge.EVENT_BUS.register(GTSounds.class);
}
 
Example 3
Source File: TofuMain.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit(event);

    logger = event.getModLog();

    TofuEntityRegister.entitySpawn();

    TofuCompat.preInit();

    GameRegistry.registerWorldGenerator(new TofuOreGenerator(), 0);

    MapGenStructureIO.registerStructure(MapGenTofuVillage.Start.class,"TofuVillage");
    StructureTofuVillagePieces.registerVillagePieces();
    MapGenStructureIO.registerStructure(StructureTofuMineshaftStart.class,"TofuMineshaft");
    StructureTofuMineshaftPieces.registerStructurePieces();
    MapGenStructureIO.registerStructure(MapGenTofuCastle.Start.class, "TofuCastle");
    TofuCastlePiece.registerTofuCastlePiece();

    NetworkRegistry.INSTANCE.registerGuiHandler(this, new TofuGuiHandler());


    zunda = new DamageSource("zunda") {
        @Override
        public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn) {
            String s = "death.attack.zunda";
            String s1 = s + ".player";

            return new TextComponentString(entityLivingBaseIn.getDisplayName().getFormattedText() + " ").appendSibling(new TextComponentTranslation(s1, new Object[]{entityLivingBaseIn.getDisplayName()}));
        }
    }.setDamageIsAbsolute();

    TOFU_DIMENSION = DimensionType.register("Tofu World", "_tofu", TofuConfig.dimensionID, WorldProviderTofu.class, false);
    DimensionManager.registerDimension(TofuConfig.dimensionID, TOFU_DIMENSION);

    TofuVillages.register();
}
 
Example 4
Source File: CommonProxy.java    From Minecoprocessors with GNU General Public License v3.0 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent e) {
  logger = e.getModLog();
  int packetId = 0;
  MessageEnableGuiUpdates.init(packetId++);
  MessageProcessorUpdate.init(packetId++);
  MessageProcessorAction.init(packetId++);
  MessageBookCodeData.init(packetId++);
  TileEntityMinecoprocessor.init();
  MinecoprocessorGuiHandler.init();
}
 
Example 5
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 6
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 7
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 8
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 9
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 10
Source File: TestGenerator.java    From simpleretrogen with GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent init)
{
    final Logger modLog = init.getModLog();
    IWorldGenerator gen = new IWorldGenerator() {
        @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
        {
            modLog.log(Level.INFO, "Calling!");
        }
    };
    GameRegistry.registerWorldGenerator(gen, 10);
}
 
Example 11
Source File: WearableBackpacks.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	LOG = event.getModLog();
	CHANNEL = new BackpacksChannel();
	
	CONFIG = new BackpacksConfig(event.getSuggestedConfigurationFile());
	CONFIG.load();
	CONFIG.save();
	
	CONTENT = new BackpacksContent();
	CONTENT.registerRecipes();
	
	PROXY.preInit();
}
 
Example 12
Source File: HoloInventory.java    From HoloInventory with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    updateConfig();

    int id = 0;
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);

    // Request packets (client -> server)
    snw.registerMessage(EntityRequest.Handler.class, EntityRequest.class, id++, Side.SERVER);
    snw.registerMessage(TileRequest.Handler.class, TileRequest.class, id++, Side.SERVER);

    // Response packets (server -> client)
    snw.registerMessage(PlainInventory.Handler.class, PlainInventory.class, id++, Side.CLIENT);
    snw.registerMessage(MerchantRecipes.Handler.class, MerchantRecipes.class, id++, Side.CLIENT);

    if (event.getSide().isClient())
    {
        //noinspection MethodCallSideOnly
        ClientEventHandler.init();
    }

    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(ServerEventHandler.I);
}
 
Example 13
Source File: SakuraMain.java    From Sakura_mod with MIT License 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit(event);
    logger = event.getModLog();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new SakuraGuiHandler());
}
 
Example 14
Source File: EmergingTechnology.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
  logger = event.getModLog();
  proxy.preInit(event);
}
 
Example 15
Source File: LogisticsPipes2.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
	logger = event.getModLog();
	MinecraftForge.EVENT_BUS.register(new EventManager());
	proxy.preInit(event);
}
 
Example 16
Source File: CommonProxy.java    From LunatriusCore with MIT License 4 votes vote down vote up
public void preInit(final FMLPreInitializationEvent event) {
    Reference.logger = event.getModLog();

    FMLInterModComms.sendMessage(Reference.MODID, "checkUpdate", Reference.FORGE);
}