From dfd06ac3f7cf5f194d8d8833b6d815ef0175f493 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 26 Dec 2012 19:44:16 +0100 Subject: [PATCH] Correct bed placing --- classes/API/BlockAPI.php | 20 ++++++++++++++++++++ classes/Data.class.php | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/classes/API/BlockAPI.php b/classes/API/BlockAPI.php index 28574d609..e0cdd664b 100644 --- a/classes/API/BlockAPI.php +++ b/classes/API/BlockAPI.php @@ -398,6 +398,26 @@ class BlockAPI{ ); $data["meta"] = $faces[$direction]; break; + case 26: //bed + $face = array( + 0 => 3, + 1 => 4, + 2 => 2, + 3 => 5, + ); + $next = $this->server->api->level->getBlockFace($block, $face[(($direction + 3) % 4)]); + if(!isset(Material::$replaceable[$next[0]])){ + return false; + } + $data["meta"] = (($direction + 3) % 4) & 0x3; + $data2 = $data; + $data2["meta"] = $data2["meta"] | 0x08; + $data2["x"] = $next[2][0]; + $data2["y"] = $next[2][1]; + $data2["z"] = $next[2][2]; + $this->server->trigger("player.block.place", $data2); + $this->updateBlocksAround($data2["x"], $data2["y"], $data2["z"], BLOCK_UPDATE_NORMAL); + break; case 65: //Ladder if(isset(Material::$transparent[$target[0]])){ return false; diff --git a/classes/Data.class.php b/classes/Data.class.php index 1a4991925..ed9e25f2d 100644 --- a/classes/Data.class.php +++ b/classes/Data.class.php @@ -176,7 +176,7 @@ class Material{ 21 => true, 22 => true, 24 => true, - //355 => 26, + 355 => 26, 30 => true, 35 => true, 37 => true,