Skip to content

Unloaded chunk issue - #3

Open
MlsDmitry wants to merge 2 commits into
DenielWorld:masterfrom
MlsDmitry:master
Open

Unloaded chunk issue#3
MlsDmitry wants to merge 2 commits into
DenielWorld:masterfrom
MlsDmitry:master

Conversation

@MlsDmitry

Copy link
Copy Markdown

No description provided.

@DenielWorld DenielWorld left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the commented changes first, and then I will review the PR again for a merge.


use DenielWorld\EzTiles\data\TileInfo;
use DenielWorld\EzTiles\EzTiles;
use InvalidArgumentException;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary.

use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\tile\Spawnable;
use ReflectionClass;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary as well.

use pocketmine\nbt\tag\StringTag;
use pocketmine\tile\Spawnable;
use ReflectionClass;
use ReflectionException;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also unnecessary. Qualifier imports are often unneeded and an \ should be fine.

//Don't mind this, it is for tile recreation after restart which is no longer handled by you.
if($tileInfo instanceof CompoundTag) {

$level->loadChunk($this->x >> 4, $this->z >> 4); // fix unloaded chunk at 0 0 issue

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this issue only occurs on tile recreations? Or is it possible that it could happen while constructing the tile for the first time?

if(is_int($key)) $key = (string)$key;
if(is_object($value) or is_callable($value)) {
throw new \InvalidArgumentException("Callable and objects cannot be saved to NBT");
throw new InvalidArgumentException("Callable and objects cannot be saved to NBT");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

switch ($this->getArrayType($value)){
case self::TAG_INVALID:
throw new \InvalidArgumentException("Arrays can only contain one type of data, bool or int only");
throw new InvalidArgumentException("Arrays can only contain one type of data, bool or int only");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

break;
case self::TAG_INVALID:
throw new \InvalidArgumentException("Invalid tag provided");
throw new InvalidArgumentException("Invalid tag provided");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

{
if($this->callable !== "") {
$reflection = new \ReflectionClass(EzTiles::getRegistrant());
$reflection = new ReflectionClass(EzTiles::getRegistrant());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

//TODO: Use switch()
if(is_object($value) or is_callable($value)) {
throw new \InvalidArgumentException("Callable and objects cannot be saved to NBT");
throw new InvalidArgumentException("Callable and objects cannot be saved to NBT");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

* Executed upon tile update, if it is scheduled & if a callable method string is provided
* @return bool
* @throws \ReflectionException
* @throws ReflectionException

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear qualifier imports, stick to \

@DenielWorld DenielWorld added the contribution A contribution of any sort label Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution A contribution of any sort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants