本文整理汇总了Java中net.minecraftforge.fml.common.eventhandler.IEventListener类的典型用法代码示例。如果您正苦于以下问题:Java IEventListener类的具体用法?Java IEventListener怎么用?Java IEventListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEventListener类属于net.minecraftforge.fml.common.eventhandler包,在下文中一共展示了IEventListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEventListeners
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<IEventListener> getEventListeners(World world){
if(eventlisteners.containsKey(world)) return eventlisteners.get(world);
try{
List<IEventListener> list = null;
for(Field field : World.class.getDeclaredFields()){
if(field.getType() == World.class){
field.setAccessible(true);
list = (List<IEventListener>) field.get(world);
break;
}
}
eventlisteners.put(world, list);
return list;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
开发者ID:tiffit,项目名称:TaleCraft,代码行数:21,代码来源:ReflectionUtil.java
示例2: fix
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
public static void fix() throws Exception
{
Field f = MinecraftForge.EVENT_BUS.getClass().getDeclaredField("listeners");
f.setAccessible(true);
ConcurrentHashMap<Object, ArrayList<IEventListener>> listeners = (ConcurrentHashMap<Object, ArrayList<IEventListener>>) f.get(MinecraftForge.EVENT_BUS);
for(Map.Entry<Object, ArrayList<IEventListener>> entry : listeners.entrySet())
{
if (entry.getKey().getClass().equals(SensitiveCode.class))
{
MinecraftForge.EVENT_BUS.unregister(entry.getKey());
Pixelmon.EVENT_BUS.unregister(entry.getKey());
SpawnerBase.SPAWN_DENIAL_BUS.unregister(entry.getKey());
return;
}
}
}
开发者ID:spyproof,项目名称:PixelmonTechnicFix,代码行数:17,代码来源:Main.java
示例3: OnPreInit
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@Override
public void OnPreInit(FMLPreInitializationEvent event)
{
checkNotNull(event, "event");
this.configuration.Initialize(event.getSuggestedConfigurationFile());
// Register all the new items
// (do this before registering the things that may depend on them)
ItemConfiguration itemConfiguration = this.configuration.GetItemConfiguration();
this.itemRegistrar.RegisterNewItems(itemConfiguration, this.itemRegistry);
// Register all the event handlers.
this.eventSubscriber.Initialize();
EventConfiguration eventConfiguration = this.configuration.GetEventConfiguration();
for (EventType eventType : eventConfiguration.GetRecognizedEventTypes())
{
for (IEventListener handler : eventConfiguration.GetEventHandlers(eventType))
{
this.eventSubscriber.SubscribeToEvent(eventType, handler);
}
}
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:23,代码来源:ModLifecycleManager.java
示例4: SubscribeToEvent
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@Override
public void SubscribeToEvent(EventType eventType, IEventListener handler)
{
checkNotNull(handler, "handler");
synchronized(this.eventListenerMap)
{
this.eventListenerMap.put(eventType, handler);
}
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:10,代码来源:ForgeEventSubscriber.java
示例5: OnLivingDropsEvent
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@SubscribeEvent
public void OnLivingDropsEvent(LivingDropsEvent event)
{
checkNotNull(event, "event");
for (IEventListener handler : eventListenerMap.get(EventType.LivingDrops))
{
handler.invoke(event);
}
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:10,代码来源:ForgeEventSubscriber.java
示例6: OnLivingUpdateEvent
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@SubscribeEvent
public void OnLivingUpdateEvent(LivingUpdateEvent event)
{
checkNotNull(event, "event");
for (IEventListener handler : eventListenerMap.get(EventType.LivingUpdate))
{
handler.invoke(event);
}
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:10,代码来源:ForgeEventSubscriber.java
示例7: OnEntityConstructingEvent
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@SubscribeEvent
public void OnEntityConstructingEvent(EntityConstructing event)
{
checkNotNull(event, "event");
for (IEventListener handler : eventListenerMap.get(EventType.EntityConstructing))
{
handler.invoke(event);
}
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:10,代码来源:ForgeEventSubscriber.java
示例8: getAllHandler
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
static IEventListener[] getAllHandler(Class<? extends Event> clazz, int busId) {
ListenerList list = ReflectionHelper.allocateInstance(clazz).getListenerList();
return list == null ? new IEventListener[0] : list.lists[busId].getListeners();
}
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:5,代码来源:EventHelper.java
示例9: GetEventHandlers
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
@Override
public Iterable<IEventListener> GetEventHandlers(EventType eventType)
{
return ImmutableList.of();
}
开发者ID:airbreather,项目名称:airbreathercore,代码行数:6,代码来源:EmptyEventConfiguration.java
示例10: GetEventHandlers
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
Iterable<IEventListener> GetEventHandlers(EventType eventType);
开发者ID:airbreather,项目名称:airbreathercore,代码行数:2,代码来源:EventConfiguration.java
示例11: SubscribeToEvent
import net.minecraftforge.fml.common.eventhandler.IEventListener; //导入依赖的package包/类
void SubscribeToEvent(EventType eventType, IEventListener handler);
开发者ID:airbreather,项目名称:airbreathercore,代码行数:2,代码来源:EventSubscriber.java
注:本文中的net.minecraftforge.fml.common.eventhandler.IEventListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论