Refactor confusing parameter names for Item->onActivate()

next: refactor the function itself
This commit is contained in:
Dylan K. Taylor
2017-10-16 13:30:36 +01:00
parent af85659c63
commit 769a50faa5
5 changed files with 23 additions and 23 deletions

View File

@ -36,10 +36,10 @@ class FlintSteel extends Tool{
parent::__construct(self::FLINT_STEEL, $meta, "Flint and Steel");
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, int $face, Vector3 $facePos) : bool{
if($block->getId() === self::AIR and ($target instanceof Solid)){
$level->setBlock($block, BlockFactory::get(Block::FIRE), true);
$level->broadcastLevelSoundEvent($block->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos) : bool{
if($blockReplace->getId() === self::AIR and ($blockClicked instanceof Solid)){
$level->setBlock($blockReplace, BlockFactory::get(Block::FIRE), true);
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
$this->applyDamage(1);