Fixed setting chunks on non-loaded regions

This commit is contained in:
Shoghi Cervantes 2014-06-15 14:50:49 +02:00
parent a5e78d775b
commit ed5325c069
2 changed files with 5 additions and 0 deletions

View File

@ -183,6 +183,7 @@ class Anvil extends BaseLevelProvider{
public function setChunk($chunkX, $chunkZ, SimpleChunk $chunk){
if($chunk->isGenerated() === false){
$this->unloadChunk($chunkX, $chunkZ, false);
$this->loadRegion($chunkX >> 4, $chunkZ >> 4);
$region = $this->getRegion($chunkX >> 4, $chunkZ >> 4);
$region->removeChunk($chunkX - $region->getX() * 32, $chunkZ - $region->getZ() * 32);
$this->loadChunk($chunkX, $chunkZ);

View File

@ -63,8 +63,12 @@ class GenerationThread extends \Thread{
$this->internalSocket = $sockets[0];
socket_set_block($this->internalSocket); //IMPORTANT!
@socket_set_option($this->internalSocket, SOL_SOCKET, SO_SNDBUF, 1024 * 1024 * 2);
@socket_set_option($this->internalSocket, SOL_SOCKET, SO_RCVBUF, 1024 * 1024 * 2);
$this->externalSocket = $sockets[1];
socket_set_nonblock($this->externalSocket);
@socket_set_option($this->externalSocket, SOL_SOCKET, SO_SNDBUF, 1024 * 1024 * 2);
@socket_set_option($this->externalSocket, SOL_SOCKET, SO_RCVBUF, 1024 * 1024 * 2);
$this->start(PTHREADS_INHERIT_ALL & ~PTHREADS_INHERIT_CLASSES);
}