fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.Packet Struct Reference

Packet struct, just a wrapper for a byte array. More...

Public Member Functions

 Packet ([NotNull] byte[] rawBytes)
 Creates a new packet from given raw bytes. Data not be null.
 
 Packet (OpCode opcode)
 Creates a packet of correct size for a given opcode, and sets the first (opcode) byte.
 

Static Public Member Functions

static Packet MakeHandshake ([NotNull] Player player,[NotNull] string serverName,[NotNull] string motd)
 
static Packet MakeSetBlock (short x, short y, short z, Block type)
 
static Packet MakeSetBlock (Vector3I coords, Block type)
 
static Packet MakeAddEntity (sbyte id,[NotNull] string name, Position pos)
 
static Packet MakeTeleport (sbyte id, Position pos)
 
static Packet MakeSelfTeleport (Position pos)
 
static Packet MakeMoveRotate (sbyte id, Position pos)
 
static Packet MakeMove (sbyte id, Position pos)
 
static Packet MakeRotate (sbyte id, Position pos)
 
static Packet MakeRemoveEntity (sbyte id)
 
static Packet MakeKick ([NotNull] string reason)
 
static Packet MakeSetPermission ([NotNull] Player player)
 
static int GetSize (OpCode opcode)
 Returns packet size (in bytes) for a given opcode. Size includes the opcode byte itself.
 

Public Attributes

const sbyte SelfID = -1
 
readonly byte[] Bytes
 Raw bytes of this packet.
 

Static Public Attributes

static readonly int[] PacketSizes
 

Properties

OpCode OpCode [get]
 Opcode (first byte) of this packet.
 

Detailed Description

Packet struct, just a wrapper for a byte array.

Constructor & Destructor Documentation

fCraft.Packet.Packet ( [NotNull] byte[]  rawBytes)

Creates a new packet from given raw bytes. Data not be null.

fCraft.Packet.Packet ( OpCode  opcode)

Creates a packet of correct size for a given opcode, and sets the first (opcode) byte.

Member Function Documentation

static int fCraft.Packet.GetSize ( OpCode  opcode)
static

Returns packet size (in bytes) for a given opcode. Size includes the opcode byte itself.

static Packet fCraft.Packet.MakeAddEntity ( sbyte  id,
[NotNull] string  name,
Position  pos 
)
static
static Packet fCraft.Packet.MakeHandshake ( [NotNull] Player  player,
[NotNull] string  serverName,
[NotNull] string  motd 
)
static
static Packet fCraft.Packet.MakeKick ( [NotNull] string  reason)
static
static Packet fCraft.Packet.MakeMove ( sbyte  id,
Position  pos 
)
static
static Packet fCraft.Packet.MakeMoveRotate ( sbyte  id,
Position  pos 
)
static
static Packet fCraft.Packet.MakeRemoveEntity ( sbyte  id)
static
static Packet fCraft.Packet.MakeRotate ( sbyte  id,
Position  pos 
)
static
static Packet fCraft.Packet.MakeSelfTeleport ( Position  pos)
static
static Packet fCraft.Packet.MakeSetBlock ( short  x,
short  y,
short  z,
Block  type 
)
static
static Packet fCraft.Packet.MakeSetBlock ( Vector3I  coords,
Block  type 
)
static
static Packet fCraft.Packet.MakeSetPermission ( [NotNull] Player  player)
static
static Packet fCraft.Packet.MakeTeleport ( sbyte  id,
Position  pos 
)
static

Member Data Documentation

readonly byte [] fCraft.Packet.Bytes

Raw bytes of this packet.

readonly int [] fCraft.Packet.PacketSizes
static
Initial value:
= {
131,
1,
1,
1028,
7,
9,
8,
74,
10,
7,
5,
4,
2,
66,
65,
2
}
const sbyte fCraft.Packet.SelfID = -1

Property Documentation

OpCode fCraft.Packet.OpCode
get

Opcode (first byte) of this packet.


The documentation for this struct was generated from the following file: