mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 04:00:29 +00:00
Refactor Block & Tile: getPos() to getPosition() (#4395)
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
This commit is contained in:
@@ -46,8 +46,8 @@ class Bucket extends Item{
|
||||
$ev = new PlayerBucketFillEvent($player, $blockReplace, $face, $this, $resultItem);
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$player->getWorld()->setBlock($blockClicked->getPos(), VanillaBlocks::AIR());
|
||||
$player->getWorld()->addSound($blockClicked->getPos()->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
||||
$player->getWorld()->setBlock($blockClicked->getPosition(), VanillaBlocks::AIR());
|
||||
$player->getWorld()->addSound($blockClicked->getPosition()->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
||||
if($player->hasFiniteResources()){
|
||||
if($stack->getCount() === 0){
|
||||
$player->getInventory()->setItemInHand($ev->getItem());
|
||||
|
@@ -35,8 +35,8 @@ class FlintSteel extends Tool{
|
||||
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());
|
||||
$world->addSound($blockReplace->getPos()->add(0.5, 0.5, 0.5), new FlintSteelSound());
|
||||
$world->setBlock($blockReplace->getPosition(), VanillaBlocks::FIRE());
|
||||
$world->addSound($blockReplace->getPosition()->add(0.5, 0.5, 0.5), new FlintSteelSound());
|
||||
|
||||
$this->applyDamage(1);
|
||||
|
||||
|
@@ -67,8 +67,8 @@ class LiquidBucket extends Item{
|
||||
$ev = new PlayerBucketEmptyEvent($player, $blockReplace, $face, $this, VanillaItems::BUCKET());
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$player->getWorld()->setBlock($blockReplace->getPos(), $resultBlock->getFlowingForm());
|
||||
$player->getWorld()->addSound($blockReplace->getPos()->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
$player->getWorld()->setBlock($blockReplace->getPosition(), $resultBlock->getFlowingForm());
|
||||
$player->getWorld()->addSound($blockReplace->getPosition()->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
|
||||
if($player->hasFiniteResources()){
|
||||
$player->getInventory()->setItemInHand($ev->getItem());
|
||||
|
@@ -51,7 +51,7 @@ class PaintingItem extends Item{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(Painting::canFit($player->getWorld(), $blockReplace->getPos(), $face, true, $motive)){
|
||||
if(Painting::canFit($player->getWorld(), $blockReplace->getPosition(), $face, true, $motive)){
|
||||
if($currentTotalDimension > $totalDimension){
|
||||
$totalDimension = $currentTotalDimension;
|
||||
/*
|
||||
@@ -73,8 +73,8 @@ class PaintingItem extends Item{
|
||||
/** @var PaintingMotive $motive */
|
||||
$motive = $motives[array_rand($motives)];
|
||||
|
||||
$replacePos = $blockReplace->getPos();
|
||||
$clickedPos = $blockClicked->getPos();
|
||||
$replacePos = $blockReplace->getPosition();
|
||||
$clickedPos = $blockClicked->getPosition();
|
||||
|
||||
$entity = new Painting(Location::fromObject($replacePos, $replacePos->getWorld()), $clickedPos, $face, $motive);
|
||||
$this->pop();
|
||||
|
@@ -35,7 +35,7 @@ abstract class SpawnEgg extends Item{
|
||||
abstract protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity;
|
||||
|
||||
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);
|
||||
$entity = $this->createEntity($player->getWorld(), $blockReplace->getPosition()->add(0.5, 0, 0.5), lcg_value() * 360, 0);
|
||||
|
||||
if($this->hasCustomName()){
|
||||
$entity->setNameTag($this->getCustomName());
|
||||
|
Reference in New Issue
Block a user