当前位置: 首页>>代码示例>>Java>>正文


Java EventBus类代码示例

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


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

示例1: getBusID

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
private int getBusID(EventBus a) {
    try {
        Field declaredField = EventBus.class.getDeclaredField("busID");
        declaredField.setAccessible(true);
        return declaredField.getInt(a);
    } catch (Exception ex) {
        return 0;
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:10,代码来源:Dispatcher.java

示例2: fireNetRegistrationEvent

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
@Override
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
{
    if (side == Side.CLIENT)
    {
        waitForPlayClient();
        bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayClient>(manager, channelSet, channel, side, NetHandlerPlayClient.class));
    }
    else
    {
        bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayServer>(manager, channelSet, channel, side, NetHandlerPlayServer.class));
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:14,代码来源:FMLClientHandler.java

示例3: MEItemAspectBridgeContainer

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
/**
 * Constructs a pseudo container that TC can use to 'see' the items in the
 * ME network.
 *
 * @param inventorySize
 * @throws Exception
 * When the TC rendering code can not be found, the bridge will not
 * construct.
 */
public MEItemAspectBridgeContainer( final int inventorySize ) throws Exception
{
	// Create the inventory
	this.internalInventory = new TheInternalInventory( "TC Inventory Bridge", inventorySize, 1 );

	// Have we hooked to TC's event handler?
	if( thaumcraftClientEvents.get() == null )
	{
		// Access the listenerOwners field
		Field loField = EventBus.class.getDeclaredField( "listenerOwners" );
		loField.setAccessible( true );

		// Get the owners
		Map<Object, ModContainer> owners = (Map<Object, ModContainer>)loField.get( FMLCommonHandler.instance().bus() );

		// Attempt to locate TC's event handler
		for( Entry<Object, ModContainer> set : owners.entrySet() )
		{
			Object Owner = set.getKey();

			if( Owner instanceof thaumcraft.client.lib.ClientTickEventsFML )
			{
				thaumcraftClientEvents = new WeakReference<ClientTickEventsFML>( (ClientTickEventsFML)Owner );
				break;
			}
		}

		// Get rid of the references, cause I'm paranoid.
		owners = null;
		loField = null;

		// Did we locate it?
		if( thaumcraftClientEvents == null )
		{
			throw new Exception( "Unable to find TC event handler" );
		}
	}

}
 
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:49,代码来源:MEItemAspectBridgeContainer.java

示例4: register

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
public void register(IEventListener listener, EventBus bus, Class<? extends Event> clazz) {
    try {
        clazz.newInstance().getListenerList().register(getBusID(bus), EventPriority.NORMAL, listener);
    } catch (Exception e) {
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:7,代码来源:Dispatcher.java

示例5: unregister

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
public void unregister(IEventListener listener, EventBus bus, Class<? extends Event> clazz) {
    try {
        clazz.newInstance().getListenerList().unregister(getBusID(bus), listener);
    } catch (Exception e) {
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:7,代码来源:Dispatcher.java

示例6: fireNetRegistrationEvent

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
@Override
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
{
    bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayServer>(manager, channelSet, channel, side, NetHandlerPlayServer.class));
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:6,代码来源:FMLServerHandler.java

示例7: FMLEventChannel

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
FMLEventChannel(String name)
{
    this.channels = NetworkRegistry.INSTANCE.newChannel(name, new NetworkEventFiringHandler(this));
    this.eventBus = new EventBus();
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:6,代码来源:FMLEventChannel.java

示例8: HandlerType

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
private HandlerType(String eventIdentifier, EventBus bus) {
  this.eventIdentifier = eventIdentifier;
  this.bus = bus;
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:5,代码来源:Handlers.java

示例9: listen

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
public void listen(EventBus eventBus)
{
    eventBus.register(this);
}
 
开发者ID:MinecraftModArchive,项目名称:KoreSample,代码行数:5,代码来源:ForgeEventListener.java

示例10: registerEventHandlers

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
@Override
public void registerEventHandlers(EventBus bus) {
	MinecraftForge.EVENT_BUS.register(DrawBlockHighlightEventHandler.getInstance());
}
 
开发者ID:AtomicBlom,项目名称:RobotPlates,代码行数:5,代码来源:ClientProxy.java

示例11: bus

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
/**
 * The FML event bus. Subscribe here for FML related events
 *
 * @return the event bus
 */
public EventBus bus()
{
    return eventBus;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:10,代码来源:FMLCommonHandler.java

示例12: registerEventHandlers

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
@Override
public void registerEventHandlers(EventBus bus) {


	bus.register(TickEventHandler.getInstance());
}
 
开发者ID:AtomicBlom,项目名称:RobotPlates,代码行数:7,代码来源:ServerProxy.java

示例13: fireNetRegistrationEvent

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side); 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:2,代码来源:IFMLSidedHandler.java

示例14: registerEventHandlers

import cpw.mods.fml.common.eventhandler.EventBus; //导入依赖的package包/类
void registerEventHandlers(EventBus bus); 
开发者ID:AtomicBlom,项目名称:RobotPlates,代码行数:2,代码来源:IProxy.java


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