tgwaste / Weather

Weather Plugin for PocketMine-MP Version 4
Apache License 2.0
4 stars 1 forks source link

Cannot get highest block in an ungenerated chunk #13

Closed scamaccas closed 1 year ago

scamaccas commented 1 year ago
Error: Cannot get highest block in an ungenerated chunk
File: pmsrc/src/world/World
Line: 2496
Type: pocketmine\world\WorldException
Backtrace:
#0 plugins/Weather.phar/src/tgwaste/Weather/Weather(160): pocketmine\world\World->getHighestBlockAt(int -216, int -936)
#1 plugins/Weather.phar/src/tgwaste/Weather/Schedule(15): tgwaste\Weather\Weather->sendLightning()
#2 pmsrc/src/scheduler/TaskHandler(113): tgwaste\Weather\Schedule->onRun()
#3 pmsrc/src/scheduler/TaskScheduler(137): pocketmine\scheduler\TaskHandler->run()
#4 pmsrc/src/plugin/PluginManager(530): pocketmine\scheduler\TaskScheduler->mainThreadHeartbeat(int 81201)
#5 pmsrc/src/Server(1782): pocketmine\plugin\PluginManager->tickSchedulers(int 81201)
#6 pmsrc/src/Server(1671): pocketmine\Server->tick()
#7 pmsrc/src/Server(1063): pocketmine\Server->tickProcessor()
#8 pmsrc/src/PocketMine(334): pocketmine\Server->__construct(object pocketmine\thread\ThreadSafeClassLoader#3, object pocketmine\utils\MainLogger#6, string[9] /root/VN/, string[17] /root/VN/plugins/)
#9 pmsrc/src/PocketMine(357): pocketmine\server()
#10 pmsrc(11): require(string[53] phar:///root/VN/PocketMine-MP.phar/src/PocketMine.php)

Code:
[2487]   * Gets the highest block Y value at a specific $x and $z
[2488]   *
[2489]   * @return int|null 0-255, or null if the column is empty
[2490]   * @throws WorldException if the terrain is not generated
[2491]   */
[2492]  public function getHighestBlockAt(int $x, int $z) : ?int{
[2493]      if(($chunk = $this->loadChunk($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE)) !== null){
[2494]          return $chunk->getHighestBlockAt($x & Chunk::COORD_MASK, $z & Chunk::COORD_MASK);
[2495]      }
[2496]      throw new WorldException("Cannot get highest block in an ungenerated chunk");
[2497]  }
[2498] 
[2499]  /**
[2500]   * Returns whether the given position is in a loaded area of terrain.
[2501]   */
[2502]  public function isInLoadedTerrain(Vector3 $pos) : bool{
[2503]      return $this->isChunkLoaded($pos->getFloorX() >> Chunk::COORD_BIT_SIZE, $pos->getFloorZ() >> Chunk::COORD_BIT_SIZE);
[2504]  }
[2505] 
[2506]  public function isChunkLoaded(int $x, int $z) : bool{

what is this mean?

tgwaste commented 1 year ago

This is fixed in the next version. When PMMP updates and I can test, ill release it.

tgwaste commented 1 year ago

v2.0.3 released that fixed this.