Unloaded chunk issue - #3
Conversation
DenielWorld
left a comment
There was a problem hiding this comment.
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; |
| use pocketmine\nbt\tag\ShortTag; | ||
| use pocketmine\nbt\tag\StringTag; | ||
| use pocketmine\tile\Spawnable; | ||
| use ReflectionClass; |
There was a problem hiding this comment.
This is unnecessary as well.
| use pocketmine\nbt\tag\StringTag; | ||
| use pocketmine\tile\Spawnable; | ||
| use ReflectionClass; | ||
| use ReflectionException; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Clear qualifier imports, stick to \
| break; | ||
| case self::TAG_INVALID: | ||
| throw new \InvalidArgumentException("Invalid tag provided"); | ||
| throw new InvalidArgumentException("Invalid tag provided"); |
There was a problem hiding this comment.
Clear qualifier imports, stick to \
| { | ||
| if($this->callable !== "") { | ||
| $reflection = new \ReflectionClass(EzTiles::getRegistrant()); | ||
| $reflection = new ReflectionClass(EzTiles::getRegistrant()); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Clear qualifier imports, stick to \
No description provided.