Place/Breaking/Activation logic separated from BlockAPI

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-03 18:55:59 +01:00
parent 6156baab85
commit d9c87161ba
37 changed files with 387 additions and 216 deletions

View file

@ -29,11 +29,19 @@ the Free Software Foundation, either version 3 of the License, or
class GenericBlock extends Block{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
}
public function onUpdate(LevelAPI $level, $type){
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face){
if($block->inWorld === true){
$level->setBlock($block, $this->id, $this->getMetadata());
return true;
}
return false;
}
public function onActivate(LevelAPI $level, Item $item, Player $player){
public function onUpdate(BlockAPI $level, $type){
return false;
}
public function onActivate(BlockAPI $level, Item $item, Player $player){
return false;
}
}