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
A connection on the server side to a specific
ServerPlayerEntity
.-
Field Summary
Modifier and TypeFieldDescriptionfinal net.minecraft.server.network.ServerPlayNetworkHandler
Fields inherited from class alexiil.mc.lib.net.impl.ActiveMinecraftConnection
PACKET_ID
Fields inherited from class alexiil.mc.lib.net.BufferedConnection
ENABLE_QUEUE
-
Constructor Summary
ConstructorDescriptionActiveServerConnection
(net.minecraft.server.network.ServerPlayNetworkHandler netHandler) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.entity.player.PlayerEntity
long
protected void
sendPacket
(net.minecraft.network.Packet<?> packet) protected void
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) toString()
Methods inherited from class alexiil.mc.lib.net.impl.ActiveMinecraftConnection
sendRawData0, tick
Methods inherited from class alexiil.mc.lib.net.BufferedConnection
hasPackets, maximumPacketSize, onReceiveRawData, sendPacket, setMaxBandwidth
Methods inherited from class alexiil.mc.lib.net.ActiveConnection
allocBuffer, allocBuffer, isDebuggingConnection, postConstruct
-
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
-
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
-