类 Channel<MSG>
java.lang.Object
net.minecraftforge.network.Channel<MSG>
- 直接已知子类:
EventNetworkChannel
,PayloadChannel
,SimpleChannel
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明protected final NetworkInstance
private static final org.apache.logging.log4j.Logger
private static final org.apache.logging.log4j.Marker
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明abstract void
encode
(FriendlyByteBuf out, MSG message) getName()
(专用程序包) ResourceLocation
Retrieves the channel name to use for the specified packet This typically is the main channel's name, but in some cases you want to specify a custom one.int
boolean
isRemotePresent
(Connection connection) Returns true if the channel is present in the given connection.void
reply
(MSG msg, CustomPayloadEvent.Context context) void
send
(MSG msg, Connection connection) void
send
(MSG msg, PacketDistributor.PacketTarget target) Send a message to thePacketDistributor.PacketTarget
from aPacketDistributor
instance.protected Packet
<?> toVanillaPacket
(Connection connection, MSG message) protected void
validate
(Object id, Connection con, NetworkProtocol<?> protocol, PacketFlow direction, boolean sending)
-
字段详细资料
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
MARKER
private static final org.apache.logging.log4j.Marker MARKER -
instance
-
-
构造器详细资料
-
Channel
-
-
方法详细资料
-
getName
-
getName
Retrieves the channel name to use for the specified packet This typically is the main channel's name, but in some cases you want to specify a custom one. If your channel haschildren
-
getProtocolVersion
public int getProtocolVersion() -
isRemotePresent
Returns true if the channel is present in the given connection. -
encode
-
toVanillaPacket
-
send
-
send
Send a message to thePacketDistributor.PacketTarget
from aPacketDistributor
instance.channel.send(message, PacketDistributor.PLAYER.with(()->player))
- 类型参数:
MSG
- The type of the message- 参数:
target
- The curried target from a PacketDistributormessage
- The message to send
-
reply
-
validate
protected void validate(Object id, Connection con, NetworkProtocol<?> protocol, PacketFlow direction, boolean sending)
-