public class FMLEventChannel
extends java.lang.Object
FMLNetworkEvent.CustomPacketEvent
and FMLNetworkEvent.CustomNetworkEvent
to deliver messages to an event listener. There is one "bus" for each channel, due to the
impossibility of filtering a bus for specific events.
This event driven system completely wraps the netty code. Mod code deals with FMLProxyPackets directly. It is not
possible to enhance the netty pipeline, and I would expect highly unexpected results if it were modified reflectively.
Use a real ChannelHandler if you want to use netty.Modifier and Type | Class and Description |
---|---|
private static class |
FMLEventChannel.EventFactory |
Modifier and Type | Field and Description |
---|---|
private java.util.EnumMap<Side,FMLEmbeddedChannel> |
channels |
private EventBus |
eventBus |
private static FMLEventChannel.EventFactory |
factory |
Constructor and Description |
---|
FMLEventChannel(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
fireRead(FMLProxyPacket msg,
io.netty.channel.ChannelHandlerContext ctx) |
void |
fireUserEvent(java.lang.Object evt,
io.netty.channel.ChannelHandlerContext ctx) |
void |
register(java.lang.Object object)
Register an event listener with this channel and bus.
|
void |
sendTo(FMLProxyPacket pkt,
EntityPlayerMP player)
Send to a specific player
|
void |
sendToAll(FMLProxyPacket pkt)
Send a packet to all on the server
|
void |
sendToAllAround(FMLProxyPacket pkt,
NetworkRegistry.TargetPoint point)
Send to all around a point
|
void |
sendToAllTracking(FMLProxyPacket pkt,
Entity entity)
Send to all tracking the entity
This is not equivalent to
sendToAllTracking(FMLProxyPacket, NetworkRegistry.TargetPoint)
because entities have different tracking distances based on their type. |
void |
sendToAllTracking(FMLProxyPacket pkt,
NetworkRegistry.TargetPoint point)
Send to all tracking the point
The
range field of the NetworkRegistry.TargetPoint is ignored. |
void |
sendToDimension(FMLProxyPacket pkt,
int dimensionId)
Send to all in a dimension
|
void |
sendToServer(FMLProxyPacket pkt)
Send to the server
|
void |
unregister(java.lang.Object object)
Unregister an event listener from the bus.
|
private java.util.EnumMap<Side,FMLEmbeddedChannel> channels
private EventBus eventBus
private static FMLEventChannel.EventFactory factory
public void register(java.lang.Object object)
SubscribeEvent
object
- public void unregister(java.lang.Object object)
object
- void fireRead(FMLProxyPacket msg, io.netty.channel.ChannelHandlerContext ctx)
public void fireUserEvent(java.lang.Object evt, io.netty.channel.ChannelHandlerContext ctx)
public void sendToAll(FMLProxyPacket pkt)
pkt
- public void sendTo(FMLProxyPacket pkt, EntityPlayerMP player)
pkt
- player
- public void sendToAllAround(FMLProxyPacket pkt, NetworkRegistry.TargetPoint point)
pkt
- point
- public void sendToAllTracking(FMLProxyPacket pkt, NetworkRegistry.TargetPoint point)
range
field of the NetworkRegistry.TargetPoint
is ignored.pkt
- point
- public void sendToAllTracking(FMLProxyPacket pkt, Entity entity)
sendToAllTracking(FMLProxyPacket, NetworkRegistry.TargetPoint)
because entities have different tracking distances based on their type.pkt
- entity
- public void sendToDimension(FMLProxyPacket pkt, int dimensionId)
pkt
- dimensionId
- public void sendToServer(FMLProxyPacket pkt)
pkt
-