From 3e69ee87e40a2fb993f6b9e7fc631588084550e7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 19 Dec 2024 00:14:18 +0000 Subject: [PATCH] Remove deprecated stuff except Permission subscriptions; turns out we still need those perhaps they should be marked @internal --- src/MemoryManager.php | 16 ------ src/block/SweetBerryBush.php | 11 +--- src/block/tile/Spawnable.php | 14 ----- src/data/runtime/RuntimeDataDescriber.php | 14 ----- src/data/runtime/RuntimeDataReader.php | 23 -------- .../runtime/RuntimeDataSizeCalculator.php | 17 ------ src/data/runtime/RuntimeDataWriter.php | 23 -------- .../transaction/InventoryTransaction.php | 1 - .../transaction/action/InventoryAction.php | 9 ---- src/scheduler/AsyncPool.php | 17 ------ src/scheduler/AsyncTask.php | 52 ------------------- src/scheduler/AsyncWorker.php | 46 ---------------- src/timings/Timings.php | 43 --------------- src/timings/TimingsHandler.php | 13 ----- src/utils/TextFormat.php | 4 -- src/wizard/SetupWizard.php | 7 --- src/world/World.php | 19 ------- tests/phpunit/scheduler/AsyncPoolTest.php | 9 ---- .../PublishProgressRaceAsyncTask.php | 40 -------------- 19 files changed, 2 insertions(+), 376 deletions(-) delete mode 100644 tests/phpunit/scheduler/PublishProgressRaceAsyncTask.php diff --git a/src/MemoryManager.php b/src/MemoryManager.php index 2b7f5f1d3..9a2cbd2ad 100644 --- a/src/MemoryManager.php +++ b/src/MemoryManager.php @@ -123,13 +123,6 @@ class MemoryManager{ return $this->globalMemoryLimit; } - /** - * @deprecated - */ - public function canUseChunkCache() : bool{ - return !$this->lowMemory; - } - /** * Returns the allowed chunk radius based on the current memory usage. */ @@ -236,13 +229,4 @@ class MemoryManager{ } } } - - /** - * Static memory dumper accessible from any thread. - * @deprecated - * @see MemoryDump - */ - public static function dumpMemory(mixed $startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger) : void{ - MemoryDump::dumpMemory($startingObject, $outputFolder, $maxNesting, $maxStringSize, $logger); - } } diff --git a/src/block/SweetBerryBush.php b/src/block/SweetBerryBush.php index eabdde118..5fd7fcaa1 100644 --- a/src/block/SweetBerryBush.php +++ b/src/block/SweetBerryBush.php @@ -58,17 +58,10 @@ class SweetBerryBush extends Flowable{ return 0; } - /** - * @deprecated - */ - protected function canBeSupportedBy(Block $block) : bool{ - return $block->getTypeId() !== BlockTypeIds::FARMLAND && //bedrock-specific thing (bug?) - ($block->hasTypeTag(BlockTypeTags::DIRT) || $block->hasTypeTag(BlockTypeTags::MUD)); - } - private function canBeSupportedAt(Block $block) : bool{ $supportBlock = $block->getSide(Facing::DOWN); - return $this->canBeSupportedBy($supportBlock); + return $supportBlock->getTypeId() !== BlockTypeIds::FARMLAND && //bedrock-specific thing (bug?) + ($supportBlock->hasTypeTag(BlockTypeTags::DIRT) || $supportBlock->hasTypeTag(BlockTypeTags::MUD)); } public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ diff --git a/src/block/tile/Spawnable.php b/src/block/tile/Spawnable.php index 67bc72fd9..956652eac 100644 --- a/src/block/tile/Spawnable.php +++ b/src/block/tile/Spawnable.php @@ -35,20 +35,6 @@ abstract class Spawnable extends Tile{ /** @phpstan-var CacheableNbt<\pocketmine\nbt\tag\CompoundTag>|null */ private ?CacheableNbt $spawnCompoundCache = null; - /** - * @deprecated - */ - public function isDirty() : bool{ - return $this->spawnCompoundCache === null; - } - - /** - * @deprecated - */ - public function setDirty(bool $dirty = true) : void{ - $this->clearSpawnCompoundCache(); - } - public function clearSpawnCompoundCache() : void{ $this->spawnCompoundCache = null; } diff --git a/src/data/runtime/RuntimeDataDescriber.php b/src/data/runtime/RuntimeDataDescriber.php index 8a2868555..8df675f70 100644 --- a/src/data/runtime/RuntimeDataDescriber.php +++ b/src/data/runtime/RuntimeDataDescriber.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\data\runtime; -use pocketmine\block\utils\BrewingStandSlot; use pocketmine\block\utils\WallConnectionType; use pocketmine\math\Facing; @@ -38,11 +37,6 @@ use pocketmine\math\Facing; interface RuntimeDataDescriber{ public function int(int $bits, int &$value) : void; - /** - * @deprecated Use {@link RuntimeDataDescriber::boundedIntAuto()} instead. - */ - public function boundedInt(int $bits, int $min, int $max, int &$value) : void; - /** * Same as boundedInt() but automatically calculates the required number of bits from the range. * The range bounds must be constant. @@ -77,14 +71,6 @@ interface RuntimeDataDescriber{ */ public function wallConnections(array &$connections) : void; - /** - * @param BrewingStandSlot[] $slots - * @phpstan-param array $slots - * - * @deprecated Use {@link enumSet()} instead. - */ - public function brewingStandSlots(array &$slots) : void; - public function railShape(int &$railShape) : void; public function straightOnlyRailShape(int &$railShape) : void; diff --git a/src/data/runtime/RuntimeDataReader.php b/src/data/runtime/RuntimeDataReader.php index 1dd0c681b..c230a52ae 100644 --- a/src/data/runtime/RuntimeDataReader.php +++ b/src/data/runtime/RuntimeDataReader.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\data\runtime; -use pocketmine\block\utils\BrewingStandSlot; use pocketmine\block\utils\RailConnectionInfo; use pocketmine\block\utils\WallConnectionType; use pocketmine\math\Axis; @@ -57,18 +56,6 @@ final class RuntimeDataReader implements RuntimeDataDescriber{ $value = $this->readInt($bits); } - /** - * @deprecated Use {@link self::boundedIntAuto()} instead. - */ - public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ - $offset = $this->offset; - $this->boundedIntAuto($min, $max, $value); - $actualBits = $this->offset - $offset; - if($this->offset !== $offset + $bits){ - throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation."); - } - } - private function readBoundedIntAuto(int $min, int $max) : int{ $bits = ((int) log($max - $min, 2)) + 1; $result = $this->readInt($bits) + $min; @@ -190,16 +177,6 @@ final class RuntimeDataReader implements RuntimeDataDescriber{ $connections = $result; } - /** - * @param BrewingStandSlot[] $slots - * @phpstan-param array $slots - * - * @deprecated Use {@link enumSet()} instead. - */ - public function brewingStandSlots(array &$slots) : void{ - $this->enumSet($slots, BrewingStandSlot::cases()); - } - public function railShape(int &$railShape) : void{ $result = $this->readInt(4); if(!isset(RailConnectionInfo::CONNECTIONS[$result]) && !isset(RailConnectionInfo::CURVE_CONNECTIONS[$result])){ diff --git a/src/data/runtime/RuntimeDataSizeCalculator.php b/src/data/runtime/RuntimeDataSizeCalculator.php index 1563e4886..6725aace6 100644 --- a/src/data/runtime/RuntimeDataSizeCalculator.php +++ b/src/data/runtime/RuntimeDataSizeCalculator.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\data\runtime; -use pocketmine\block\utils\BrewingStandSlot; use pocketmine\math\Facing; use function count; use function log; @@ -43,18 +42,6 @@ final class RuntimeDataSizeCalculator implements RuntimeDataDescriber{ $this->addBits($bits); } - /** - * @deprecated Use {@link self::boundedIntAuto()} instead. - */ - public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ - $currentBits = $this->bits; - $this->boundedIntAuto($min, $max, $value); - $actualBits = $this->bits - $currentBits; - if($actualBits !== $bits){ - throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation."); - } - } - public function boundedIntAuto(int $min, int $max, int &$value) : void{ $this->addBits(((int) log($max - $min, 2)) + 1); } @@ -95,10 +82,6 @@ final class RuntimeDataSizeCalculator implements RuntimeDataDescriber{ $this->addBits(7); } - public function brewingStandSlots(array &$slots) : void{ - $this->addBits(count(BrewingStandSlot::cases())); - } - public function railShape(int &$railShape) : void{ $this->addBits(4); } diff --git a/src/data/runtime/RuntimeDataWriter.php b/src/data/runtime/RuntimeDataWriter.php index a26c842cd..382aa9bf6 100644 --- a/src/data/runtime/RuntimeDataWriter.php +++ b/src/data/runtime/RuntimeDataWriter.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\data\runtime; -use pocketmine\block\utils\BrewingStandSlot; use pocketmine\block\utils\WallConnectionType; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -55,18 +54,6 @@ final class RuntimeDataWriter implements RuntimeDataDescriber{ $this->writeInt($bits, $value); } - /** - * @deprecated Use {@link self::boundedIntAuto()} instead. - */ - public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ - $offset = $this->offset; - $this->writeBoundedIntAuto($min, $max, $value); - $actualBits = $this->offset - $offset; - if($actualBits !== $bits){ - throw new \InvalidArgumentException("Bits should be $actualBits for the given bounds, but received $bits. Use boundedIntAuto() for automatic bits calculation."); - } - } - private function writeBoundedIntAuto(int $min, int $max, int $value) : void{ if($value < $min || $value > $max){ throw new \InvalidArgumentException("Value $value is outside the range $min - $max"); @@ -168,16 +155,6 @@ final class RuntimeDataWriter implements RuntimeDataDescriber{ $this->writeBoundedIntAuto(0, (3 ** 4) - 1, $packed); } - /** - * @param BrewingStandSlot[] $slots - * @phpstan-param array $slots - * - * @deprecated Use {@link enumSet()} instead. - */ - public function brewingStandSlots(array &$slots) : void{ - $this->enumSet($slots, BrewingStandSlot::cases()); - } - public function railShape(int &$railShape) : void{ $this->int(4, $railShape); } diff --git a/src/inventory/transaction/InventoryTransaction.php b/src/inventory/transaction/InventoryTransaction.php index 47290e401..cb37edfa2 100644 --- a/src/inventory/transaction/InventoryTransaction.php +++ b/src/inventory/transaction/InventoryTransaction.php @@ -110,7 +110,6 @@ class InventoryTransaction{ public function addAction(InventoryAction $action) : void{ if(!isset($this->actions[$hash = spl_object_id($action)])){ $this->actions[$hash] = $action; - $action->onAddToTransaction($this); if($action instanceof SlotChangeAction && !isset($this->inventories[$inventoryId = spl_object_id($action->getInventory())])){ $this->inventories[$inventoryId] = $action->getInventory(); } diff --git a/src/inventory/transaction/action/InventoryAction.php b/src/inventory/transaction/action/InventoryAction.php index 2f0db083c..e24498519 100644 --- a/src/inventory/transaction/action/InventoryAction.php +++ b/src/inventory/transaction/action/InventoryAction.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\inventory\transaction\action; -use pocketmine\inventory\transaction\InventoryTransaction; use pocketmine\inventory\transaction\TransactionValidationException; use pocketmine\item\Item; use pocketmine\player\Player; @@ -58,14 +57,6 @@ abstract class InventoryAction{ */ abstract public function validate(Player $source) : void; - /** - * Called when the action is added to the specified InventoryTransaction. - * @deprecated - */ - public function onAddToTransaction(InventoryTransaction $transaction) : void{ - - } - /** * Called by inventory transactions before any actions are processed. If this returns false, the transaction will * be cancelled. diff --git a/src/scheduler/AsyncPool.php b/src/scheduler/AsyncPool.php index bb79df507..3ed8f8095 100644 --- a/src/scheduler/AsyncPool.php +++ b/src/scheduler/AsyncPool.php @@ -266,22 +266,11 @@ class AsyncPool{ $this->checkCrashedWorker($worker, $task); throw new AssumptionFailedError("checkCrashedWorker() should have thrown an exception, making this unreachable"); }else{ - /* - * It's possible for a task to submit a progress update and then finish before the progress - * update is detected by the parent thread, so here we consume any missed updates. - * - * When this happens, it's possible for a progress update to arrive between the previous - * checkProgressUpdates() call and the next isGarbage() call, causing progress updates to be - * lost. Thus, it's necessary to do one last check here to make sure all progress updates have - * been consumed before completing. - */ - $this->checkTaskProgressUpdates($task); Timings::getAsyncTaskCompletionTimings($task)->time(function() use ($task) : void{ $task->onCompletion(); }); } }else{ - $this->checkTaskProgressUpdates($task); $more = true; break; //current task is still running, skip to next worker } @@ -329,10 +318,4 @@ class AsyncPool{ } $this->workers = []; } - - private function checkTaskProgressUpdates(AsyncTask $task) : void{ - Timings::getAsyncTaskProgressUpdateTimings($task)->time(function() use ($task) : void{ - $task->checkProgressUpdates(); - }); - } } diff --git a/src/scheduler/AsyncTask.php b/src/scheduler/AsyncTask.php index 0e9b06d7b..9e9dd7a77 100644 --- a/src/scheduler/AsyncTask.php +++ b/src/scheduler/AsyncTask.php @@ -25,12 +25,9 @@ namespace pocketmine\scheduler; use pmmp\thread\Runnable; use pmmp\thread\ThreadSafe; -use pmmp\thread\ThreadSafeArray; use pocketmine\thread\NonThreadSafeValue; use pocketmine\timings\Timings; use function array_key_exists; -use function igbinary_serialize; -use function igbinary_unserialize; use function is_null; use function is_scalar; use function spl_object_id; @@ -68,12 +65,6 @@ abstract class AsyncTask extends Runnable{ */ private static array $threadLocalStorage = []; - /** - * @phpstan-var ThreadSafeArray|null - * @deprecated - */ - private ?ThreadSafeArray $progressUpdates = null; - private ThreadSafe|string|int|bool|null|float $result = null; private bool $submitted = false; @@ -143,49 +134,6 @@ abstract class AsyncTask extends Runnable{ } - /** - * @deprecated - * - * Call this method from {@link AsyncTask::onRun} (AsyncTask execution thread) to schedule a call to - * {@link AsyncTask::onProgressUpdate} from the main thread with the given progress parameter. - * - * @param mixed $progress A value that can be safely serialize()'ed. - */ - public function publishProgress(mixed $progress) : void{ - $progressUpdates = $this->progressUpdates; - if($progressUpdates === null){ - $progressUpdates = $this->progressUpdates = new ThreadSafeArray(); - } - $progressUpdates[] = igbinary_serialize($progress) ?? throw new \InvalidArgumentException("Progress must be serializable"); - } - - /** - * @deprecated - * @internal Only call from AsyncPool.php on the main thread - */ - public function checkProgressUpdates() : void{ - $progressUpdates = $this->progressUpdates; - if($progressUpdates !== null){ - while(($progress = $progressUpdates->shift()) !== null){ - $this->onProgressUpdate(igbinary_unserialize($progress)); - } - } - } - - /** - * @deprecated - * - * Called from the main thread after {@link AsyncTask::publishProgress} is called. - * All {@link AsyncTask::publishProgress} calls should result in {@link AsyncTask::onProgressUpdate} calls before - * {@link AsyncTask::onCompletion} is called. - * - * @param mixed $progress The parameter passed to {@link AsyncTask#publishProgress}. It is serialize()'ed - * and then unserialize()'ed, as if it has been cloned. - */ - public function onProgressUpdate($progress) : void{ - - } - /** * Saves mixed data in thread-local storage. Data stored using this storage is **only accessible from the thread it * was stored on**. Data stored using this method will **not** be serialized. diff --git a/src/scheduler/AsyncWorker.php b/src/scheduler/AsyncWorker.php index 528d632d1..6684d551f 100644 --- a/src/scheduler/AsyncWorker.php +++ b/src/scheduler/AsyncWorker.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\scheduler; -use pmmp\thread\Thread as NativeThread; use pocketmine\GarbageCollectorManager; use pocketmine\snooze\SleeperHandlerEntry; use pocketmine\snooze\SleeperNotifier; @@ -34,9 +33,6 @@ use pocketmine\utils\AssumptionFailedError; use function ini_set; class AsyncWorker extends Worker{ - /** @var mixed[] */ - private static array $store = []; - private static ?SleeperNotifier $notifier = null; private static ?GarbageCollectorManager $cycleGcManager = null; @@ -88,46 +84,4 @@ class AsyncWorker extends Worker{ public function getAsyncWorkerId() : int{ return $this->id; } - - /** - * Saves mixed data into the worker's thread-local object store. This can be used to store objects which you - * want to use on this worker thread from multiple AsyncTasks. - * - * @deprecated Use static class properties instead. - */ - public function saveToThreadStore(string $identifier, mixed $value) : void{ - if(NativeThread::getCurrentThread() !== $this){ - throw new \LogicException("Thread-local data can only be stored in the thread context"); - } - self::$store[$identifier] = $value; - } - - /** - * Retrieves mixed data from the worker's thread-local object store. - * - * Note that the thread-local object store could be cleared and your data might not exist, so your code should - * account for the possibility that what you're trying to retrieve might not exist. - * - * Objects stored in this storage may ONLY be retrieved while the task is running. - * - * @deprecated Use static class properties instead. - */ - public function getFromThreadStore(string $identifier) : mixed{ - if(NativeThread::getCurrentThread() !== $this){ - throw new \LogicException("Thread-local data can only be fetched in the thread context"); - } - return self::$store[$identifier] ?? null; - } - - /** - * Removes previously-stored mixed data from the worker's thread-local object store. - * - * @deprecated Use static class properties instead. - */ - public function removeFromThreadStore(string $identifier) : void{ - if(NativeThread::getCurrentThread() !== $this){ - throw new \LogicException("Thread-local data can only be removed in the thread context"); - } - unset(self::$store[$identifier]); - } } diff --git a/src/timings/Timings.php b/src/timings/Timings.php index ee737f537..b46c27d58 100644 --- a/src/timings/Timings.php +++ b/src/timings/Timings.php @@ -37,8 +37,6 @@ use function str_starts_with; abstract class Timings{ public const GROUP_MINECRAFT = "Minecraft"; - /** @deprecated No longer used */ - public const GROUP_BREAKDOWN = "Minecraft - Breakdown"; private static bool $initialized = false; @@ -119,17 +117,9 @@ abstract class Timings{ /** @var TimingsHandler[][] */ private static array $eventHandlers = []; - private static TimingsHandler $asyncTaskProgressUpdateParent; private static TimingsHandler $asyncTaskCompletionParent; - private static TimingsHandler $asyncTaskErrorParent; - - /** @var TimingsHandler[] */ - private static array $asyncTaskProgressUpdate = []; - /** @var TimingsHandler[] */ private static array $asyncTaskCompletion = []; - /** @var TimingsHandler[] */ - private static array $asyncTaskError = []; public static TimingsHandler $asyncTaskWorkers; /** @var TimingsHandler[] */ @@ -190,9 +180,7 @@ abstract class Timings{ self::$schedulerSync = new TimingsHandler("Scheduler - Sync Tasks"); self::$schedulerAsync = new TimingsHandler("Scheduler - Async Tasks"); - self::$asyncTaskProgressUpdateParent = new TimingsHandler("Async Tasks - Progress Updates", self::$schedulerAsync); self::$asyncTaskCompletionParent = new TimingsHandler("Async Tasks - Completion Handlers", self::$schedulerAsync); - self::$asyncTaskErrorParent = new TimingsHandler("Async Tasks - Error Handlers", self::$schedulerAsync); self::$asyncTaskWorkers = new TimingsHandler("Async Task Workers"); @@ -324,20 +312,6 @@ abstract class Timings{ return self::$eventHandlers[$event][$handlerName]; } - public static function getAsyncTaskProgressUpdateTimings(AsyncTask $task, string $group = self::GROUP_MINECRAFT) : TimingsHandler{ - $taskClass = $task::class; - if(!isset(self::$asyncTaskProgressUpdate[$taskClass])){ - self::init(); - self::$asyncTaskProgressUpdate[$taskClass] = new TimingsHandler( - "AsyncTask - " . self::shortenCoreClassName($taskClass, "pocketmine\\") . " - Progress Updates", - self::$asyncTaskProgressUpdateParent, - $group - ); - } - - return self::$asyncTaskProgressUpdate[$taskClass]; - } - public static function getAsyncTaskCompletionTimings(AsyncTask $task, string $group = self::GROUP_MINECRAFT) : TimingsHandler{ $taskClass = $task::class; if(!isset(self::$asyncTaskCompletion[$taskClass])){ @@ -352,23 +326,6 @@ abstract class Timings{ return self::$asyncTaskCompletion[$taskClass]; } - /** - * @deprecated No longer used - */ - public static function getAsyncTaskErrorTimings(AsyncTask $task, string $group = self::GROUP_MINECRAFT) : TimingsHandler{ - $taskClass = $task::class; - if(!isset(self::$asyncTaskError[$taskClass])){ - self::init(); - self::$asyncTaskError[$taskClass] = new TimingsHandler( - "AsyncTask - " . self::shortenCoreClassName($taskClass, "pocketmine\\") . " - Error Handler", - self::$asyncTaskErrorParent, - $group - ); - } - - return self::$asyncTaskError[$taskClass]; - } - public static function getAsyncTaskRunTimings(AsyncTask $task, string $group = self::GROUP_MINECRAFT) : TimingsHandler{ $taskClass = $task::class; if(!isset(self::$asyncTaskRun[$taskClass])){ diff --git a/src/timings/TimingsHandler.php b/src/timings/TimingsHandler.php index 95f7dbacc..e86cb0383 100644 --- a/src/timings/TimingsHandler.php +++ b/src/timings/TimingsHandler.php @@ -138,19 +138,6 @@ class TimingsHandler{ return $result; } - /** - * @deprecated This only collects timings from the main thread. Collecting timings from all threads is an async - * operation, so it can't be done synchronously. - * - * @return string[] - */ - public static function printTimings() : array{ - $records = self::printCurrentThreadRecords(); - $footer = self::printFooter(); - - return [...$records, ...$footer]; - } - /** * Collects timings asynchronously, allowing timings from multiple threads to be aggregated into a single report. * diff --git a/src/utils/TextFormat.php b/src/utils/TextFormat.php index fadf6ea4e..852771205 100644 --- a/src/utils/TextFormat.php +++ b/src/utils/TextFormat.php @@ -106,10 +106,6 @@ abstract class TextFormat{ public const OBFUSCATED = TextFormat::ESCAPE . "k"; public const BOLD = TextFormat::ESCAPE . "l"; - /** @deprecated */ - public const STRIKETHROUGH = ""; - /** @deprecated */ - public const UNDERLINE = ""; public const ITALIC = TextFormat::ESCAPE . "o"; public const FORMATS = [ diff --git a/src/wizard/SetupWizard.php b/src/wizard/SetupWizard.php index 0f1a99f4b..84329bbb4 100644 --- a/src/wizard/SetupWizard.php +++ b/src/wizard/SetupWizard.php @@ -48,13 +48,6 @@ use const PHP_EOL; use const STDIN; class SetupWizard{ - /** @deprecated */ - public const DEFAULT_NAME = Server::DEFAULT_SERVER_NAME; - /** @deprecated */ - public const DEFAULT_PORT = Server::DEFAULT_PORT_IPV4; - /** @deprecated */ - public const DEFAULT_PLAYERS = Server::DEFAULT_MAX_PLAYERS; - private Language $lang; public function __construct( diff --git a/src/world/World.php b/src/world/World.php index c2d153921..9551b8cbe 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1614,25 +1614,6 @@ class World implements ChunkManager{ return $collides; } - /** - * @deprecated Use {@link World::getBlockCollisionBoxes()} instead (alongside {@link World::getCollidingEntities()} - * if entity collision boxes are also required). - * - * @return AxisAlignedBB[] - * @phpstan-return list - */ - public function getCollisionBoxes(Entity $entity, AxisAlignedBB $bb, bool $entities = true) : array{ - $collides = $this->getBlockCollisionBoxes($bb); - - if($entities){ - foreach($this->getCollidingEntities($bb->expandedCopy(0.25, 0.25, 0.25), $entity) as $ent){ - $collides[] = clone $ent->boundingBox; - } - } - - return $collides; - } - /** * Computes the percentage of a circle away from noon the sun is currently at. This can be multiplied by 2 * M_PI to * get an angle in radians, or by 360 to get an angle in degrees. diff --git a/tests/phpunit/scheduler/AsyncPoolTest.php b/tests/phpunit/scheduler/AsyncPoolTest.php index 53ec15c12..dc43c41db 100644 --- a/tests/phpunit/scheduler/AsyncPoolTest.php +++ b/tests/phpunit/scheduler/AsyncPoolTest.php @@ -61,15 +61,6 @@ class AsyncPoolTest extends TestCase{ self::assertTrue(LeakTestAsyncTask::$destroyed, "Task was not destroyed after 30 seconds"); } - public function testPublishProgressRace() : void{ - $task = new PublishProgressRaceAsyncTask(); - $this->pool->submitTask($task); - while($this->pool->collectTasks()){ - usleep(50 * 1000); - } - self::assertTrue(PublishProgressRaceAsyncTask::$success, "Progress was not reported before task completion"); - } - public function testThreadSafeSetResult() : void{ $resolver = new PromiseResolver(); $resolver->getPromise()->onCompletion( diff --git a/tests/phpunit/scheduler/PublishProgressRaceAsyncTask.php b/tests/phpunit/scheduler/PublishProgressRaceAsyncTask.php deleted file mode 100644 index da25d16f3..000000000 --- a/tests/phpunit/scheduler/PublishProgressRaceAsyncTask.php +++ /dev/null @@ -1,40 +0,0 @@ -publishProgress("hello"); - } - - public function onProgressUpdate($progress) : void{ - if($progress === "hello"){ - // thread local on main thread - self::$success = true; - } - } -}