public class SimpleChannel
extends java.lang.Object
修飾子とタイプ | クラスと説明 |
---|---|
static class |
SimpleChannel.MessageBuilder<MSG> |
コンストラクタと説明 |
---|
SimpleChannel(NetworkInstance instance) |
SimpleChannel(NetworkInstance instance,
java.util.function.Consumer<NetworkEvent.ChannelRegistrationChangeEvent> registryChangeNotify) |
修飾子とタイプ | メソッドと説明 |
---|---|
<MSG> int |
encodeMessage(MSG message,
PacketBuffer target) |
<M> SimpleChannel.MessageBuilder<M> |
messageBuilder(java.lang.Class<M> type,
int id)
Build a new MessageBuilder.
|
<M> SimpleChannel.MessageBuilder<M> |
messageBuilder(java.lang.Class<M> type,
int id,
NetworkDirection direction)
Build a new MessageBuilder.
|
<MSG> net.minecraftforge.fml.network.simple.IndexedMessageCodec.MessageHandler<MSG> |
registerMessage(int index,
java.lang.Class<MSG> messageType,
java.util.function.BiConsumer<MSG,PacketBuffer> encoder,
java.util.function.Function<PacketBuffer,MSG> decoder,
java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer) |
<MSG> net.minecraftforge.fml.network.simple.IndexedMessageCodec.MessageHandler<MSG> |
registerMessage(int index,
java.lang.Class<MSG> messageType,
java.util.function.BiConsumer<MSG,PacketBuffer> encoder,
java.util.function.Function<PacketBuffer,MSG> decoder,
java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer,
java.util.Optional<NetworkDirection> networkDirection) |
<MSG> void |
reply(MSG msgToReply,
NetworkEvent.Context context) |
<MSG> void |
send(PacketDistributor.PacketTarget target,
MSG message)
Send a message to the
PacketDistributor.PacketTarget from a PacketDistributor instance. |
<MSG> void |
sendTo(MSG message,
NetworkManager manager,
NetworkDirection direction) |
<MSG> void |
sendToServer(MSG message) |
<MSG> IPacket<?> |
toVanillaPacket(MSG message,
NetworkDirection direction) |
public SimpleChannel(NetworkInstance instance)
public SimpleChannel(NetworkInstance instance, java.util.function.Consumer<NetworkEvent.ChannelRegistrationChangeEvent> registryChangeNotify)
public <MSG> int encodeMessage(MSG message, PacketBuffer target)
public <MSG> net.minecraftforge.fml.network.simple.IndexedMessageCodec.MessageHandler<MSG> registerMessage(int index, java.lang.Class<MSG> messageType, java.util.function.BiConsumer<MSG,PacketBuffer> encoder, java.util.function.Function<PacketBuffer,MSG> decoder, java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer)
public <MSG> net.minecraftforge.fml.network.simple.IndexedMessageCodec.MessageHandler<MSG> registerMessage(int index, java.lang.Class<MSG> messageType, java.util.function.BiConsumer<MSG,PacketBuffer> encoder, java.util.function.Function<PacketBuffer,MSG> decoder, java.util.function.BiConsumer<MSG,java.util.function.Supplier<NetworkEvent.Context>> messageConsumer, java.util.Optional<NetworkDirection> networkDirection)
public <MSG> void sendToServer(MSG message)
public <MSG> void sendTo(MSG message, NetworkManager manager, NetworkDirection direction)
public <MSG> void send(PacketDistributor.PacketTarget target, MSG message)
PacketDistributor.PacketTarget
from a PacketDistributor
instance.
channel.send(PacketDistributor.PLAYER.with(()->player), message)
MSG
- The type of the messagetarget
- The curried target from a PacketDistributormessage
- The message to sendpublic <MSG> IPacket<?> toVanillaPacket(MSG message, NetworkDirection direction)
public <MSG> void reply(MSG msgToReply, NetworkEvent.Context context)
public <M> SimpleChannel.MessageBuilder<M> messageBuilder(java.lang.Class<M> type, int id)
IntSupplier
if it is a login
packet.M
- Type of typetype
- Type of messageid
- id in the indexed codecpublic <M> SimpleChannel.MessageBuilder<M> messageBuilder(java.lang.Class<M> type, int id, NetworkDirection direction)
IntSupplier
if it is a login
packet.M
- Type of typetype
- Type of messageid
- id in the indexed codecdirection
- a network direction which will be asserted before any processing of this message occurs. Use to
enforce strict sided handling to prevent spoofing.