Nuke block extradata

this has been superseded by multi-layer blockstorages in 1.2.14+
This commit is contained in:
Dylan K. Taylor 2018-04-27 19:51:22 +01:00
parent 172c6420c1
commit 66963fbf9a
3 changed files with 3 additions and 126 deletions

View File

@ -846,25 +846,6 @@ class Level implements ChunkManager, Metadatable{
$this->sleepTicks = $ticks;
}
/**
* @deprecated
*
* @param int $x
* @param int $y
* @param int $z
* @param int $id
* @param int $data
* @param Player[]|null $targets
*/
public function sendBlockExtraData(int $x, int $y, int $z, int $id, int $data, array $targets = null){
$pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_SET_DATA;
$pk->position = new Vector3($x, $y, $z);
$pk->data = ($data << 8) | $id;
$this->server->broadcastPacket($targets ?? $this->getChunkPlayers($x >> 4, $z >> 4), $pk);
}
/**
* @param Player[] $target
* @param Block[] $blocks
@ -2136,37 +2117,6 @@ class Level implements ChunkManager, Metadatable{
}
}
/**
* @deprecated This functionality no longer produces any effect and will be removed in a future release
*
* Gets the raw block extra data
*
* @param int $x
* @param int $y
* @param int $z
*
* @return int 16-bit
*/
public function getBlockExtraDataAt(int $x, int $y, int $z) : int{
return $this->getChunk($x >> 4, $z >> 4, true)->getBlockExtraData($x & 0x0f, $y, $z & 0x0f);
}
/**
* @deprecated This functionality no longer produces any effect and will be removed in a future release
* Sets the raw block metadata.
*
* @param int $x
* @param int $y
* @param int $z
* @param int $id
* @param int $data
*/
public function setBlockExtraDataAt(int $x, int $y, int $z, int $id, int $data){
$this->getChunk($x >> 4, $z >> 4, true)->setBlockExtraData($x & 0x0f, $y, $z & 0x0f, ($data << 8) | $id);
$this->sendBlockExtraData($x, $y, $z, $id, $data);
}
/**
* Gets the raw block metadata
*

View File

@ -81,9 +81,6 @@ class Chunk{
/** @var string */
protected $biomeIds;
/** @var int[] */
protected $extraData = [];
/** @var CompoundTag[] */
protected $NBTtiles = [];
@ -98,9 +95,8 @@ class Chunk{
* @param CompoundTag[] $tiles
* @param string $biomeIds
* @param int[] $heightMap
* @param int[] $extraData @deprecated
*/
public function __construct(int $chunkX, int $chunkZ, array $subChunks = [], array $entities = [], array $tiles = [], string $biomeIds = "", array $heightMap = [], array $extraData = []){
public function __construct(int $chunkX, int $chunkZ, array $subChunks = [], array $entities = [], array $tiles = [], string $biomeIds = "", array $heightMap = []){
$this->x = $chunkX;
$this->z = $chunkZ;
@ -128,8 +124,6 @@ class Chunk{
$this->biomeIds = str_repeat("\x00", 256);
}
$this->extraData = $extraData;
$this->NBTtiles = $tiles;
$this->NBTentities = $entities;
}
@ -254,37 +248,6 @@ class Chunk{
}
}
/**
* @deprecated This functionality no longer produces any visible effects and will be removed in a future release
*
* @param int $x 0-15
* @param int $y
* @param int $z 0-15
*
* @return int bitmap, (meta << 8) | id
*/
public function getBlockExtraData(int $x, int $y, int $z) : int{
return $this->extraData[Chunk::chunkBlockHash($x, $y, $z)] ?? 0;
}
/**
* @deprecated This functionality no longer produces any visible effects and will be removed in a future release
*
* @param int $x 0-15
* @param int $y
* @param int $z 0-15
* @param int $data bitmap, (meta << 8) | id
*/
public function setBlockExtraData(int $x, int $y, int $z, int $data){
if($data === 0){
unset($this->extraData[Chunk::chunkBlockHash($x, $y, $z)]);
}else{
$this->extraData[Chunk::chunkBlockHash($x, $y, $z)] = $data;
}
$this->hasChanged = true;
}
/**
* Returns the sky light level at the specified chunk block coordinates
*
@ -779,14 +742,6 @@ class Chunk{
return $this->heightMap;
}
/**
* @deprecated
* @return int[]
*/
public function getBlockExtraDataArray() : array{
return $this->extraData;
}
/**
* @return bool
*/
@ -970,21 +925,4 @@ class Chunk{
$chunk->terrainGenerated = (bool) ($flags & 1);
return $chunk;
}
/**
* @deprecated This will be removed in a future release
*
* Creates a block hash from chunk block coordinates. Used for extra data keys in chunk packets.
* @internal
*
* @param int $x 0-15
* @param int $y 0-255
* @param int $z 0-15
*
* @return int
*/
public static function chunkBlockHash(int $x, int $y, int $z) : int{
return ($x << 12) | ($z << 8) | $y;
}
}

View File

@ -448,19 +448,8 @@ class LevelDB extends BaseLevelProvider{
$this->db->put($index . self::TAG_DATA_2D, pack("v*", ...$chunk->getHeightMapArray()) . $chunk->getBiomeIdArray());
$extraData = $chunk->getBlockExtraDataArray();
if(count($extraData) > 0){
$stream = new BinaryStream();
$stream->putLInt(count($extraData));
foreach($extraData as $key => $value){
$stream->putLInt($key);
$stream->putLShort($value);
}
$this->db->put($index . self::TAG_BLOCK_EXTRA_DATA, $stream->getBuffer());
}else{
$this->db->delete($index . self::TAG_BLOCK_EXTRA_DATA);
}
//this has been superseded by multi-layer block storages in 1.2.14+
$this->db->delete($index . self::TAG_BLOCK_EXTRA_DATA);
//TODO: use this properly
$this->db->put($index . self::TAG_STATE_FINALISATION, chr(self::FINALISATION_DONE));