Class SimpleChannel.MessageBuilder<MSG>
java.lang.Object
net.minecraftforge.fmllegacy.network.simple.SimpleChannel.MessageBuilder<MSG>
- Enclosing class:
- SimpleChannel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SimpleChannelprivate BiConsumer<MSG,Supplier<NetworkEvent.Context>>private Function<FriendlyByteBuf,MSG>private BiConsumer<MSG,FriendlyByteBuf>private intprivate BiConsumer<MSG,Integer>private Optional<NetworkDirection> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd()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)
-
Field Details
-
channel
-
type
-
id
private int id -
encoder
-
decoder
-
consumer
-
loginIndexGetter
-
loginIndexSetter
-
loginPacketGenerators
-
networkDirection
-
-
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
-
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()
-