Added Iron Doors

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-07 16:02:23 +01:00
parent 47e80151e6
commit 90d9099b3c
2 changed files with 25 additions and 1 deletions

View File

@ -175,7 +175,7 @@ class BlockAPI{
case 2:
$drop = array(3, 0, 1);
break;
case 64: //Door
case 64: //Wood Door
$drop = array(324, 0, 1);
if(($target[1] & 0x08) === 0x08){
$down = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
@ -193,6 +193,24 @@ class BlockAPI{
}
}
break;
case 71: //Iron Door
$drop = array(330, 0, 1);
if(($target[1] & 0x08) === 0x08){
$down = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
if($down[0] === 71){
$data2 = $data;
--$data2["y"];
$this->server->trigger("player.block.break", $data2);
}
}else{
$up = $this->server->api->level->getBlock($data["x"], $data["y"] + 1, $data["z"]);
if($up[0] === 71){
$data2 = $data;
++$data2["y"];
$this->server->trigger("player.block.break", $data2);
}
}
break;
}
if($drop !== false and $drop[0] !== 0 and $drop[2] > 0){
$this->drop($data["x"], $data["y"], $data["z"], $drop[0], $drop[1] & 0x0F, $drop[2] & 0xFF);
@ -462,6 +480,10 @@ class BlockAPI{
$data["meta"] = $faces[$direction] & 0x03;
break;
case 64://Door placing
case 71:
if($data["face"] !== 0){
return false;
}
$blockUp = $this->server->api->level->getBlock($data["x"], $data["y"] + 1, $data["z"]);
$blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
if(!isset(Material::$replaceable[$blockUp[0]]) or isset(Material::$transparent[$blockDown[0]])){

View File

@ -146,6 +146,7 @@ class Material{
61 => true,
62 => true,
64 => true,
71 => true,
78 => true,
96 => true,
105 => true,
@ -204,6 +205,7 @@ class Material{
324 => 64,
65 => true,
67 => true,
330 => 71,
73 => true,
79 => true,
80 => true,