Package alexiil.mc.lib.net.impl
Class ActiveMinecraftConnection
java.lang.Object
alexiil.mc.lib.net.ActiveConnection
alexiil.mc.lib.net.BufferedConnection
alexiil.mc.lib.net.impl.ActiveMinecraftConnection
- Direct Known Subclasses:
ActiveClientConnection,ActiveServerConnection
A connection to the other side - this is either an
ActiveClientConnection or an
ActiveServerConnection.-
Field Summary
FieldsFields inherited from class alexiil.mc.lib.net.BufferedConnection
ENABLE_QUEUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract EnumNetSideabstract net.minecraft.entity.player.PlayerEntityprotected abstract voidsendPacket(net.minecraft.network.Packet<?> packet) final voidsendRawData0(NetByteBuf data) Sends some raw data.voidtick()Ticks this connection, flushing all queued data that needs to be sent immediately.protected abstract net.minecraft.network.Packet<?>toCompactPacket(int receiverId, NetByteBuf data) protected abstract net.minecraft.network.Packet<?>toNormalPacket(NetByteBuf data) Methods inherited from class alexiil.mc.lib.net.BufferedConnection
hasPackets, maximumPacketSize, onReceiveRawData, sendPacket, sendTickPacket, setMaxBandwidthMethods inherited from class alexiil.mc.lib.net.ActiveConnection
allocBuffer, allocBuffer, isDebuggingConnection, postConstruct
-
Field Details
-
PACKET_ID
public static final net.minecraft.util.Identifier PACKET_ID
-
-
Constructor Details
-
ActiveMinecraftConnection
public ActiveMinecraftConnection()
-
-
Method Details
-
getNetSide
- Overrides:
getNetSidein classActiveConnection- Returns:
- The "side" of this connection. This will be
EnumNetSide.CLIENTboth when writing client to server packets, and when reading packets sent from the server. (AndEnumNetSide.SERVERboth when writing server to client packets, and when reading client to server packets).
-
getPlayer
public abstract net.minecraft.entity.player.PlayerEntity getPlayer()- Overrides:
getPlayerin classActiveConnection- Returns:
- The Minecraft
PlayerEntityfor this connection. Throws an error if this is not aActiveMinecraftConnection.
-
sendRawData0
Description copied from class:BufferedConnectionSends some raw data. It might contain multiple packets, half packets, or even less. Either way the implementation should just directly send the data on to the other side, and ensure it arrives in-order.- Specified by:
sendRawData0in classBufferedConnection
-
tick
public void tick()Description copied from class:BufferedConnectionTicks this connection, flushing all queued data that needs to be sent immediately.- Overrides:
tickin classBufferedConnection
-
toNormalPacket
-
toCompactPacket
-
sendPacket
protected abstract void sendPacket(net.minecraft.network.Packet<?> packet)
-