GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
TextPacket Class Reference

Public Member Functions

 decode ()
 
 encode ()
 
 getName ()
 
- Public Member Functions inherited from DataPacket
 pid ()
 
 encode ()
 
 decode ()
 
 reset ()
 
 clean ()
 
 __debugInfo ()
 
 getEntityMetadata (bool $types=true)
 
 putEntityMetadata (array $metadata)
 
 getName ()
 
- Public Member Functions inherited from BinaryStream
 __construct ($buffer="", $offset=0)
 
 reset ()
 
 setBuffer ($buffer=null, $offset=0)
 
 getOffset ()
 
 getBuffer ()
 
 get ($len)
 
 put ($str)
 
 getBool ()
 
 putBool ($v)
 
 getLong ()
 
 putLong ($v)
 
 getInt ()
 
 putInt ($v)
 
 getLLong ()
 
 putLLong ($v)
 
 getLInt ()
 
 putLInt ($v)
 
 getSignedShort ()
 
 putShort ($v)
 
 getShort ()
 
 putSignedShort ($v)
 
 getFloat (int $accuracy=-1)
 
 putFloat ($v)
 
 getLShort ($signed=true)
 
 putLShort ($v)
 
 getLFloat (int $accuracy=-1)
 
 putLFloat ($v)
 
 getTriad ()
 
 putTriad ($v)
 
 getLTriad ()
 
 putLTriad ($v)
 
 getByte ()
 
 putByte ($v)
 
 getUUID ()
 
 putUUID (UUID $uuid)
 
 getSlot ()
 
 putSlot (Item $item)
 
 getString ()
 
 putString ($v)
 
 getUnsignedVarInt ()
 
 putUnsignedVarInt ($v)
 
 getVarInt ()
 
 putVarInt ($v)
 
 getEntityId ()
 
 putEntityId ($v)
 
 getBlockCoords (&$x, &$y, &$z)
 
 putBlockCoords ($x, $y, $z)
 
 getVector3f (&$x, &$y, &$z)
 
 putVector3f ($x, $y, $z)
 
 feof ()
 

Data Fields

const NETWORK_ID = ProtocolInfo::TEXT_PACKET
 
const TYPE_RAW = 0
 
const TYPE_CHAT = 1
 
const TYPE_TRANSLATION = 2
 
const TYPE_POPUP = 3
 
const TYPE_TIP = 4
 
const TYPE_SYSTEM = 5
 
const TYPE_WHISPER = 6
 
 $type
 
 $source
 
 $message
 
 $parameters = []
 
- Data Fields inherited from DataPacket
const NETWORK_ID = 0
 
 $isEncoded = false
 
- Data Fields inherited from BinaryStream
 $offset
 
 $buffer
 

Member Function Documentation

◆ decode()

decode ( )

PhpMissingBreakStatementInspection

47  {
48  $this->type = $this->getByte();
49  switch($this->type){
50  case self::TYPE_POPUP:
51  case self::TYPE_CHAT:
53  case self::TYPE_WHISPER:
54  $this->source = $this->getString();
55  case self::TYPE_RAW:
56  case self::TYPE_TIP:
57  case self::TYPE_SYSTEM:
58  $this->message = $this->getString();
59  break;
60 
61  case self::TYPE_TRANSLATION:
62  $this->message = $this->getString();
63  $count = $this->getUnsignedVarInt();
64  for($i = 0; $i < $count; ++$i){
65  $this->parameters[] = $this->getString();
66  }
67  }
68  }

◆ encode()

encode ( )

PhpMissingBreakStatementInspection

73  {
74  $this->reset();
75  $this->putByte($this->type);
76  switch($this->type){
77  case self::TYPE_POPUP:
78  case self::TYPE_CHAT:
80  case self::TYPE_WHISPER:
81  $this->putString($this->source);
82  case self::TYPE_RAW:
83  case self::TYPE_TIP:
84  case self::TYPE_SYSTEM:
85  $this->putString($this->message);
86  break;
87 
88  case self::TYPE_TRANSLATION:
89  $this->putString($this->message);
90  $this->putUnsignedVarInt(count($this->parameters));
91  foreach($this->parameters as $p){
92  $this->putString($p);
93  }
94  }
95  }

◆ getName()

getName ( )
Returns
PacketName|string
100  {
101  return "TextPacket";
102  }

Field Documentation

◆ $message

$message

◆ $parameters

$parameters = []

◆ $source

$source

◆ $type

$type

◆ NETWORK_ID

const NETWORK_ID = ProtocolInfo::TEXT_PACKET

◆ TYPE_CHAT

const TYPE_CHAT = 1

◆ TYPE_POPUP

const TYPE_POPUP = 3

◆ TYPE_RAW

const TYPE_RAW = 0

◆ TYPE_SYSTEM

const TYPE_SYSTEM = 5

◆ TYPE_TIP

const TYPE_TIP = 4

◆ TYPE_TRANSLATION

const TYPE_TRANSLATION = 2

◆ TYPE_WHISPER

const TYPE_WHISPER = 6

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