mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Remove stuff deprecated in 4.19.0
This commit is contained in:
parent
9bddcc72f7
commit
ed88d68fd7
@ -84,9 +84,6 @@ class ExperienceOrb extends Entity{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
protected int $age = 0;
|
||||
|
||||
/** Ticker used for determining interval in which to look for new target players. */
|
||||
protected int $lookForTargetTime = 0;
|
||||
|
||||
@ -111,11 +108,11 @@ class ExperienceOrb extends Entity{
|
||||
protected function initEntity(CompoundTag $nbt) : void{
|
||||
parent::initEntity($nbt);
|
||||
|
||||
$this->age = $nbt->getShort(self::TAG_AGE, 0);
|
||||
if($this->age === -32768){
|
||||
$age = $nbt->getShort(self::TAG_AGE, 0);
|
||||
if($age === -32768){
|
||||
$this->despawnDelay = self::NEVER_DESPAWN;
|
||||
}else{
|
||||
$this->despawnDelay = max(0, self::DEFAULT_DESPAWN_DELAY - $this->age);
|
||||
$this->despawnDelay = max(0, self::DEFAULT_DESPAWN_DELAY - $age);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +177,6 @@ class ExperienceOrb extends Entity{
|
||||
protected function entityBaseTick(int $tickDiff = 1) : bool{
|
||||
$hasUpdate = parent::entityBaseTick($tickDiff);
|
||||
|
||||
$this->age += $tickDiff;
|
||||
$this->despawnDelay -= $tickDiff;
|
||||
if($this->despawnDelay <= 0){
|
||||
$this->flagForDespawn();
|
||||
|
@ -1,47 +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\player;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\world\TickingChunkLoader;
|
||||
|
||||
/**
|
||||
* @deprecated This class was only needed to implement TickingChunkLoader, which is now deprecated.
|
||||
* ChunkTicker should be registered on ticking chunks to make them tick instead.
|
||||
*/
|
||||
final class PlayerChunkLoader implements TickingChunkLoader{
|
||||
public function __construct(private Vector3 $currentLocation){}
|
||||
|
||||
public function setCurrentLocation(Vector3 $currentLocation) : void{
|
||||
$this->currentLocation = $currentLocation;
|
||||
}
|
||||
|
||||
public function getX() : float{
|
||||
return $this->currentLocation->getFloorX();
|
||||
}
|
||||
|
||||
public function getZ() : float{
|
||||
return $this->currentLocation->getFloorZ();
|
||||
}
|
||||
}
|
@ -34,12 +34,6 @@ use function get_class;
|
||||
use function str_starts_with;
|
||||
|
||||
abstract class Timings{
|
||||
/**
|
||||
* @deprecated This was used by the old timings viewer to make a timer appear in the Breakdown section of a timings
|
||||
* report. Provide a group to your timer's constructor instead.
|
||||
* @see Timings::GROUP_BREAKDOWN
|
||||
*/
|
||||
public const INCLUDED_BY_OTHER_TIMINGS_PREFIX = "** ";
|
||||
public const GROUP_BREAKDOWN = "Minecraft - Breakdown";
|
||||
|
||||
private static bool $initialized = false;
|
||||
|
@ -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;
|
||||
}
|
@ -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 => $_){
|
||||
|
Loading…
x
Reference in New Issue
Block a user