Added new packets

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-30 20:21:18 +01:00
parent 0e889b0139
commit d0a08d16e7
4 changed files with 27 additions and 9 deletions

View file

@ -192,9 +192,9 @@ class Player{
if($data["eid"] === $this->eid){
$data["eid"] = 0;
$this->armor = array($data["slot0"], $data["slot1"], $data["slot2"], $data["slot3"]);
$this->dataPacket(MC_SET_ARMOR, $data);
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
}else{
$this->dataPacket(MC_SET_ARMOR, $data);
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
}
break;
case "player.block.place":
@ -574,7 +574,7 @@ class Player{
}
$this->server->handle("player.block.break", $data);
break;
case MC_SET_ARMOR:
case MC_PLAYER_ARMOR_EQUIPMENT:
$data["eid"] = $this->eid;
$this->server->handle("player.armor", $data);
break;

View file

@ -445,7 +445,7 @@ class CustomPacketHandler{
$this->raw .= Utils::writeShort($this->data["meta"]);
}
break;
case MC_SET_ARMOR:
case MC_PLAYER_ARMOR_EQUIPMENT:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["slot0"] = ord($this->get(1));
@ -514,6 +514,13 @@ class CustomPacketHandler{
$this->raw .= Utils::writeShort($this->data["speedZ"]);
}
break;
case MC_HURT_ARMOR:
if($this->c === false){
$this->data["health"] = Utils::readByte($this->get(1));
}else{
$this->raw .= Utils::writeByte($this->data["health"]);
}
break;
case MC_SET_HEALTH:
if($this->c === false){
$this->data["health"] = Utils::readByte($this->get(1));
@ -521,6 +528,17 @@ class CustomPacketHandler{
$this->raw .= Utils::writeByte($this->data["health"]);
}
break;
case MC_SET_SPAWN_POSITION:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["y"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= chr($this->data["y"]);
}
break;
case MC_ANIMATE:
if($this->c === false){
$this->data["action"] = Utils::readByte($this->get(1));
@ -626,8 +644,7 @@ class CustomPacketHandler{
$this->data["line$i"] = $this->get(Utils::readLShort($this->get(2), false));
}
}else{
$this->raw .= $this->data["unknown1"];
$this->raw .= $this->data["unknown2"];
$this->raw .= "\xff";
}
break;
default: