Fixed Entity metadata sending, sheeps on fire

This commit is contained in:
Shoghi Cervantes 2013-06-07 20:32:38 +02:00
parent 9d1369bfe9
commit 129e099f88
3 changed files with 15 additions and 1 deletions

View File

@ -223,6 +223,8 @@ class CustomPacketHandler{
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readByte($this->get(1));
$this->data["yaw"] = Utils::readByte($this->get(1));
$this->data["metadata"] = Utils::readMetadata($this->get(true));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
@ -230,6 +232,8 @@ class CustomPacketHandler{
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeByte($this->data["pitch"]);
$this->raw .= Utils::writeByte($this->data["yaw"]);
$this->raw .= Utils::writeMetadata($this->data["metadata"]);
}
break;
@ -241,6 +245,10 @@ class CustomPacketHandler{
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readByte($this->get(1));
$this->data["yaw"] = Utils::readByte($this->get(1));
$this->data["unknown1"] = Utils::readShort($this->get(2));
$this->data["unknown2"] = Utils::readShort($this->get(2));
$this->data["metadata"] = Utils::readMetadata($this->get(true));
}else{
$this->raw .= Utils::writeLong($this->data["clientID"]);
@ -249,6 +257,10 @@ class CustomPacketHandler{
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeByte($this->data["pitch"]);
$this->raw .= Utils::writeByte($this->data["yaw"]);
$this->raw .= Utils::writeShort($this->data["unknown1"]);
$this->raw .= Utils::writeShort($this->data["unknown2"]);
$this->raw .= Utils::writeMetadata($this->data["metadata"]);
}
break;

View File

@ -115,7 +115,7 @@ class Utils{
public static function writeMetadata($data){
$m = "";
foreach($data as $bottom => $d){
$m .= chr(($d["type"] << 5) & (0xE0 | $bottom));
$m .= chr(($d["type"] << 5) | ($bottom & 0b00011111));
switch($d["type"]){
case 0:
$m .= Utils::writeByte($d["value"]);

View File

@ -603,6 +603,8 @@ class Entity extends Position{
"x" => $this->x,
"y" => $this->y,
"z" => $this->z,
"yaw" => 0,
"pitch" => 0,
"metadata" => $this->getMetadata(),
));
$player->dataPacket(MC_SET_ENTITY_MOTION, array(