mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Refactor confusing parameter names for Item->onActivate()
next: refactor the function itself
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user