mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Item: rename onActivate() to onInteractBlock()
This commit is contained in:
parent
8c480ffab9
commit
6cf875ca3a
@ -36,7 +36,7 @@ class Bucket extends Item{
|
||||
return 16;
|
||||
}
|
||||
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
//TODO: move this to generic placement logic
|
||||
if($blockClicked instanceof Liquid and $blockClicked->isSource()){
|
||||
$stack = clone $this;
|
||||
|
@ -32,7 +32,7 @@ use pocketmine\world\sound\FlintSteelSound;
|
||||
|
||||
class FlintSteel extends Tool{
|
||||
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
if($blockReplace->getId() === BlockLegacyIds::AIR){
|
||||
$world = $player->getWorld();
|
||||
$world->setBlock($blockReplace->getPos(), VanillaBlocks::FIRE());
|
||||
|
@ -500,7 +500,7 @@ class Item implements \JsonSerializable{
|
||||
/**
|
||||
* Called when a player uses this item on a block.
|
||||
*/
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
return ItemUseResult::NONE();
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class LiquidBucket extends Item{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
if(!$blockReplace->canBeReplaced()){
|
||||
return ItemUseResult::NONE();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ use function count;
|
||||
|
||||
class PaintingItem extends Item{
|
||||
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
if(Facing::axis($face) === Axis::Y){
|
||||
return ItemUseResult::NONE();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ abstract class SpawnEgg extends Item{
|
||||
|
||||
abstract protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity;
|
||||
|
||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
||||
$entity = $this->createEntity($player->getWorld(), $blockReplace->getPos()->add(0.5, 0, 0.5), lcg_value() * 360, 0);
|
||||
|
||||
if($this->hasCustomName()){
|
||||
|
@ -1618,7 +1618,7 @@ class World implements ChunkManager{
|
||||
return true;
|
||||
}
|
||||
|
||||
$result = $item->onActivate($player, $blockReplace, $blockClicked, $face, $clickVector);
|
||||
$result = $item->onInteractBlock($player, $blockReplace, $blockClicked, $face, $clickVector);
|
||||
if(!$result->equals(ItemUseResult::NONE())){
|
||||
return $result->equals(ItemUseResult::SUCCESS());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user