diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index b7d721ac2..56c2763bf 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -391,8 +391,16 @@ class BlockAPI{ }else{ return $this->cancelAction($block); } + $entity = $this->server->api->entity->get($data["eid"]); + if(($entity instanceof Entity) !== true){ + return $this->cancelAction($block); //No Entity WTF? + } + + if($entity->inBlock($block[2][0], $block[2][1], $block[2][2])){ + return $this->cancelAction($block); //Entity in block + } - $direction = $this->server->api->entity->get($data["eid"])->getDirection(); + $direction = $entity->getDirection(); switch($data["block"]){ case 6: diff --git a/src/classes/Entity.class.php b/src/classes/Entity.class.php index af421dc23..62b289f80 100644 --- a/src/classes/Entity.class.php +++ b/src/classes/Entity.class.php @@ -229,6 +229,16 @@ class Entity extends stdClass{ $this->server->api->dhandle("entity.move", $this); } + public function inBlock($x, $y, $z){ + $block = new Vector3($x + 0.5, $y, $z + 0.5); + $me = new Vector3($this->x, $this->y, $this->z); + $up = new Vector3($this->x, $this->y + 1, $this->z); + if($block->distance($me) < 0.8 or $block->distance($up) < 0.8){ + return true; + } + return false; + } + public function updateVelocity(){ $diffTime = microtime(true) - $this->last[3]; $this->last[3] = microtime(true); diff --git a/src/classes/PocketMinecraftServer.class.php b/src/classes/PocketMinecraftServer.class.php index 78b3d51d8..8cfd49d41 100644 --- a/src/classes/PocketMinecraftServer.class.php +++ b/src/classes/PocketMinecraftServer.class.php @@ -32,7 +32,7 @@ class PocketMinecraftServer{ private function load(){ $this->version = new VersionString(); console("[INFO] PocketMine-MP ".MAJOR_VERSION." #".$this->version->getNumber()." by @shoghicp, LGPL License", true, true, 0); - console("[DEBUG] Target Minecraft PE: ".CURRENT_MINECRAFT_VERSION, true, true, 2); + console("[DEBUG] Target Minecraft PE: ".CURRENT_MINECRAFT_VERSION.", protocol #".CURRENT_PROTOCOL, true, true, 2); console("[INFO] Starting Minecraft PE Server at *:".$this->port); if($this->port < 19132 or $this->port > 19135){ console("[WARNING] You've selected a not-standard port. Normal port range is from 19132 to 19135 included"); @@ -72,8 +72,7 @@ class PocketMinecraftServer{ $this->interface = new MinecraftInterface("255.255.255.255", $this->port, true, false); $this->reloadConfig(); console("[INFO] Server Name: ".$this->name); - console("[INFO] Server GUID: ".$this->serverID); - console("[INFO] Protocol Version: ".CURRENT_PROTOCOL); + console("[DEBUG] Server GUID: ".$this->serverID, true, true, 2); $this->stop = false; }