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.ServerPlayNetworkHandler
netHandler
-
Constructor Summary
Constructors Constructor Description ActiveServerConnection(net.minecraft.server.network.ServerPlayNetworkHandler netHandler)
-
Method Summary
Modifier and Type Method Description EnumNetSide
getNetSide()
net.minecraft.entity.player.PlayerEntity
getPlayer()
long
getServerTick()
protected void
sendPacket(net.minecraft.network.Packet<?> packet)
protected void
sendTickPacket()
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.String
toString()
Methods inherited from class alexiil.mc.lib.net.impl.ActiveMinecraftConnection
getMinecraftContext, sendRawData0, tick
Methods 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:
toNormalPacket
in classActiveMinecraftConnection
-
toCompactPacket
- Specified by:
toCompactPacket
in classActiveMinecraftConnection
-
sendPacket
protected void sendPacket(net.minecraft.network.Packet<?> packet)- Specified by:
sendPacket
in classActiveMinecraftConnection
-
getPlayer
public net.minecraft.entity.player.PlayerEntity getPlayer()- Specified by:
getPlayer
in classActiveMinecraftConnection
- Returns:
- The Minecraft
PlayerEntity
for this connection. Throws an error if this is not aActiveMinecraftConnection
.
-
getNetSide
- Specified by:
getNetSide
in classActiveMinecraftConnection
- Returns:
- The "side" of this connection. This will be
EnumNetSide.CLIENT
both when writing client to server packets, and when reading packets sent from the server. (AndEnumNetSide.SERVER
both when writing server to client packets, and when reading client to server packets).
-
toString
public java.lang.String toString()- Overrides:
toString
in 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:BufferedConnection
Optional method for subclasses to send additional packet before the queue is flushed.- Overrides:
sendTickPacket
in classBufferedConnection
-