Package net.minecraftforge.network
Class NetworkEvent.Context
java.lang.Object
net.minecraftforge.network.NetworkEvent.Context
- Enclosing class:
- NetworkEvent
Context for
NetworkEvent
-
Field Summary
Modifier and TypeFieldDescriptionprivate final NetworkDirection
TheNetworkDirection
this message has been received on.private final Connection
TheConnection
for this message.private final NetworkEvent.PacketDispatcher
The packet dispatcher for this event.private boolean
-
Constructor Summary
ConstructorDescriptionContext
(Connection netHandler, NetworkDirection networkDirection, int index) Context
(Connection networkManager, NetworkDirection networkDirection, BiConsumer<ResourceLocation, FriendlyByteBuf> packetSink) Context
(Connection networkManager, NetworkDirection networkDirection, NetworkEvent.PacketDispatcher dispatcher) -
Method Summary
Modifier and TypeMethodDescription<T> io.netty.util.Attribute<T>
attr
(io.netty.util.AttributeKey<T> key) enqueueWork
(Runnable runnable) boolean
@Nullable ServerPlayer
When available, gets the sender for packets that are sent from a client to the server.void
setPacketHandled
(boolean packetHandled)
-
Field Details
-
networkManager
TheConnection
for this message. -
networkDirection
TheNetworkDirection
this message has been received on. -
packetDispatcher
The packet dispatcher for this event. Sends back to the origin. -
packetHandled
private boolean packetHandled
-
-
Constructor Details
-
Context
Context(Connection netHandler, NetworkDirection networkDirection, int index) -
Context
Context(Connection networkManager, NetworkDirection networkDirection, BiConsumer<ResourceLocation, FriendlyByteBuf> packetSink) -
Context
Context(Connection networkManager, NetworkDirection networkDirection, NetworkEvent.PacketDispatcher dispatcher)
-
-
Method Details
-
getDirection
-
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
-
getSender
When available, gets the sender for packets that are sent from a client to the server. -
getNetworkManager
-