java类cpw.mods.fml.common.event.FMLConstructionEvent的实例源码

FanEventHandler.java 文件源码 项目:ThermosRebased 阅读 19 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(final FMLConstructionEvent event) {
    try {
        final ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(this.mContainer.getSource());
        modClassLoader.clearNegativeCacheFor(this.mCandidate.getClassList());
        NetworkRegistry.INSTANCE.register(this.mContainer, (Class)this.mContainer.getClass(), (String)null, event.getASMHarvestedData());
        Injector.inject(this.mMod, Injector.Phase.Construct, FMLCommonHandler.instance().getSide());
    }
    catch (Throwable e) {
        throw new IllegalStateException("Cannot construct fan", e);
    }
}
LLModContainer.java 文件源码 项目:LambdaLib 阅读 23 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(FMLConstructionEvent event) {
    log.info("LambdaLib|Core is loading.");

    // Get annotation information from forge asm data table.
    // This must be done before PreInit stage.
    ASMDataTable data = event.getASMHarvestedData();

    Set<String> removedClasses = Sets.newHashSet();
    { // Get removed classes
        String startupSide = FMLCommonHandler.instance().getSide().toString();
        Set<ASMData> sideData = data.getAll("cpw.mods.fml.relauncher.SideOnly");
        for (ASMData ad : sideData) if (ad.getClassName().equals(ad.getObjectName())) { // If is a class
            EnumHolder enumHolder = (EnumHolder) ad.getAnnotationInfo().get("value");
            try {
                String value = (String) ehFieldValue.get(enumHolder);
                if (!value.equals(startupSide)) {
                    removedClasses.add(ad.getClassName());
                }
            } catch (IllegalAccessException ex) {
                throw Throwables.propagate(ex);
            }
        }
    }

    LLModContainer.removedClasses.addAll(removedClasses);

    Set<String> registrants = mapToClass(data.getAll("cn.lambdalib.annoreg.core.Registrant"));
    registrants.removeAll(removedClasses);
    RegistrationManager.INSTANCE.annotationList(registrants);

    Set<String> registryTypes = mapToClass(data.getAll("cn.lambdalib.annoreg.core.RegistryTypeDecl"));
    registryTypes.removeAll(removedClasses);
    RegistrationManager.INSTANCE.addRegistryTypes(registryTypes);

    Set<String> registryMods = mapToClass(data.getAll("cn.lambdalib.annoreg.core.RegistrationMod"));
    registryMods.removeAll(removedClasses);
    RegistrationManager.INSTANCE.addAnnotationMod(registryMods);
}
BetterLoadingScreen.java 文件源码 项目:BetterLoadingScreen_1.7 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
public void construct(FMLConstructionEvent event) {
    ModLoadingListener thisListener = null;
    for (ModContainer mod : Loader.instance().getActiveModList()) {
        if (mod instanceof FMLModContainer) {
            EventBus bus = null;
            try {
                // Its a bit questionable to be changing FML itself, but reflection is better than ASM transforming
                // forge
                Field f = FMLModContainer.class.getDeclaredField("eventBus");
                f.setAccessible(true);
                bus = (EventBus) f.get(mod);
            }
            catch (Throwable t) {
                t.printStackTrace();
            }
            if (bus != null) {
                if (mod.getModId().equals(Lib.Mod.ID)) {
                    thisListener = new ModLoadingListener(mod);
                    bus.register(thisListener);
                }
                else
                    bus.register(new ModLoadingListener(mod));
            }
        }
    }
    if (thisListener != null)
        ModLoadingListener.doProgress(State.CONSTRUCT, thisListener);
}
EventDebug.java 文件源码 项目:EventDebug 阅读 21 收藏 0 点赞 0 评论 0
@EventHandler
public void construct(FMLConstructionEvent evt) {
    MinecraftForge.EVENT_BUS.register(collector.createProbe("FORGE-EVENT"));
    MinecraftForge.ORE_GEN_BUS.register(collector.createProbe("FORGE-ORE"));
    MinecraftForge.TERRAIN_GEN_BUS.register(collector.createProbe("FORGE-TERRAIN"));
    FMLCommonHandler.instance().bus().register(collector.createProbe("FML"));
}
CommonProxy.java 文件源码 项目:Config-Patcher 阅读 39 收藏 0 点赞 0 评论 0
public void construct(FMLConstructionEvent event) {
    this.directoryMain = Loader.instance().getConfigDir();

    final File configFile = new File(this.directoryMain, Reference.MODID + ".cfg");
    ConfigurationHandler.init(configFile);

    this.directoryOverride = FileHelper.getCanonicalFile(this.directoryMain.getParentFile(), this.directoryMain.getName() + "-override");

    if (ConfigurationHandler.shouldPatch()) {
        new Patch(this.directoryMain, this.directoryOverride).execute();
    } else if (ConfigurationHandler.generate) {
        this.directoryBase = FileHelper.getCanonicalFile(this.directoryMain.getParentFile(), this.directoryMain.getName() + "-base");
        this.directoryDiff = FileHelper.getCanonicalFile(this.directoryOverride, "auto-generated");
    }
}
ModLoaderModContainer.java 文件源码 项目:RuneCraftery 阅读 22 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(FMLConstructionEvent event)
{
    try
    {
        ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(modSource);
        EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
        this.gameTickHandler = new BaseModTicker(ticks, false);
        this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
        Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
        configureMod(modClazz, event.getASMHarvestedData());
        isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
        ModLoaderNetworkHandler dummyHandler = null;
        if (!isNetworkMod)
        {
            FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
            dummyHandler = new ModLoaderNetworkHandler(this);
            FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
        }
        Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
        ctor.setAccessible(true);
        mod = modClazz.newInstance();
        if (dummyHandler != null)
        {
            dummyHandler.setBaseMod(mod);
        }
        ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter());
    }
    catch (Exception e)
    {
        controller.errorOccurred(this, e);
        Throwables.propagateIfPossible(e);
    }
}
ModLoaderModContainer.java 文件源码 项目:RuneCraftery 阅读 26 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(FMLConstructionEvent event)
{
    try
    {
        ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(modSource);
        EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
        this.gameTickHandler = new BaseModTicker(ticks, false);
        this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
        Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
        configureMod(modClazz, event.getASMHarvestedData());
        isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
        ModLoaderNetworkHandler dummyHandler = null;
        if (!isNetworkMod)
        {
            FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
            dummyHandler = new ModLoaderNetworkHandler(this);
            FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
        }
        Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
        ctor.setAccessible(true);
        mod = modClazz.newInstance();
        if (dummyHandler != null)
        {
            dummyHandler.setBaseMod(mod);
        }
        ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter());
    }
    catch (Exception e)
    {
        controller.errorOccurred(this, e);
        Throwables.propagateIfPossible(e);
    }
}
ForgeDummyContainer.java 文件源码 项目:RuneCraftery 阅读 32 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    FMLLog.info("Registering Forge Packet Handler");
    try
    {
        FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
        FMLLog.info("Succeeded registering Forge Packet Handler");
    }
    catch (Exception e)
    {
        FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
    }
}
ForgeDummyContainer.java 文件源码 项目:RuneCraftery 阅读 19 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    FMLLog.info("Registering Forge Packet Handler");
    try
    {
        FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
        FMLLog.info("Succeeded registering Forge Packet Handler");
    }
    catch (Exception e)
    {
        FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
    }
}
ModLoaderModContainer.java 文件源码 项目:BetterNutritionMod 阅读 22 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(FMLConstructionEvent event)
{
    try
    {
        ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(modSource);
        EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
        this.gameTickHandler = new BaseModTicker(ticks, false);
        this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
        Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
        configureMod(modClazz, event.getASMHarvestedData());
        isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
        ModLoaderNetworkHandler dummyHandler = null;
        if (!isNetworkMod)
        {
            FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
            dummyHandler = new ModLoaderNetworkHandler(this);
            FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
        }
        Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
        ctor.setAccessible(true);
        mod = modClazz.newInstance();
        if (dummyHandler != null)
        {
            dummyHandler.setBaseMod(mod);
        }
        ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter());
    }
    catch (Exception e)
    {
        controller.errorOccurred(this, e);
        Throwables.propagateIfPossible(e);
    }
}
ForgeDummyContainer.java 文件源码 项目:BetterNutritionMod 阅读 24 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    FMLLog.info("Registering Forge Packet Handler");
    try
    {
        FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
        FMLLog.info("Succeeded registering Forge Packet Handler");
    }
    catch (Exception e)
    {
        FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
    }
}
OpenPeripheralCore.java 文件源码 项目:OpenPeripheral 阅读 23 收藏 0 点赞 0 评论 0
@Mod.EventHandler
public void construct(FMLConstructionEvent evt) {
    ArchitectureChecker.INSTANCE.register(Constants.ARCH_COMPUTER_CRAFT, new ComputerCraftChecker());
    ArchitectureChecker.INSTANCE.register(Constants.ARCH_OPEN_COMPUTERS, new OpenComputersChecker());

    apiSetup.setupApis();
    apiSetup.installProviderAccess();

    if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.init();
    if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.init();
}
SPDummyContainer.java 文件源码 项目:Sound-Physics 阅读 21 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent event)
{

}
ThaumOresMod.java 文件源码 项目:ThaumOres 阅读 17 收藏 0 点赞 0 评论 0
@EventHandler
public void constr(FMLConstructionEvent event) {
    this.initHandler.findModules(event);
}
FMLContainer.java 文件源码 项目:TRHS_Club_Mod_2016 阅读 25 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), null, evt.getASMHarvestedData());
    FMLNetworkHandler.registerChannel(this, evt.getSide());
}
ForgeModContainer.java 文件源码 项目:TRHS_Club_Mod_2016 阅读 20 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
    ForgeNetworkHandler.registerChannel(this, evt.getSide());
}
ImagineModContainer.java 文件源码 项目:ThermosRebased 阅读 21 收藏 0 点赞 0 评论 0
@Subscribe
public void constructMod(final FMLConstructionEvent event) {
    Injector.inject(this, Injector.Phase.Construct, new Object[0]);
    FanLoader.migrate(FanLoader.State.Loaded);
}
RorysModCore.java 文件源码 项目:RorysMod 阅读 23 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt) {}
DummyContainer.java 文件源码 项目:CollectiveFramework 阅读 22 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent event) {
    loader = event.getModClassLoader();
}
ModLoadingListener.java 文件源码 项目:BetterLoadingScreen_1.7 阅读 18 收藏 0 点赞 0 评论 0
@Subscribe
public void construct(FMLConstructionEvent event) {
    doProgress(State.CONSTRUCT, this);
}
FMLContainer.java 文件源码 项目:CauldronGit 阅读 28 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), null, evt.getASMHarvestedData());
    FMLNetworkHandler.registerChannel(this, evt.getSide());
}
ForgeModContainer.java 文件源码 项目:CauldronGit 阅读 21 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
    ForgeNetworkHandler.registerChannel(this, evt.getSide());
}
ModContainer.java 文件源码 项目:AdvancedRocketry 阅读 22 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void modConstruction(FMLConstructionEvent event) {}
ConfigPatcher.java 文件源码 项目:Config-Patcher 阅读 20 收藏 0 点赞 0 评论 0
@Mod.EventHandler
public void construct(final FMLConstructionEvent event) {
    proxy.construct(event);
}
Gadomancy.java 文件源码 项目:Gadomancy 阅读 22 收藏 0 点赞 0 评论 0
@Mod.EventHandler
public void onConstruct(FMLConstructionEvent event) {
    GadomancyApi.setInstance(new DefaultApiHandler());
    proxy.onConstruct();
}
Helper.java 文件源码 项目:Helper-API 阅读 31 收藏 0 点赞 0 评论 0
@EventHandler
public void modConstructing(FMLConstructionEvent event)
{

}
FMLContainer.java 文件源码 项目:Cauldron 阅读 27 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), null, evt.getASMHarvestedData());
    FMLNetworkHandler.registerChannel(this, evt.getSide());
}
ForgeModContainer.java 文件源码 项目:Cauldron 阅读 29 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
    ForgeNetworkHandler.registerChannel(this, evt.getSide());
}
FMLContainer.java 文件源码 项目:Cauldron 阅读 30 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), null, evt.getASMHarvestedData());
    FMLNetworkHandler.registerChannel(this, evt.getSide());
}
ForgeModContainer.java 文件源码 项目:Cauldron 阅读 19 收藏 0 点赞 0 评论 0
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
    ForgeNetworkHandler.registerChannel(this, evt.getSide());
}


问题


面经


文章

微信
公众号

扫码关注公众号