diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 895cc4515..06c6de675 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -126,11 +126,18 @@ class BlockAPI{ case 107: case 108: case 109: + case 114: + case 128: + case 156: $drop[1] = 0; break; case 56: $drop = array(264, 0, 1); break; + case 63: + case 68: + $drop = array(323, 0, 1); + break; case 73: case 74: $drop = array(351, 4, mt_rand(4, 5)); @@ -619,6 +626,27 @@ class BlockAPI{ return false; } break; + case 323: //Signs + $faces = array( + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + ); + if(!isset($faces[$data["face"]])){ + if($data["face"] === 1){ + $data["block"] = 63; + $data["meta"] = 0; + $this->server->api->tileentity->addSign($data["x"], $data["y"], $data["z"]); + }else{ + return false; + } + }else{ + $data["block"] = 68; + $data["meta"] = $faces[$data["face"]]; + $this->server->api->tileentity->addSign($data["x"], $data["y"], $data["z"]); + } + break; } $this->server->handle("player.block.place", $data); return false; diff --git a/src/API/LevelAPI.php b/src/API/LevelAPI.php index 0a46e2266..09ceddf20 100644 --- a/src/API/LevelAPI.php +++ b/src/API/LevelAPI.php @@ -104,7 +104,7 @@ class LevelAPI{ if($tiles === true){ if(($t = $this->server->api->tileentity->get($x, $y, $z)) !== false){ $t[0]->close(); - } + } } } return true; diff --git a/src/API/TileEntityAPI.php b/src/API/TileEntityAPI.php index 4e851300d..a29bdaaf4 100644 --- a/src/API/TileEntityAPI.php +++ b/src/API/TileEntityAPI.php @@ -70,8 +70,22 @@ class TileEntityAPI{ public function add($class, $x, $y, $z, $data = array()){ $id = $this->tCnt++; $this->server->tileEntities[$id] = new TileEntity($this->server, $id, $class, $x, $y, $z, $data); + $this->spawnToAll($id); return $this->server->tileEntities[$id]; } + + public function addSign($x, $y, $z, $lines = array("", "", "", "")){ + return $this->add(TILE_SIGN, $x, $y, $z, $data = array( + "id" => "Sign", + "x" => $x, + "y" => $y, + "z" => $z, + "Text1" => $lines[0], + "Text2" => $lines[1], + "Text3" => $lines[2], + "Text4" => $lines[3], + )); + } public function spawnTo($id, $player){ $t = $this->getByID($id); diff --git a/src/classes/Data.php b/src/classes/Data.php index e903099d2..d0ff148dc 100644 --- a/src/classes/Data.php +++ b/src/classes/Data.php @@ -241,6 +241,7 @@ class Material{ 156 => true, 246 => true, 247 => true, + 323 => true, //Special case of signs ); static $blocks = array( 0 => "Air", diff --git a/src/classes/Player.php b/src/classes/Player.php index 1e2967bc5..05c981b4a 100644 --- a/src/classes/Player.php +++ b/src/classes/Player.php @@ -479,6 +479,7 @@ class Player{ } $this->inventory[$s] = array(0, 0, 0); } + $this->entity->setPosition($this->entity->x, $this->entity->y, $this->entity->z, 0, 0); break; case 2://Chunk loaded? break;