mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Make Block->position() accept Level,x,y,z instead of Position
since this is an internal method, it doesn't make sense to force a single parameter that requires potentially constructing a separate object just for the parameters, so we pass primitives instead, which are also easier to typehint against.
This commit is contained in:
@ -30,6 +30,7 @@ use pocketmine\entity\Entity;
|
||||
use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
@ -466,15 +467,18 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block position to a new Position object
|
||||
* @internal
|
||||
*
|
||||
* @param Position $v
|
||||
* @param Level $level
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $z
|
||||
*/
|
||||
final public function position(Position $v) : void{
|
||||
$this->x = (int) $v->x;
|
||||
$this->y = (int) $v->y;
|
||||
$this->z = (int) $v->z;
|
||||
$this->level = $v->level;
|
||||
final public function position(Level $level, int $x, int $y, int $z) : void{
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
$this->z = $z;
|
||||
$this->level = $level;
|
||||
$this->readStateFromWorld();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user