mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +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
|
|
@ -3535,6 +3535,10 @@ class Player{
|
||||||
$t->spawn($this);
|
$t->spawn($this);
|
||||||
}else{
|
}else{
|
||||||
$nbt = new NBT();
|
$nbt = new NBT();
|
||||||
|
if($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||||
|
$t->setText($packet->line1, $packet->line2, $packet->line3, $packet->line4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
$nbt->load($packet->namedtag);
|
$nbt->load($packet->namedtag);
|
||||||
$d = array_shift($nbt->tree);
|
$d = array_shift($nbt->tree);
|
||||||
if($d["id"] !== TILE_SIGN){
|
if($d["id"] !== TILE_SIGN){
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class ChatPacket extends RakNetDataPacket{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
console($this->getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@ class EntityDataPacket extends RakNetDataPacket{
|
||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
public $namedtag;
|
public $namedtag;
|
||||||
|
public $line1;
|
||||||
|
public $line2;
|
||||||
|
public $line3;
|
||||||
|
public $line4;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||||
|
|
@ -23,6 +27,19 @@ class EntityDataPacket extends RakNetDataPacket{
|
||||||
$this->x = $this->getShort();
|
$this->x = $this->getShort();
|
||||||
$this->y = $this->getByte();
|
$this->y = $this->getByte();
|
||||||
$this->z = $this->getShort();
|
$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);
|
$this->namedtag = $this->get(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,8 +48,23 @@ class EntityDataPacket extends RakNetDataPacket{
|
||||||
$this->putShort($this->x);
|
$this->putShort($this->x);
|
||||||
$this->putByte($this->y);
|
$this->putByte($this->y);
|
||||||
$this->putShort($this->z);
|
$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);
|
$this->put($this->namedtag);
|
||||||
console($this->namedtag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -11,6 +11,8 @@ class MessagePacket extends RakNetDataPacket{
|
||||||
public function decode(){
|
public function decode(){
|
||||||
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
if($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9){ //0.6.1 and below From NostalgiaCore-BackPort Author:Gameherobrine
|
||||||
$this->source = $this->getString();
|
$this->source = $this->getString();
|
||||||
|
}else {
|
||||||
|
$this->source = "";
|
||||||
}
|
}
|
||||||
$this->message = $this->getString();
|
$this->message = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,10 @@ abstract class RakNetDataPacket extends stdClass{
|
||||||
$this->buffer .= Utils::writeShort($v);
|
$this->buffer .= Utils::writeShort($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function putLShort($v){
|
||||||
|
$this->buffer .= Utils::writeLShort($v);
|
||||||
|
}
|
||||||
|
|
||||||
protected function putByte($v){
|
protected function putByte($v){
|
||||||
$this->buffer .= chr((int)$v);
|
$this->buffer .= chr((int)$v);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,26 @@ class Tile extends Position{
|
||||||
|
|
||||||
$nbt->write(chr(NBT::TAG_END));
|
$nbt->write(chr(NBT::TAG_END));
|
||||||
|
|
||||||
|
if($player->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
|
$line1 = mb_substr($this->data["Text1"], 0, 15);
|
||||||
|
$line2 = mb_substr($this->data["Text2"], 0, 15);
|
||||||
|
$line3 = mb_substr($this->data["Text3"], 0, 15);
|
||||||
|
$line4 = mb_substr($this->data["Text4"], 0, 15);
|
||||||
|
|
||||||
|
$pk = new EntityDataPacket;
|
||||||
|
$pk->x = $this->x;
|
||||||
|
$pk->y = $this->y;
|
||||||
|
$pk->z = $this->z;
|
||||||
|
|
||||||
|
$pk->line1 = $line1;
|
||||||
|
$pk->line2 = $line2;
|
||||||
|
$pk->line3 = $line3;
|
||||||
|
$pk->line4 = $line4;
|
||||||
|
|
||||||
|
$player->blockQueueDataPacket($pk);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$pk = new EntityDataPacket;
|
$pk = new EntityDataPacket;
|
||||||
$pk->x = $this->x;
|
$pk->x = $this->x;
|
||||||
$pk->y = $this->y;
|
$pk->y = $this->y;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue