public static class NetworkRegistry.ChannelBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ResourceLocation |
channelName |
private java.util.function.Predicate<java.lang.String> |
clientAcceptedVersions |
private java.util.function.Supplier<java.lang.String> |
networkProtocolVersion |
private java.util.function.Predicate<java.lang.String> |
serverAcceptedVersions |
Constructor and Description |
---|
ChannelBuilder() |
Modifier and Type | Method and Description |
---|---|
NetworkRegistry.ChannelBuilder |
clientAcceptedVersions(java.util.function.Predicate<java.lang.String> clientAcceptedVersions)
A predicate run on the client, with the
networkProtocolVersion(Supplier) string from
the server, or the special value NetworkRegistry.ABSENT indicating the absence of
the channel on the remote side. |
private NetworkInstance |
createNetworkInstance()
Create the network instance
|
EventNetworkChannel |
eventNetworkChannel()
Build a new
EventNetworkChannel with this builder's configuration. |
static NetworkRegistry.ChannelBuilder |
named(ResourceLocation channelName)
The name of the channel.
|
NetworkRegistry.ChannelBuilder |
networkProtocolVersion(java.util.function.Supplier<java.lang.String> networkProtocolVersion)
The network protocol string for this channel.
|
NetworkRegistry.ChannelBuilder |
serverAcceptedVersions(java.util.function.Predicate<java.lang.String> serverAcceptedVersions)
A predicate run on the server, with the
networkProtocolVersion(Supplier) string from
the server, or the special value NetworkRegistry.ABSENT indicating the absence of
the channel on the remote side. |
SimpleChannel |
simpleChannel()
Build a new
SimpleChannel with this builder's configuration. |
private ResourceLocation channelName
private java.util.function.Supplier<java.lang.String> networkProtocolVersion
private java.util.function.Predicate<java.lang.String> clientAcceptedVersions
private java.util.function.Predicate<java.lang.String> serverAcceptedVersions
public static NetworkRegistry.ChannelBuilder named(ResourceLocation channelName)
channelName
- The name of the channelpublic NetworkRegistry.ChannelBuilder networkProtocolVersion(java.util.function.Supplier<java.lang.String> networkProtocolVersion)
networkProtocolVersion
- A supplier of strings for network protocol version testingserverAcceptedVersions(Predicate)
,
clientAcceptedVersions(Predicate)
public NetworkRegistry.ChannelBuilder clientAcceptedVersions(java.util.function.Predicate<java.lang.String> clientAcceptedVersions)
networkProtocolVersion(Supplier)
string from
the server, or the special value NetworkRegistry.ABSENT
indicating the absence of
the channel on the remote side.clientAcceptedVersions
- A predicate for testingpublic NetworkRegistry.ChannelBuilder serverAcceptedVersions(java.util.function.Predicate<java.lang.String> serverAcceptedVersions)
networkProtocolVersion(Supplier)
string from
the server, or the special value NetworkRegistry.ABSENT
indicating the absence of
the channel on the remote side.serverAcceptedVersions
- A predicate for testingprivate NetworkInstance createNetworkInstance()
NetworkInstance
public SimpleChannel simpleChannel()
SimpleChannel
with this builder's configuration.SimpleChannel
public EventNetworkChannel eventNetworkChannel()
EventNetworkChannel
with this builder's configuration.EventNetworkChannel