mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
World: rename getChunkAtPosition() to getOrLoadChunkAtPosition()
this more accurately reflects what it does.
This commit is contained in:
parent
bd78d0bff8
commit
5cc2a9c3dd
@ -147,7 +147,7 @@ class Block{
|
||||
}
|
||||
|
||||
public function writeStateToWorld() : void{
|
||||
$this->pos->getWorld()->getChunkAtPosition($this->pos)->setFullBlock($this->pos->x & 0xf, $this->pos->y, $this->pos->z & 0xf, $this->getFullId());
|
||||
$this->pos->getWorld()->getOrLoadChunkAtPosition($this->pos)->setFullBlock($this->pos->x & 0xf, $this->pos->y, $this->pos->z & 0xf, $this->getFullId());
|
||||
|
||||
$tileType = $this->idInfo->getTileClass();
|
||||
$oldTile = $this->pos->getWorld()->getTile($this->pos);
|
||||
|
@ -243,7 +243,7 @@ abstract class Entity{
|
||||
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
$this->recalculateBoundingBox();
|
||||
|
||||
$this->chunk = $this->getWorld()->getChunkAtPosition($this->location, false);
|
||||
$this->chunk = $this->getWorld()->getOrLoadChunkAtPosition($this->location, false);
|
||||
if($this->chunk === null){
|
||||
throw new \InvalidStateException("Cannot create entities in unloaded chunks");
|
||||
}
|
||||
|
@ -1936,7 +1936,7 @@ class World implements ChunkManager{
|
||||
/**
|
||||
* Returns the chunk containing the given Vector3 position.
|
||||
*/
|
||||
public function getChunkAtPosition(Vector3 $pos, bool $create = false) : ?Chunk{
|
||||
public function getOrLoadChunkAtPosition(Vector3 $pos, bool $create = false) : ?Chunk{
|
||||
return $this->getOrLoadChunk($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4, $create);
|
||||
}
|
||||
|
||||
@ -2342,7 +2342,7 @@ class World implements ChunkManager{
|
||||
|
||||
$max = $this->worldHeight;
|
||||
$v = $spawn->floor();
|
||||
$chunk = $this->getChunkAtPosition($v, false);
|
||||
$chunk = $this->getOrLoadChunkAtPosition($v, false);
|
||||
$x = (int) $v->x;
|
||||
$y = $v->y;
|
||||
$z = (int) $v->z;
|
||||
|
Loading…
x
Reference in New Issue
Block a user