Package org.moddingx.libx.network
Class NetworkX
java.lang.Object
org.moddingx.libx.network.NetworkX
A class implementing network logic. You should subclass it and create an instance in your
mods' constructor.
registerPackets()
will then automatically be called
during setup. You can register custom packets there. The order in which they are
registered is important.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
A protocol defines when a connection is accepted or rejected.static enum
Defines when a connection should be accepted. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NetworkX.Protocol
Gets theprotocol
for this network.protected final <T> void
registerGame
(net.minecraftforge.network.NetworkDirection direction, PacketSerializer<T> serializer, Supplier<Supplier<PacketHandler<T>>> handler) protected final <T extends IntSupplier>
voidregisterLogin
(net.minecraftforge.network.NetworkDirection direction, LoginPacketSerializer<T> serializer, Supplier<Supplier<PacketHandler<T>>> handler) protected abstract void
You can register your own packets here.
-
Field Details
-
channel
public final net.minecraftforge.network.simple.SimpleChannel channel
-
-
Constructor Details
-
NetworkX
-
-
Method Details
-
getProtocol
Gets theprotocol
for this network. -
registerPackets
protected abstract void registerPackets()You can register your own packets here. The order is important. -
registerGame
protected final <T> void registerGame(net.minecraftforge.network.NetworkDirection direction, PacketSerializer<T> serializer, Supplier<Supplier<PacketHandler<T>>> handler) -
registerLogin
protected final <T extends IntSupplier> void registerLogin(net.minecraftforge.network.NetworkDirection direction, LoginPacketSerializer<T> serializer, Supplier<Supplier<PacketHandler<T>>> handler)
-