mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Fully fixed metadata sending
This commit is contained in:
parent
f3e6c726b0
commit
4354d76cae
@ -149,7 +149,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
|||||||
$i = ($z << 3) + ($x >> 1);
|
$i = ($z << 3) + ($x >> 1);
|
||||||
$column = "";
|
$column = "";
|
||||||
for($y = 0; $y < 16; $y += 2){
|
for($y = 0; $y < 16; $y += 2){
|
||||||
$column .= ($this->data{($y << 7) + $i} & "\x0f") | ($this->data{(($y + 1) << 7) + $i} & "\xf0");
|
$column .= chr((ord($this->data{($y << 7) + $i}) & 0x0f) | ((ord($this->data{(($y + 1) << 7) + $i}) & 0x0f) << 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $column;
|
return $column;
|
||||||
@ -159,7 +159,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
|||||||
$i = ($z << 3) + ($x >> 1);
|
$i = ($z << 3) + ($x >> 1);
|
||||||
$column = "";
|
$column = "";
|
||||||
for($y = 0; $y < 16; $y += 2){
|
for($y = 0; $y < 16; $y += 2){
|
||||||
$column .= ($this->skyLight{($y << 7) + $i} & "\x0f") | ($this->skyLight{(($y + 1) << 7) + $i} & "\xf0");
|
$column .= chr((ord($this->skyLight{($y << 7) + $i}) & 0x0f) | ((ord($this->skyLight{(($y + 1) << 7) + $i}) & 0x0f) << 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $column;
|
return $column;
|
||||||
@ -169,7 +169,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{
|
|||||||
$i = ($z << 3) + ($x >> 1);
|
$i = ($z << 3) + ($x >> 1);
|
||||||
$column = "";
|
$column = "";
|
||||||
for($y = 0; $y < 16; $y += 2){
|
for($y = 0; $y < 16; $y += 2){
|
||||||
$column .= ($this->blockLight{($y << 7) + $i} & "\x0f") | ($this->blockLight{(($y + 1) << 7) + $i} & "\xf0");
|
$column .= chr((ord($this->blockLight{($y << 7) + $i}) & 0x0f) | ((ord($this->blockLight{(($y + 1) << 7) + $i}) & 0x0f) << 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $column;
|
return $column;
|
||||||
|
@ -41,7 +41,10 @@ class BlockMetadataStore extends MetadataStore{
|
|||||||
return $block->x . ":" . $block->y . ":" . $block->z . ":" . $metadataKey;
|
return $block->x . ":" . $block->y . ":" . $block->z . ":" . $metadataKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMetadata(Block $block, $metadataKey){
|
public function getMetadata($block, $metadataKey){
|
||||||
|
if($block instanceof Block){
|
||||||
|
throw new \Exception("Object must be a Block");
|
||||||
|
}
|
||||||
if($block->getLevel() === $this->owningLevel){
|
if($block->getLevel() === $this->owningLevel){
|
||||||
return parent::getMetadata($block, $metadataKey);
|
return parent::getMetadata($block, $metadataKey);
|
||||||
}else{
|
}else{
|
||||||
@ -49,7 +52,10 @@ class BlockMetadataStore extends MetadataStore{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasMetadata(Block $block, $metadataKey){
|
public function hasMetadata($block, $metadataKey){
|
||||||
|
if($block instanceof Block){
|
||||||
|
throw new \Exception("Object must be a Block");
|
||||||
|
}
|
||||||
if($block->getLevel() === $this->owningLevel){
|
if($block->getLevel() === $this->owningLevel){
|
||||||
return parent::hasMetadata($block, $metadataKey);
|
return parent::hasMetadata($block, $metadataKey);
|
||||||
}else{
|
}else{
|
||||||
@ -57,7 +63,10 @@ class BlockMetadataStore extends MetadataStore{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeMetadata(Block $block, $metadataKey, Plugin $owningPlugin){
|
public function removeMetadata($block, $metadataKey, Plugin $owningPlugin){
|
||||||
|
if($block instanceof Block){
|
||||||
|
throw new \Exception("Object must be a Block");
|
||||||
|
}
|
||||||
if($block->getLevel() === $this->owningLevel){
|
if($block->getLevel() === $this->owningLevel){
|
||||||
parent::hasMetadata($block, $metadataKey, $owningPlugin);
|
parent::hasMetadata($block, $metadataKey, $owningPlugin);
|
||||||
}else{
|
}else{
|
||||||
@ -65,7 +74,10 @@ class BlockMetadataStore extends MetadataStore{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMetadata(Block $block, $metadataKey, MetadataValue $newMetadatavalue){
|
public function setMetadata($block, $metadataKey, MetadataValue $newMetadatavalue){
|
||||||
|
if($block instanceof Block){
|
||||||
|
throw new \Exception("Object must be a Block");
|
||||||
|
}
|
||||||
if($block->getLevel() === $this->owningLevel){
|
if($block->getLevel() === $this->owningLevel){
|
||||||
parent::setMetadata($block, $metadataKey, $newMetadatavalue);
|
parent::setMetadata($block, $metadataKey, $newMetadatavalue);
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user