• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FMLStateEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cpw.mods.fml.common.event.FMLStateEvent的典型用法代码示例。如果您正苦于以下问题:Java FMLStateEvent类的具体用法?Java FMLStateEvent怎么用?Java FMLStateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FMLStateEvent类属于cpw.mods.fml.common.event包,在下文中一共展示了FMLStateEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doStateCallback

import cpw.mods.fml.common.event.FMLStateEvent; //导入依赖的package包/类
@Subscribe
public void doStateCallback(FMLStateEvent event) {
	synchronized (SevenCommons.class) {
		if (stateCallbacks != null) {
			List<Runnable> list = stateCallbacks.remove(event.getModState());
			if (list != null) {
				for (Runnable runnable : list) {
					runnable.run();
				}
			}
			reachedStates.add(event.getModState());
			if (event.getModState() == LoaderState.ModState.POSTINITIALIZED) {
				stateCallbacks = null;
				reachedStates = null;
			}
		}
	}
}
 
开发者ID:diesieben07,项目名称:SevenCommons,代码行数:19,代码来源:SevenCommons.java


示例2: sendEventToModContainer

import cpw.mods.fml.common.event.FMLStateEvent; //导入依赖的package包/类
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.ERROR, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    ThreadContext.put("mod", modId);
    FMLLog.log(modId, Level.TRACE, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.TRACE, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    ThreadContext.remove("mod");
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:34,代码来源:LoadController.java


示例3: propagate

import cpw.mods.fml.common.event.FMLStateEvent; //导入依赖的package包/类
/**
 * Propagates an FMLStateEvent to all modules
 * @param event The event
 */
public static void propagate(FMLStateEvent event) {
	for (IModule m : modules)
		if (event instanceof FMLPreInitializationEvent)
			m.preInit((FMLPreInitializationEvent) event);
		else if (event instanceof FMLInitializationEvent)
			m.init((FMLInitializationEvent) event);
		else
			m.postInit((FMLPostInitializationEvent) event);
}
 
开发者ID:austinv11,项目名称:CollectiveFramework,代码行数:14,代码来源:Modules.java


示例4: handle

import cpw.mods.fml.common.event.FMLStateEvent; //导入依赖的package包/类
public void handle(FMLStateEvent event) {
  RegisterTime time = RegisterTime.timeFor(event);
  state = time;
  for (Registration r : compatMap.keySet()) {
    if (ArrayUtils.contains(r.times, time) && allModsLoaded(r.modids)) {
      doLoad(compatMap.get(r));
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:10,代码来源:CompatRegistry.java


示例5: sendEventToModContainer

import cpw.mods.fml.common.event.FMLStateEvent; //导入依赖的package包/类
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)
{
    String modId = mc.getModId();
    Collection<String> requirements =  Collections2.transform(mc.getRequirements(),new ArtifactVersionNameFunction());
    for (ArtifactVersion av : mc.getDependencies())
    {
        if (av.getLabel()!= null && requirements.contains(av.getLabel()) && modStates.containsEntry(av.getLabel(),ModState.ERRORED))
        {
            FMLLog.log(modId, Level.SEVERE, "Skipping event %s and marking errored mod %s since required dependency %s has errored", stateEvent.getEventType(), modId, av.getLabel());
            modStates.put(modId, ModState.ERRORED);
            return;
        }
    }
    activeContainer = mc;
    stateEvent.applyModContainer(activeContainer());
    FMLLog.log(modId, Level.FINEST, "Sending event %s to mod %s", stateEvent.getEventType(), modId);
    eventChannels.get(modId).post(stateEvent);
    FMLLog.log(modId, Level.FINEST, "Sent event %s to mod %s", stateEvent.getEventType(), modId);
    activeContainer = null;
    if (stateEvent instanceof FMLStateEvent)
    {
        if (!errors.containsKey(modId))
        {
            modStates.put(modId, ((FMLStateEvent)stateEvent).getModState());
        }
        else
        {
            modStates.put(modId, ModState.ERRORED);
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:32,代码来源:LoadController.java



注:本文中的cpw.mods.fml.common.event.FMLStateEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceRecord类代码示例发布时间:2022-05-23
下一篇:
Java NioSctpChannel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap