Fixed a few wrong fields

This commit is contained in:
Shoghi Cervantes 2014-02-08 01:25:03 +01:00
parent f6ecf51516
commit 1f5ff78f06
5 changed files with 14 additions and 14 deletions

View File

@ -1153,7 +1153,7 @@ class Player{
case ProtocolInfo::PING_PACKET: case ProtocolInfo::PING_PACKET:
case ProtocolInfo::PONG_PACKET: case ProtocolInfo::PONG_PACKET:
case ProtocolInfo::MOVE_PLAYER_PACKET: case ProtocolInfo::MOVE_PLAYER_PACKET:
case ProtocolInfo::MOVE_REQUEST_CHUNK: case ProtocolInfo::REQUEST_CHUNK_PACKET:
case ProtocolInfo::ANIMATE_PACKET: case ProtocolInfo::ANIMATE_PACKET:
case ProtocolInfo::SET_HEALTH_PACKET: case ProtocolInfo::SET_HEALTH_PACKET:
continue; continue;
@ -1588,8 +1588,7 @@ class Player{
if(!($this->entity instanceof Entity)){ if(!($this->entity instanceof Entity)){
break; break;
} }
$blockVector = new Vector3($packet->x, $packet->y, $packet->z); $blockVector = new Vector3($packet->x, $packet->y, $packet->z);
if(($this->spawned === false or $this->blocked === true) and $packet->face >= 0 and $packet->face <= 5){ if(($this->spawned === false or $this->blocked === true) and $packet->face >= 0 and $packet->face <= 5){
@ -1631,7 +1630,7 @@ class Player{
$data["posX"] = $packet->posX; $data["posX"] = $packet->posX;
$data["posY"] = $packet->posY; $data["posY"] = $packet->posY;
$data["posZ"] = $packet->posZ; $data["posZ"] = $packet->posZ;
if($packet->face >= 0 and $packet->face <= 5){ //Use Block, place if($packet->face >= 0 and $packet->face <= 5){ //Use Block, place
if($this->entity->inAction === true){ if($this->entity->inAction === true){
$this->entity->inAction = false; $this->entity->inAction = false;
@ -1639,6 +1638,7 @@ class Player{
} }
if($this->blocked === true or ($this->entity->position instanceof Vector3 and $blockVector->distance($this->entity->position) > 10)){ if($this->blocked === true or ($this->entity->position instanceof Vector3 and $blockVector->distance($this->entity->position) > 10)){
}elseif($this->getSlot($this->slot)->getID() !== $packet->item or ($this->getSlot($this->slot)->isTool() === false and $this->getSlot($this->slot)->getMetadata() !== $packet->meta)){ }elseif($this->getSlot($this->slot)->getID() !== $packet->item or ($this->getSlot($this->slot)->isTool() === false and $this->getSlot($this->slot)->getMetadata() !== $packet->meta)){
$this->sendInventorySlot($this->slot); $this->sendInventorySlot($this->slot);
}else{ }else{
@ -2042,15 +2042,15 @@ class Player{
$pk->y = $this->windows[$packet->windowid]->y; $pk->y = $this->windows[$packet->windowid]->y;
$pk->z = $this->windows[$packet->windowid]->z; $pk->z = $this->windows[$packet->windowid]->z;
$pk->case1 = 1; $pk->case1 = 1;
$pk->case2 = 2; $pk->case2 = 0;
$this->server->api->player->broadcastPacket($this->level->players, $pk); $this->server->api->player->broadcastPacket($this->level->players, $pk);
} }
} }
unset($this->windows[$packet->windowid]); unset($this->windows[$packet->windowid]);
$this->dataPacket(ProtocolInfo::CONTAINER_CLOSE_PACKET, array( $pk = new ContainerClosePacket;
"windowid" => $packet->windowid, $pk->windowid = $packet->windowid;
)); $this->dataPacket($pk);
break; break;
case ProtocolInfo::CONTAINER_SET_SLOT_PACKET: case ProtocolInfo::CONTAINER_SET_SLOT_PACKET:
if($this->spawned === false or $this->blocked === true){ if($this->spawned === false or $this->blocked === true){

View File

@ -27,7 +27,7 @@ class ContainerClosePacket extends RakNetDataPacket{
} }
public function decode(){ public function decode(){
$this->windowid = $this->getInt(); $this->windowid = $this->getByte();
} }
public function encode(){ public function encode(){

View File

@ -32,8 +32,8 @@ class RemoveBlockPacket extends RakNetDataPacket{
public function decode(){ public function decode(){
$this->eid = $this->getInt(); $this->eid = $this->getInt();
$this->x = $this->getInt(); $this->x = $this->getInt();
$this->y = $this->getInt();
$this->z = $this->getInt(); $this->z = $this->getInt();
$this->y = $this->getByte();
} }
public function encode(){ public function encode(){

View File

@ -28,7 +28,7 @@ class Cache{
public static function get($identifier){ public static function get($identifier){
if(isset(self::$cached[$identifier])){ if(isset(self::$cached[$identifier])){
self::$cached[$identifier][1] += $minTTL; self::$cached[$identifier][1] = microtime(true) + self::$cached[$identifier][2];
return self::$cached[$identifier][0]; return self::$cached[$identifier][0];
} }
return false; return false;

View File

@ -1000,9 +1000,9 @@ class Entity extends Position{
$this->server->api->dhandle("entity.event", array("entity" => $this, "event" => 2)); //Ouch! sound $this->server->api->dhandle("entity.event", array("entity" => $this, "event" => 2)); //Ouch! sound
} }
if($this->player instanceof Player){ if($this->player instanceof Player){
$this->player->dataPacket(ProtocolInfo::SET_HEALTH_PACKET, array( $pk = new SetHealthPacket;
"health" => $this->health, $pk->health = $this->health;
)); $this->player->dataPacket($pk);
} }
if($this->health <= 0 and $this->dead === false){ if($this->health <= 0 and $this->dead === false){
$this->spawnDrops(); $this->spawnDrops();