Added Chest & Furnace placement

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-03 22:50:59 +01:00
parent a5651c0f43
commit afe33202dc
5 changed files with 56 additions and 5 deletions

View File

@ -30,7 +30,19 @@ class BurningFurnaceBlock extends SolidBlock{
parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
$faces = array(
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
$level->setBlock($block, $this->id, $faces[$player->entity->getDirection()]);
return true;
}
return false;
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(

View File

@ -30,5 +30,22 @@ class ChestBlock extends SolidBlock{
parent::__construct(CHEST, $meta, "Chest");
$this->isActivable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
$faces = array(
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
$level->setBlock($block, $this->id, $faces[$player->entity->getDirection()]);
return true;
}
return false;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
}

View File

@ -30,7 +30,19 @@ class FurnaceBlock extends SolidBlock{
parent::__construct(FURNACE, $meta, "Furnace");
$this->isActivable = true;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true){
$faces = array(
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
$level->setBlock($block, $this->id, $faces[$player->entity->getDirection()]);
return true;
}
return false;
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(

View File

@ -30,5 +30,10 @@ class StonecutterBlock extends SolidBlock{
parent::__construct(STONECUTTER, $meta, "Stonecutter");
$this->isActivable = true;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
}

View File

@ -30,5 +30,10 @@ class WorkbenchBlock extends SolidBlock{
parent::__construct(WORKBENCH, $meta, "Crafting Table");
$this->isActivable = true;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
}