Package net.minecraftforge.fml.network
Class NetworkRegistry.ChannelBuilder
java.lang.Object
net.minecraftforge.fml.network.NetworkRegistry.ChannelBuilder
- Enclosing class:
- NetworkRegistry
Builder for constructing network channels using a builder style API.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclientAcceptedVersions
(Predicate<String> clientAcceptedVersions) A predicate run on the client, with thenetworkProtocolVersion(Supplier)
string from the server, or the special valueNetworkRegistry.ABSENT
indicating the absence of the channel on the remote side.private NetworkInstance
Create the network instanceBuild a newEventNetworkChannel
with this builder's configuration.named
(ResourceLocation channelName) The name of the channel.networkProtocolVersion
(Supplier<String> networkProtocolVersion) The network protocol string for this channel.serverAcceptedVersions
(Predicate<String> serverAcceptedVersions) A predicate run on the server, with thenetworkProtocolVersion(Supplier)
string from the server, or the special valueNetworkRegistry.ABSENT
indicating the absence of the channel on the remote side.Build a newSimpleChannel
with this builder's configuration.
-
Field Details
-
channelName
-
networkProtocolVersion
-
clientAcceptedVersions
-
serverAcceptedVersions
-
-
Constructor Details
-
ChannelBuilder
public ChannelBuilder()
-
-
Method Details
-
named
The name of the channel. Must be unique.- Parameters:
channelName
- The name of the channel- Returns:
- the channel builder
-
networkProtocolVersion
public NetworkRegistry.ChannelBuilder networkProtocolVersion(Supplier<String> networkProtocolVersion) The network protocol string for this channel. This will be gathered during login and sent to the remote partner, where it will be tested with against the relevant predicate.- Parameters:
networkProtocolVersion
- A supplier of strings for network protocol version testing- Returns:
- the channel builder
- See Also:
-
clientAcceptedVersions
public NetworkRegistry.ChannelBuilder clientAcceptedVersions(Predicate<String> clientAcceptedVersions) A predicate run on the client, with thenetworkProtocolVersion(Supplier)
string from the server, or the special valueNetworkRegistry.ABSENT
indicating the absence of the channel on the remote side.- Parameters:
clientAcceptedVersions
- A predicate for testing- Returns:
- the channel builder
-
serverAcceptedVersions
public NetworkRegistry.ChannelBuilder serverAcceptedVersions(Predicate<String> serverAcceptedVersions) A predicate run on the server, with thenetworkProtocolVersion(Supplier)
string from the server, or the special valueNetworkRegistry.ABSENT
indicating the absence of the channel on the remote side.- Parameters:
serverAcceptedVersions
- A predicate for testing- Returns:
- the channel builder
-
createNetworkInstance
Create the network instance- Returns:
- the
NetworkInstance
-
simpleChannel
Build a newSimpleChannel
with this builder's configuration.- Returns:
- A new
SimpleChannel
-
eventNetworkChannel
Build a newEventNetworkChannel
with this builder's configuration.- Returns:
- A new
EventNetworkChannel
-