Block update on WallSign fix

This commit is contained in:
Intyre 2015-10-11 01:32:33 +02:00
parent 94b79ac28a
commit f9d7e204c8
No known key found for this signature in database
GPG Key ID: B06D41D26935005A
2 changed files with 17 additions and 1 deletions

View File

@ -88,7 +88,7 @@ class SignPost extends Transparent{
}
public function onBreak(Item $item){
$this->getLevel()->setBlock($this, new Air(), true, true, true);
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}

View File

@ -22,6 +22,8 @@
namespace pocketmine\block;
use pocketmine\level\Level;
class WallSign extends SignPost{
protected $id = self::WALL_SIGN;
@ -31,6 +33,20 @@ class WallSign extends SignPost{
}
public function onUpdate($type){
$faces = [
2 => 3,
3 => 2,
4 => 5,
5 => 4,
];
if($type === Level::BLOCK_UPDATE_NORMAL){
if(isset($faces[$this->meta])) {
if ($this->getSide($faces[$this->meta])->getId() === self::AIR) {
$this->getLevel()->useBreakOn($this);
}
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
}