Remove stuff deprecated in 4.19.0

This commit is contained in:
Dylan K. Taylor
2023-04-11 23:20:58 +01:00
parent 9bddcc72f7
commit ed88d68fd7
5 changed files with 4 additions and 175 deletions

View File

@ -1,40 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\world;
/**
* TickingChunkLoader includes all of the same functionality as ChunkLoader (it can be used in the same way).
* However, using this version will also cause chunks around the loader's reported coordinates to get random block
* updates.
*
* @deprecated
* @see World::registerTickingChunk()
* @see World::unregisterTickingChunk()
*/
interface TickingChunkLoader extends ChunkLoader{
public function getX() : float;
public function getZ() : float;
}

View File

@ -71,7 +71,6 @@ use pocketmine\network\mcpe\protocol\BlockActorDataPacket;
use pocketmine\network\mcpe\protocol\ClientboundPacket;
use pocketmine\network\mcpe\protocol\types\BlockPosition;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
use pocketmine\player\ChunkSelector;
use pocketmine\player\Player;
use pocketmine\promise\Promise;
use pocketmine\promise\PromiseResolver;
@ -209,21 +208,6 @@ class World implements ChunkManager{
private int $minY;
private int $maxY;
/**
* @var TickingChunkLoader[] spl_object_id => TickingChunkLoader
* @phpstan-var array<int, TickingChunkLoader>
*
* @deprecated
*/
private array $tickingLoaders = [];
/**
* @var int[] spl_object_id => number of chunks
* @phpstan-var array<int, int>
*
* @deprecated
*/
private array $tickingLoaderCounter = [];
/**
* @var TickingChunkEntry[] chunkHash => TickingChunkEntry
* @phpstan-var array<ChunkPosHash, TickingChunkEntry>
@ -799,15 +783,6 @@ class World implements ChunkManager{
$this->chunkLoaders[$chunkHash][$loaderId] = $loader;
if($loader instanceof TickingChunkLoader){
if(!isset($this->tickingLoaders[$loaderId])){
$this->tickingLoaderCounter[$loaderId] = 1;
$this->tickingLoaders[$loaderId] = $loader;
}else{
++$this->tickingLoaderCounter[$loaderId];
}
}
$this->cancelUnloadChunkRequest($chunkX, $chunkZ);
if($autoLoad){
@ -828,11 +803,6 @@ class World implements ChunkManager{
unset($this->chunkPopulationRequestMap[$chunkHash]);
}
}
if(isset($this->tickingLoaderCounter[$loaderId]) && --$this->tickingLoaderCounter[$loaderId] === 0){
unset($this->tickingLoaderCounter[$loaderId]);
unset($this->tickingLoaders[$loaderId]);
}
}
}
@ -1206,46 +1176,8 @@ class World implements ChunkManager{
}
}
/**
* @deprecated
*
* @param true[] $chunkTickList
* @param bool[] $chunkTickableCache
*
* @phpstan-param array<int, true> $chunkTickList
* @phpstan-param array<int, bool> $chunkTickableCache
* @phpstan-param-out array<int, true> $chunkTickList
* @phpstan-param-out array<int, bool> $chunkTickableCache
*/
private function selectTickableChunksLegacy(array &$chunkTickList, array &$chunkTickableCache) : void{
$centerChunks = [];
$selector = new ChunkSelector();
foreach($this->tickingLoaders as $loader){
$centerChunkX = (int) floor($loader->getX()) >> Chunk::COORD_BIT_SIZE;
$centerChunkZ = (int) floor($loader->getZ()) >> Chunk::COORD_BIT_SIZE;
$centerChunkPosHash = World::chunkHash($centerChunkX, $centerChunkZ);
if(isset($centerChunks[$centerChunkPosHash])){
//we already queued chunks in this radius because of a previous loader on the same chunk
continue;
}
$centerChunks[$centerChunkPosHash] = true;
foreach($selector->selectChunks(
$this->chunkTickRadius,
$centerChunkX,
$centerChunkZ
) as $hash){
World::getXZ($hash, $chunkX, $chunkZ);
if(!isset($chunkTickList[$hash]) && isset($this->chunks[$hash]) && $this->isChunkTickable($chunkX, $chunkZ, $chunkTickableCache)){
$chunkTickList[$hash] = true;
}
}
}
}
private function tickChunks() : void{
if($this->chunkTickRadius <= 0 || (count($this->tickingChunks) === 0 && count($this->tickingLoaders) === 0)){
if($this->chunkTickRadius <= 0 || count($this->tickingChunks) === 0){
return;
}
@ -1269,12 +1201,6 @@ class World implements ChunkManager{
$chunkTickList[$hash] = true;
}
//TODO: REMOVE THIS
//backwards compatibility for TickingChunkLoader, although I'm not sure this is really necessary in practice
if(count($this->tickingLoaders) !== 0){
$this->selectTickableChunksLegacy($chunkTickList, $chunkTickableCache);
}
$this->timings->randomChunkUpdatesChunkSelection->stopTiming();
foreach($chunkTickList as $index => $_){