Package net.minecraftforge.fml.network
Class NetworkEvent.Context
- java.lang.Object
-
- net.minecraftforge.fml.network.NetworkEvent.Context
-
- Enclosing class:
- NetworkEvent
public static class NetworkEvent.Context extends java.lang.Object
Context forNetworkEvent
-
-
Field Summary
Fields Modifier and Type Field Description private NetworkDirection
networkDirection
TheNetworkDirection
this message has been received on.private NetworkManager
networkManager
TheNetworkManager
for this message.private PacketDispatcher
packetDispatcher
The packet dispatcher for this event.private boolean
packetHandled
-
Constructor Summary
Constructors Constructor Description Context(NetworkManager netHandler, NetworkDirection networkDirection, int index)
Context(NetworkManager networkManager, NetworkDirection networkDirection, PacketDispatcher dispatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> io.netty.util.Attribute<T>
attr(io.netty.util.AttributeKey<T> key)
java.util.concurrent.CompletableFuture<java.lang.Void>
enqueueWork(java.lang.Runnable runnable)
NetworkDirection
getDirection()
NetworkManager
getNetworkManager()
PacketDispatcher
getPacketDispatcher()
boolean
getPacketHandled()
ServerPlayerEntity
getSender()
When available, gets the sender for packets that are sent from a client to the server.void
setPacketHandled(boolean packetHandled)
-
-
-
Field Detail
-
networkManager
private final NetworkManager networkManager
TheNetworkManager
for this message.
-
networkDirection
private final NetworkDirection networkDirection
TheNetworkDirection
this message has been received on.
-
packetDispatcher
private final PacketDispatcher packetDispatcher
The packet dispatcher for this event. Sends back to the origin.
-
packetHandled
private boolean packetHandled
-
-
Constructor Detail
-
Context
Context(NetworkManager netHandler, NetworkDirection networkDirection, int index)
-
Context
Context(NetworkManager networkManager, NetworkDirection networkDirection, PacketDispatcher dispatcher)
-
-
Method Detail
-
getDirection
public NetworkDirection getDirection()
-
getPacketDispatcher
public PacketDispatcher getPacketDispatcher()
-
attr
public <T> io.netty.util.Attribute<T> attr(io.netty.util.AttributeKey<T> key)
-
setPacketHandled
public void setPacketHandled(boolean packetHandled)
-
getPacketHandled
public boolean getPacketHandled()
-
enqueueWork
public java.util.concurrent.CompletableFuture<java.lang.Void> enqueueWork(java.lang.Runnable runnable)
-
getSender
@Nullable public ServerPlayerEntity getSender()
When available, gets the sender for packets that are sent from a client to the server.
-
getNetworkManager
public NetworkManager getNetworkManager()
-
-