Class SimpleChannel.MessageBuilder<MSG>
java.lang.Object
net.minecraftforge.network.simple.SimpleChannel.MessageBuilder<MSG>
- Enclosing class:
- SimpleChannel
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
-
Field Summary
Modifier and TypeFieldDescriptionprivate SimpleChannel
private BiConsumer<MSG,
Supplier<NetworkEvent.Context>> private Function<FriendlyByteBuf,
MSG> private BiConsumer<MSG,
FriendlyByteBuf> private int
private BiConsumer<MSG,
Integer> private boolean
private Optional<NetworkDirection>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add()
buildLoginPacketList
(Function<Boolean, List<org.apache.commons.lang3.tuple.Pair<String, MSG>>> loginPacketGenerators) consumer
(BiConsumer<MSG, Supplier<NetworkEvent.Context>> consumer) consumer
(SimpleChannel.MessageBuilder.ToBooleanBiFunction<MSG, Supplier<NetworkEvent.Context>> handler) Function returning a boolean "packet handled" indication, for simpler channel building.decoder
(Function<FriendlyByteBuf, MSG> decoder) encoder
(BiConsumer<MSG, FriendlyByteBuf> encoder) private static <MSG> SimpleChannel.MessageBuilder<MSG>
forType
(SimpleChannel channel, Class<MSG> type, int id, NetworkDirection networkDirection) loginIndex
(Function<MSG, Integer> loginIndexGetter, BiConsumer<MSG, Integer> loginIndexSetter) Marks this packet as not needing a response when sent to the client
-
Field Details
-
channel
-
type
-
id
private int id -
encoder
-
decoder
-
consumer
-
loginIndexGetter
-
loginIndexSetter
-
loginPacketGenerators
-
networkDirection
-
needsResponse
private boolean needsResponse
-
-
Constructor Details
-
MessageBuilder
public MessageBuilder()
-
-
Method Details
-
forType
private static <MSG> SimpleChannel.MessageBuilder<MSG> forType(SimpleChannel channel, Class<MSG> type, int id, NetworkDirection networkDirection) -
encoder
-
decoder
-
loginIndex
public SimpleChannel.MessageBuilder<MSG> loginIndex(Function<MSG, Integer> loginIndexGetter, BiConsumer<MSG, Integer> loginIndexSetter) -
buildLoginPacketList
-
markAsLoginPacket
-
noResponse
Marks this packet as not needing a response when sent to the client -
consumer
public SimpleChannel.MessageBuilder<MSG> consumer(BiConsumer<MSG, Supplier<NetworkEvent.Context>> consumer) -
consumer
public SimpleChannel.MessageBuilder<MSG> consumer(SimpleChannel.MessageBuilder.ToBooleanBiFunction<MSG, Supplier<NetworkEvent.Context>> handler) Function returning a boolean "packet handled" indication, for simpler channel building.- Parameters:
handler
- a handler- Returns:
- this
-
add
public void add()
-