mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Thanks to @Gameherobrine at NostalgiaCore-BackPort at commit #48c317a
This commit is contained in:
parent
1b25bd4694
commit
dcb8732335
7 changed files with 97 additions and 35 deletions
|
|
@ -17,7 +17,7 @@ class ChatPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
|
||||
console($this->getString());
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
|
|
|||
|
|
@ -5,15 +5,19 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
public $y;
|
||||
public $z;
|
||||
public $namedtag;
|
||||
public $line1;
|
||||
public $line2;
|
||||
public $line3;
|
||||
public $line4;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
return ProtocolInfo6::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||
return ProtocolInfo8::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
return ProtocolInfo9::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
return ProtocolInfo6::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||
return ProtocolInfo8::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
return ProtocolInfo9::ENTITY_DATA_PACKET;
|
||||
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
return ProtocolInfo12::ENTITY_DATA_PACKET;
|
||||
}
|
||||
return ProtocolInfo::ENTITY_DATA_PACKET;
|
||||
|
|
@ -23,6 +27,19 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
$this->x = $this->getShort();
|
||||
$this->y = $this->getByte();
|
||||
$this->z = $this->getShort();
|
||||
if($this->PROTOCOL < 11){
|
||||
$this->line1 = $this->get(Utils::readLShort($this->get(2), false));
|
||||
$this->line2 = $this->get(Utils::readLShort($this->get(2), false));
|
||||
$this->line3 = $this->get(Utils::readLShort($this->get(2), false));
|
||||
$this->line4 = $this->get(Utils::readLShort($this->get(2), false));
|
||||
return;
|
||||
}elseif($this->PROTOCOL === 11){
|
||||
$this->line1 = $this->getString();
|
||||
$this->line2 = $this->getString();
|
||||
$this->line3 = $this->getString();
|
||||
$this->line4 = $this->getString();
|
||||
return;
|
||||
}
|
||||
$this->namedtag = $this->get(true);
|
||||
}
|
||||
|
||||
|
|
@ -31,8 +48,23 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
$this->putShort($this->x);
|
||||
$this->putByte($this->y);
|
||||
$this->putShort($this->z);
|
||||
if($this->PROTOCOL < 11){
|
||||
$this->putLShort(strlen($this->line1));
|
||||
$this->put($this->line1);
|
||||
$this->putLShort(strlen($this->line2));
|
||||
$this->put($this->line2);
|
||||
$this->putLShort(strlen($this->line3));
|
||||
$this->put($this->line3);
|
||||
$this->putLShort(strlen($this->line4));
|
||||
$this->put($this->line4);
|
||||
}elseif($this->PROTOCOL === 11){
|
||||
$this->putString($this->line1);
|
||||
$this->putString($this->line2);
|
||||
$this->putString($this->line3);
|
||||
$this->putString($this->line4);
|
||||
return;
|
||||
}
|
||||
$this->put($this->namedtag);
|
||||
console($this->namedtag);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ class MessagePacket extends RakNetDataPacket{
|
|||
public function decode(){
|
||||
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||
$this->source = $this->getString();
|
||||
}else {
|
||||
$this->source = "";
|
||||
}
|
||||
$this->message = $this->getString();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue