Package alexiil.mc.lib.net.impl
Class ActiveServerConnection
java.lang.Object
alexiil.mc.lib.net.ActiveConnection
alexiil.mc.lib.net.BufferedConnection
alexiil.mc.lib.net.impl.ActiveMinecraftConnection
alexiil.mc.lib.net.impl.ActiveServerConnection
public class ActiveServerConnection extends ActiveMinecraftConnection
A connection on the server side to a specific
ServerPlayerEntity.-
Field Summary
Fields Modifier and Type Field Description net.minecraft.server.network.ServerPlayNetworkHandlernetHandler -
Constructor Summary
Constructors Constructor Description ActiveServerConnection(net.minecraft.server.network.ServerPlayNetworkHandler netHandler) -
Method Summary
Modifier and Type Method Description EnumNetSidegetNetSide()net.minecraft.entity.player.PlayerEntitygetPlayer()longgetServerTick()protected voidsendPacket(net.minecraft.network.Packet<?> packet)protected voidsendTickPacket()Optional method for subclasses to send additional packet before the queue is flushed.protected net.minecraft.network.Packet<?>toCompactPacket(int receiverId, NetByteBuf data)protected net.minecraft.network.Packet<?>toNormalPacket(NetByteBuf data)java.lang.StringtoString()Methods inherited from class alexiil.mc.lib.net.impl.ActiveMinecraftConnection
getMinecraftContext, sendRawData0, tickMethods inherited from class alexiil.mc.lib.net.BufferedConnection
hasPackets, maximumPacketSize, onReceiveRawData, sendPacket, setMaxBandwidth
-
Field Details
-
netHandler
public final net.minecraft.server.network.ServerPlayNetworkHandler netHandler
-
-
Constructor Details
-
ActiveServerConnection
public ActiveServerConnection(net.minecraft.server.network.ServerPlayNetworkHandler netHandler)
-
-
Method Details
-
toNormalPacket
- Specified by:
toNormalPacketin classActiveMinecraftConnection
-
toCompactPacket
- Specified by:
toCompactPacketin classActiveMinecraftConnection
-
sendPacket
protected void sendPacket(net.minecraft.network.Packet<?> packet)- Specified by:
sendPacketin classActiveMinecraftConnection
-
getPlayer
public net.minecraft.entity.player.PlayerEntity getPlayer()- Specified by:
getPlayerin classActiveMinecraftConnection- Returns:
- The Minecraft
PlayerEntityfor this connection. Throws an error if this is not aActiveMinecraftConnection.
-
getNetSide
- Specified by:
getNetSidein classActiveMinecraftConnection- 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).
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getServerTick
public long getServerTick()- Returns:
- The value that the client will use to identify the current server tick.
-
sendTickPacket
protected void sendTickPacket()Description copied from class:BufferedConnectionOptional method for subclasses to send additional packet before the queue is flushed.- Overrides:
sendTickPacketin classBufferedConnection
-