mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
Future workaround for #2626
This commit is contained in:
parent
8e56782138
commit
3a157d0f02
@ -559,6 +559,9 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
foreach($mini as $blocks){
|
foreach($mini as $blocks){
|
||||||
/** @var Block $b */
|
/** @var Block $b */
|
||||||
foreach($blocks as $b){
|
foreach($blocks as $b){
|
||||||
|
if(!($b instanceof Block)){
|
||||||
|
$b = $this->getBlock($b);
|
||||||
|
}
|
||||||
$pk = new UpdateBlockPacket();
|
$pk = new UpdateBlockPacket();
|
||||||
$pk->x = $b->x;
|
$pk->x = $b->x;
|
||||||
$pk->y = $b->y;
|
$pk->y = $b->y;
|
||||||
@ -1136,7 +1139,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->changedBlocks[$index][$Y] = [];
|
$this->changedBlocks[$index][$Y] = [];
|
||||||
$this->changedCount[$index] |= 1 << $Y;
|
$this->changedCount[$index] |= 1 << $Y;
|
||||||
}
|
}
|
||||||
$this->changedBlocks[$index][$Y][] = clone $block;
|
$this->changedBlocks[$index][$Y][Level::blockHash($block->x, $block->y, $block->z)] = clone $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($update === true){
|
if($update === true){
|
||||||
@ -1592,6 +1595,16 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
public function setBlockIdAt($x, $y, $z, $id){
|
public function setBlockIdAt($x, $y, $z, $id){
|
||||||
unset($this->blockCache[Level::blockHash($x, $y, $z)]);
|
unset($this->blockCache[Level::blockHash($x, $y, $z)]);
|
||||||
$this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y & 0x7f, $z & 0x0f, $id & 0xff);
|
$this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y & 0x7f, $z & 0x0f, $id & 0xff);
|
||||||
|
|
||||||
|
if(!isset($this->changedBlocks[$index = Level::chunkHash($x >> 4, $z >> 4)])){
|
||||||
|
$this->changedBlocks[$index] = [];
|
||||||
|
$this->changedCount[$index] = 0;
|
||||||
|
}
|
||||||
|
if(!isset($this->changedBlocks[$index][$Y = $y >> 4])){
|
||||||
|
$this->changedBlocks[$index][$Y] = [];
|
||||||
|
$this->changedCount[$index] |= 1 << $Y;
|
||||||
|
}
|
||||||
|
$this->changedBlocks[$index][$Y][Level::blockHash($x, $y, $z)] = new Vector3($x, $y, $z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1618,6 +1631,16 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
public function setBlockDataAt($x, $y, $z, $data){
|
public function setBlockDataAt($x, $y, $z, $data){
|
||||||
unset($this->blockCache[Level::blockHash($x, $y, $z)]);
|
unset($this->blockCache[Level::blockHash($x, $y, $z)]);
|
||||||
$this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y & 0x7f, $z & 0x0f, $data & 0x0f);
|
$this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y & 0x7f, $z & 0x0f, $data & 0x0f);
|
||||||
|
|
||||||
|
if(!isset($this->changedBlocks[$index = Level::chunkHash($x >> 4, $z >> 4)])){
|
||||||
|
$this->changedBlocks[$index] = [];
|
||||||
|
$this->changedCount[$index] = 0;
|
||||||
|
}
|
||||||
|
if(!isset($this->changedBlocks[$index][$Y = $y >> 4])){
|
||||||
|
$this->changedBlocks[$index][$Y] = [];
|
||||||
|
$this->changedCount[$index] |= 1 << $Y;
|
||||||
|
}
|
||||||
|
$this->changedBlocks[$index][$Y][Level::blockHash($x, $y, $z)] = new Vector3($x, $y, $z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user