本文整理汇总了PHP中pocketmine\level\ChunkManager::setChunk方法的典型用法代码示例。如果您正苦于以下问题:PHP ChunkManager::setChunk方法的具体用法?PHP ChunkManager::setChunk怎么用?PHP ChunkManager::setChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\ChunkManager
的用法示例。
在下文中一共展示了ChunkManager::setChunk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateChunk
public function generateChunk($chunkX, $chunkZ)
{
if ($this->emptyChunk !== null) {
//Use the cached empty chunk instead of generating a new one
$this->chunk = clone $this->emptyChunk;
} else {
$this->chunk = clone $this->level->getChunk($chunkX, $chunkZ);
$this->chunk->setGenerated();
$c = Biome::getBiome(1)->getColor();
$R = $c >> 16;
$G = $c >> 8 & 0xff;
$B = $c & 0xff;
for ($Z = 0; $Z < 16; ++$Z) {
for ($X = 0; $X < 16; ++$X) {
$this->chunk->setBiomeId($X, $Z, 1);
$this->chunk->setBiomeColor($X, $Z, $R, $G, $B);
for ($y = 0; $y < 128; ++$y) {
$this->chunk->setBlockId($X, $y, $Z, Block::AIR);
}
}
}
$spawn = $this->getSpawn();
if ($spawn->getX() >> 4 === $chunkX and $spawn->getZ() >> 4 === $chunkZ) {
$this->chunk->setBlockId(0, 64, 0, Block::GRASS);
} else {
$this->emptyChunk = $this->chunk;
}
}
$chunk = clone $this->chunk;
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
}
示例2: generateChunk
public function generateChunk($chunkX, $chunkZ)
{
if ($this->chunk === null) {
if (isset($this->options["preset"]) and $this->options["preset"] != "") {
$this->parsePreset($this->options["preset"], $chunkX, $chunkZ);
} else {
$this->parsePreset($this->preset, $chunkX, $chunkZ);
}
}
$chunk = clone $this->chunk;
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
}
示例3: generateChunk
public function generateChunk($chunkX, $chunkZ)
{
$this->chunk = clone $this->level->getChunk($chunkX, $chunkZ);
$this->chunk->setGenerated();
$c = Biome::getBiome(1)->getColor();
$R = $c >> 16;
$G = $c >> 8 & 0xff;
$B = $c & 0xff;
for ($Z = 0; $Z < 16; ++$Z) {
for ($X = 0; $X < 16; ++$X) {
$this->chunk->setBiomeId($X, $Z, 1);
$this->chunk->setBiomeColor($X, $Z, $R, $G, $B);
for ($y = 0; $y < 128; ++$y) {
$this->chunk->setBlockId($X, $y, $Z, Block::AIR);
}
}
}
$this->chunk->setBlockId(8, 64, 8, Block::GRASS);
$chunk = clone $this->chunk;
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
}
示例4: generateChunk
public function generateChunk($chunkX, $chunkZ)
{
$spawn = $this->getSpawn();
// Adjust spawn so it is relative to current chunk...
$spawn->x = $spawn->x - ($chunkX << 4);
$spawn->z = $spawn->z - ($chunkZ << 4);
$inSpawn = -$this->radius <= $spawn->x && $spawn->x < 16 + $this->radius && -$this->radius <= $spawn->z && $spawn->z < 16 + $this->radius;
if ($inSpawn || $this->chunk === null) {
$chunk = $this->level->getChunk($chunkX, $chunkZ);
$chunk->setGenerated();
$c = Biome::getBiome($this->biome)->getColor();
$R = $c >> 16;
$G = $c >> 8 & 0xff;
$B = $c & 0xff;
$rad2 = $this->radius * $this->radius;
for ($Z = 0; $Z < 16; ++$Z) {
for ($X = 0; $X < 16; ++$X) {
$chunk->setBiomeId($X, $Z, $biome);
$chunk->setBiomeColor($X, $Z, $R, $G, $B);
$chunk->setBlock($X, 0, $Z, $this->baseFloor, 0);
for ($y = 1; $y < 128; ++$y) {
$chunk->setBlock($X, $y, $Z, Block::AIR, 0);
}
if (self::inSpawn($rad2, $spawn->x, $spawn->z, $X, $Z)) {
$chunk->setBlock($X, $this->floorLevel, $Z, $this->block);
}
}
}
if (!$inSpawn) {
$this->chunk = clone $chunk;
}
} else {
$chunk = clone $this->chunk;
}
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
}