Added 64-bit entity data field

This commit is contained in:
Shoghi Cervantes 2015-03-17 16:26:02 +01:00
parent b5b46bfd7e
commit 6af87814e3
3 changed files with 15 additions and 7 deletions

View File

@ -647,6 +647,12 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
$this->spawned = true; $this->spawned = true;
$this->sendSettings();
$this->sendData($this);
$this->sendPotionEffects($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$pk = new PlayStatusPacket(); $pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::PLAYER_SPAWN; $pk->status = PlayStatusPacket::PLAYER_SPAWN;
@ -663,12 +669,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->teleport($ev->getRespawnPosition()); $this->teleport($ev->getRespawnPosition());
$this->sendSettings();
$this->sendData($this);
$this->sendPotionEffects($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game")); $this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game"));
if(strlen(trim($ev->getJoinMessage())) > 0){ if(strlen(trim($ev->getJoinMessage())) > 0){
$this->server->broadcastMessage($ev->getJoinMessage()); $this->server->broadcastMessage($ev->getJoinMessage());

View File

@ -76,6 +76,7 @@ abstract class Entity extends Location implements Metadatable{
const DATA_TYPE_SLOT = 5; const DATA_TYPE_SLOT = 5;
const DATA_TYPE_POS = 6; const DATA_TYPE_POS = 6;
const DATA_TYPE_ROTATION = 7; const DATA_TYPE_ROTATION = 7;
const DATA_TYPE_LONG = 8;
const DATA_FLAGS = 0; const DATA_FLAGS = 0;
const DATA_AIR = 1; const DATA_AIR = 1;

View File

@ -116,6 +116,9 @@ class Binary{
$m .= self::writeLInt($d[1][1]); $m .= self::writeLInt($d[1][1]);
$m .= self::writeLInt($d[1][2]); $m .= self::writeLInt($d[1][2]);
break; break;
case Entity::DATA_TYPE_LONG:
$m .= self::writeLLong($d[1]);
break;
} }
} }
$m .= "\x7f"; $m .= "\x7f";
@ -179,6 +182,10 @@ class Binary{
$offset += 4; $offset += 4;
} }
break; break;
case Entity::DATA_TYPE_LONG:
$r = self::readLLong(substr($value, $offset, 4));
$offset += 8;
break;
default: default:
return []; return [];
@ -430,4 +437,4 @@ class Binary{
return strrev(self::writeLong($value)); return strrev(self::writeLong($value));
} }
} }