Basic implementation of Fire

This commit is contained in:
Shoghi Cervantes 2013-06-09 14:59:02 +02:00
parent 2f6ddb6aa4
commit 2976db25c3
14 changed files with 73 additions and 5 deletions

View file

@ -27,8 +27,7 @@ the Free Software Foundation, either version 3 of the License, or
class BucketItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(BUCKET, 0, $count, "Bucket");
$this->meta = $meta;
parent::__construct(BUCKET, $meta, $count, "Bucket");
$this->isActivable = true;
$this->maxStackSize = 1;
}

View file

@ -0,0 +1,44 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class FlintSteelItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(FLINT_STEEL, $meta, $count, "Flint and Steel");
$this->isActivable = true;
$this->maxStackSize = 1;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->getID() === AIR){
$level->setBlock($block, new FireBlock(), true, false, true);
$block->level->scheduleBlockUpdate(new Position($block, 0, 0, $block->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
$this->useOn($block);
return false;
}
}