mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Item: Remove redundant Level parameter from onActivate()
there are three other sources this could be gotten from, an arbitrary level doesn't make sense.
This commit is contained in:
parent
3842ee15cf
commit
6c8a1a5b80
@ -51,7 +51,7 @@ class Bucket extends Item implements Consumable{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
$resultBlock = BlockFactory::get($this->meta);
|
||||
|
||||
if($resultBlock instanceof Air){
|
||||
|
@ -36,8 +36,10 @@ class FlintSteel extends Tool{
|
||||
parent::__construct(self::FLINT_STEEL, $meta, "Flint and Steel");
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
if($blockReplace->getId() === self::AIR and ($blockClicked instanceof Solid)){
|
||||
$level = $player->getLevel();
|
||||
assert($level !== null);
|
||||
$level->setBlock($blockReplace, BlockFactory::get(Block::FIRE), true);
|
||||
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
|
||||
|
||||
|
@ -792,7 +792,6 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
/**
|
||||
* Called when a player uses this item on a block.
|
||||
*
|
||||
* @param Level $level
|
||||
* @param Player $player
|
||||
* @param Block $blockReplace
|
||||
* @param Block $blockClicked
|
||||
@ -801,7 +800,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Painting extends Item{
|
||||
parent::__construct(self::PAINTING, $meta, "Painting");
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
if($blockClicked->isTransparent() === false and $face > 1 and $blockReplace->isSolid() === false){
|
||||
$faces = [
|
||||
2 => 1,
|
||||
|
@ -34,14 +34,14 @@ class SpawnEgg extends Item{
|
||||
parent::__construct(self::SPAWN_EGG, $meta, "Spawn Egg");
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
|
||||
$nbt = Entity::createBaseNBT($blockReplace->add(0.5, 0, 0.5), null, lcg_value() * 360, 0);
|
||||
|
||||
if($this->hasCustomName()){
|
||||
$nbt->setString("CustomName", $this->getCustomName());
|
||||
}
|
||||
|
||||
$entity = Entity::createEntity($this->meta, $level, $nbt);
|
||||
$entity = Entity::createEntity($this->meta, $player->getLevel(), $nbt);
|
||||
|
||||
if($entity instanceof Entity){
|
||||
--$this->count;
|
||||
|
@ -1854,7 +1854,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!$player->isSneaking() and $item->onActivate($this, $player, $blockReplace, $blockClicked, $face, $clickVector)){
|
||||
if(!$player->isSneaking() and $item->onActivate($player, $blockReplace, $blockClicked, $face, $clickVector)){
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user