From f03f3765357884ee2177b29319ecf8d742891be1 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 5 Jan 2013 19:37:01 +0100 Subject: [PATCH] Fall damage --- src/classes/CustomPacketHandler.class.php | 4 ++-- src/classes/Player.class.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/classes/CustomPacketHandler.class.php b/src/classes/CustomPacketHandler.class.php index 65827daf7..eb1900843 100644 --- a/src/classes/CustomPacketHandler.class.php +++ b/src/classes/CustomPacketHandler.class.php @@ -463,9 +463,9 @@ class CustomPacketHandler{ break; case MC_SET_HEALTH: if($this->c === false){ - $this->data["health"] = ord($this->get(1)); + $this->data["health"] = Utils::readByte($this->get(1)); }else{ - $this->raw .= chr($this->data["health"]); + $this->raw .= Utils::writeByte($this->data["health"]); } break; case MC_ANIMATE: diff --git a/src/classes/Player.class.php b/src/classes/Player.class.php index b1bed3eec..ebb3c3ca8 100644 --- a/src/classes/Player.class.php +++ b/src/classes/Player.class.php @@ -388,11 +388,14 @@ class Player{ $this->entity->setHealth(20, "respawn"); $this->entity->setPosition($data["x"], $data["y"], $data["z"], 0, 0); break; + case MC_SET_HEALTH: + $this->entity->setHealth($data["health"], "client"); + break; case MC_DROP_ITEM: $this->server->api->block->drop($this->entity->x, $this->entity->y, $this->entity->z, $data["block"], $data["meta"], $data["stack"]); break; default: - console("[INTERNAL] Unhandled 0x".dechex($data["id"])." Data Packet for Client ID ".$this->clientID.": ".print_r($data), true, true, 3); + console("[INTERNAL] Unhandled 0x".dechex($data["id"])." Data Packet for Client ID ".$this->clientID.": ".print_r($data, true), true, true, 3); break; } break;