diff --git a/src/Player.php b/src/Player.php index b61c6d1fd..412bb5f3e 100644 --- a/src/Player.php +++ b/src/Player.php @@ -1718,9 +1718,8 @@ class Player{ $this->toCraft = array(); if(isset($this->windows[$data["windowid"]])){ if(is_array($this->windows[$data["windowid"]])){ - $all = $this->server->api->player->getAll($this->level); foreach($this->windows[$data["windowid"]] as $ob){ - $this->server->api->player->broadcastPacket($all, MC_TILE_EVENT, array( + $this->server->api->player->broadcastPacket($this->level->players, MC_TILE_EVENT, array( "x" => $ob->x, "y" => $ob->y, "z" => $ob->z, diff --git a/src/material/block/DoorBlock.php b/src/material/block/DoorBlock.php index 4d255fba0..6d6ac1d98 100644 --- a/src/material/block/DoorBlock.php +++ b/src/material/block/DoorBlock.php @@ -89,12 +89,30 @@ class DoorBlock extends TransparentBlock{ if($down->getID() === $this->id){ $meta = $down->getMetadata() ^ 0x04; $this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + ServerAPI::request()->api->player->broadcastPacket($players, MC_LEVEL_EVENT, array( + "x" => $this->x, + "y" => $this->y, + "z" => $this->z, + "evid" => 1003, + "data" => 0 + )); return true; } return false; }else{ $this->meta ^= 0x04; $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + ServerAPI::request()->api->player->broadcastPacket($players, MC_LEVEL_EVENT, array( + "x" => $this->x, + "y" => $this->y, + "z" => $this->z, + "evid" => 1003, + "data" => 0 + )); } return true; } diff --git a/src/network/CustomPacketHandler.php b/src/network/CustomPacketHandler.php index 157007e17..78206b39c 100644 --- a/src/network/CustomPacketHandler.php +++ b/src/network/CustomPacketHandler.php @@ -475,17 +475,17 @@ class CustomPacketHandler{ break; case MC_LEVEL_EVENT: if($this->c === false){ - $this->data["unknown1"] = Utils::readShort($this->get(2)); - $this->data["unknown2"] = Utils::readShort($this->get(2)); - $this->data["unknown3"] = Utils::readShort($this->get(2)); - $this->data["unknown4"] = Utils::readShort($this->get(2)); - $this->data["unknown5"] = Utils::readInt($this->get(4)); + $this->data["evid"] = Utils::readShort($this->get(2)); + $this->data["x"] = Utils::readShort($this->get(2)); + $this->data["y"] = Utils::readShort($this->get(2)); + $this->data["z"] = Utils::readShort($this->get(2)); + $this->data["data"] = Utils::readInt($this->get(4)); }else{ - $this->raw .= Utils::writeShort($this->data["unknown1"]); - $this->raw .= Utils::writeShort($this->data["unknown2"]); - $this->raw .= Utils::writeShort($this->data["unknown3"]); - $this->raw .= Utils::writeShort($this->data["unknown4"]); - $this->raw .= Utils::writeInt($this->data["unknown5"]); + $this->raw .= Utils::writeShort($this->data["evid"]); + $this->raw .= Utils::writeShort($this->data["x"]); + $this->raw .= Utils::writeShort($this->data["y"]); + $this->raw .= Utils::writeShort($this->data["z"]); + $this->raw .= Utils::writeInt($this->data["data"]); } break; case MC_TILE_EVENT: