Merge branch 'release/3.2' into release/3.3

This commit is contained in:
Dylan K. Taylor
2018-10-21 18:16:59 +01:00
62 changed files with 120 additions and 49 deletions

View File

@ -284,6 +284,7 @@ class Level implements ChunkManager, Metadatable{
/**
* @param string $str
*
* @return int
*/
public static function getDifficultyFromString(string $str) : int{
@ -875,7 +876,7 @@ class Level implements ChunkManager, Metadatable{
$pk->blockRuntimeId = $b->getRuntimeId();
}else{
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
}
$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;
@ -897,7 +898,7 @@ class Level implements ChunkManager, Metadatable{
$pk->blockRuntimeId = $b->getRuntimeId();
}else{
$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
$pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf);
}
$pk->flags = $flags;

View File

@ -51,7 +51,7 @@ class Chunk{
/** @var bool */
protected $isInit = false;
/** @var bool*/
/** @var bool */
protected $lightPopulated = false;
/** @var bool */
protected $terrainGenerated = false;
@ -327,8 +327,8 @@ class Chunk{
/**
* Returns the Y coordinate of the highest non-air block at the specified X/Z chunk block coordinates
*
* @param int $x 0-15
* @param int $z 0-15
* @param int $x 0-15
* @param int $z 0-15
*
* @return int 0-255, or -1 if there are no blocks in the column
*/
@ -366,6 +366,7 @@ class Chunk{
/**
* Returns the heightmap value at the specified X/Z chunk block coordinates
*
* @param int $x 0-15
* @param int $z 0-15
* @param int $value
@ -465,6 +466,7 @@ class Chunk{
/**
* Returns a column of block IDs from bottom to top at the specified X/Z chunk block coordinates.
*
* @param int $x 0-15
* @param int $z 0-15
*
@ -475,11 +477,13 @@ class Chunk{
foreach($this->subChunks as $subChunk){
$result .= $subChunk->getBlockIdColumn($x, $z);
}
return $result;
}
/**
* Returns a column of block meta values from bottom to top at the specified X/Z chunk block coordinates.
*
* @param int $x 0-15
* @param int $z 0-15
*
@ -495,6 +499,7 @@ class Chunk{
/**
* Returns a column of sky light values from bottom to top at the specified X/Z chunk block coordinates.
*
* @param int $x 0-15
* @param int $z 0-15
*
@ -510,6 +515,7 @@ class Chunk{
/**
* Returns a column of block light values from bottom to top at the specified X/Z chunk block coordinates.
*
* @param int $x 0-15
* @param int $z 0-15
*
@ -858,8 +864,8 @@ class Chunk{
$result .= $this->subChunks[$y]->networkSerialize();
}
$result .= pack("v*", ...$this->heightMap)
. $this->biomeIds
. chr(0); //border block array count
. $this->biomeIds
. chr(0); //border block array count
//Border block entry format: 1 byte (4 bits X, 4 bits Z). These are however useless since they crash the regular client.
foreach($this->tiles as $tile){

View File

@ -27,6 +27,7 @@ interface SubChunkInterface{
/**
* @param bool $checkLight
*
* @return bool
*/
public function isEmpty(bool $checkLight = true) : bool;

View File

@ -148,6 +148,7 @@ interface LevelProvider{
/**
* Sets the world difficulty.
*
* @param int $difficulty
*/
public function setDifficulty(int $difficulty);

View File

@ -33,9 +33,9 @@ abstract class Populator{
/**
* @param ChunkManager $level
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
* @param int $chunkX
* @param int $chunkZ
* @param Random $random
*
* @return mixed
*/

View File

@ -109,8 +109,8 @@ class FloatingTextParticle extends Particle{
1 << Entity::DATA_FLAG_IMMOBILE
);
$pk->metadata = [
Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags],
Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT, 0.01] //zero causes problems on debug builds
Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags],
Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT, 0.01] //zero causes problems on debug builds
];
$p[] = $pk;