diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 745f89cba..84c5ec297 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,32 @@ Larger contributions like feature additions should be preceded by a [Change Prop ## Other things you'll need - [git](https://git-scm.com/) +## Choosing a target branch +PocketMine-MP has three primary branches of development. + +| Type of change | `stable` | `next-minor` | `next-major` | +|:---------------|:--------:|:------------:|:------------:| +| Bug fixes | ✔️ | ✔️ | ✔️ | +| Improvements to API docs | ✔️ | ✔️ | ✔️ | +| Cleaning up code | ❌ | ✔️ | ✔️ | +| Changing code formatting or style | ❌ | ✔️ | ✔️ | +| Addition of new core features | ❌ | 🟡 Only if non-disruptive | ✔️ | +| Changing core behaviour (e.g. making something use threads) | ❌ | ✔️ | ✔️ | +| Addition of new configuration options | ❌ | 🟡 Only if optional | ✔️ | +| Addition of new API classes, methods or constants | ❌ | ✔️ | ✔️ | +| Deprecating API classes, methods or constants | ❌ | ✔️ | ✔️ | +| Adding optional parameters to an API method | ❌ | ✔️ | ✔️ | +| Changing API behaviour | ❌ | 🟡 Only if backwards-compatible | ✔️ | +| Removal of API | ❌ | ❌ | ✔️ | +| Backwards-incompatible API change (e.g. renaming a method) | ❌ | ❌ | ✔️ | + +### Notes +- **Non-disruptive** means that usage should not be significantly altered by the change. + - Examples of **non-disruptive** changes include adding new commands, or gameplay features like blocks and items. + - Examples of **disruptive** changes include changing the way the server is run, world format changes (since those require downtime for the user to convert their world). +- **API** includes all public and protected classes, functions and constants (unless marked as `@internal`). + - Private members are not part of the API, **unless in a trait**. + ## Making a pull request The basic procedure to create a pull request is: 1. [Fork the repository on GitHub](https://github.com/pmmp/PocketMine-MP/fork). This gives you your own copy of the repository to make changes to. diff --git a/composer.lock b/composer.lock index 51710b868..71e413d01 100644 --- a/composer.lock +++ b/composer.lock @@ -1983,16 +1983,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.24", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -2014,14 +2014,14 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.1", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, "suggest": { @@ -2065,7 +2065,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -2075,9 +2075,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-08-30T07:42:16+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/entity/Living.php b/src/entity/Living.php index 1d597715c..58b7c1791 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -56,6 +56,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; use pocketmine\player\Player; use pocketmine\timings\Timings; use pocketmine\utils\Binary; +use pocketmine\world\sound\BurpSound; use pocketmine\world\sound\EntityLandSound; use pocketmine\world\sound\EntityLongFallSound; use pocketmine\world\sound\EntityShortFallSound; @@ -320,6 +321,9 @@ abstract class Living extends Entity{ foreach($consumable->getAdditionalEffects() as $effect){ $this->effectManager->add($effect); } + if($consumable instanceof FoodSource){ + $this->broadcastSound(new BurpSound()); + } $consumable->onConsume($this); } diff --git a/src/network/mcpe/InventoryManager.php b/src/network/mcpe/InventoryManager.php index 39278cba0..2aea0e0da 100644 --- a/src/network/mcpe/InventoryManager.php +++ b/src/network/mcpe/InventoryManager.php @@ -325,7 +325,7 @@ class InventoryManager{ public function onClientRemoveWindow(int $id) : void{ if($id === $this->lastInventoryNetworkId){ - if($id !== $this->pendingCloseWindowId){ + if(isset($this->windowMap[$id]) && $id !== $this->pendingCloseWindowId){ $this->remove($id); $this->player->removeCurrentWindow(); } diff --git a/src/network/mcpe/handler/PreSpawnPacketHandler.php b/src/network/mcpe/handler/PreSpawnPacketHandler.php index 92e502351..19db3f434 100644 --- a/src/network/mcpe/handler/PreSpawnPacketHandler.php +++ b/src/network/mcpe/handler/PreSpawnPacketHandler.php @@ -62,6 +62,7 @@ class PreSpawnPacketHandler extends PacketHandler{ $location = $this->player->getLocation(); $world = $location->getWorld(); + $this->session->getLogger()->debug("Preparing StartGamePacket"); $levelSettings = new LevelSettings(); $levelSettings->seed = -1; $levelSettings->spawnSettings = new SpawnSettings(SpawnSettings::BIOME_TYPE_DEFAULT, "", DimensionIds::OVERWORLD); //TODO: implement this properly @@ -105,22 +106,39 @@ class PreSpawnPacketHandler extends PacketHandler{ GlobalItemTypeDictionary::getInstance()->getDictionary()->getEntries(), )); + $this->session->getLogger()->debug("Sending actor identifiers"); $this->session->sendDataPacket(StaticPacketCache::getInstance()->getAvailableActorIdentifiers()); + + $this->session->getLogger()->debug("Sending biome definitions"); $this->session->sendDataPacket(StaticPacketCache::getInstance()->getBiomeDefs()); + + $this->session->getLogger()->debug("Sending attributes"); $this->session->syncAttributes($this->player, $this->player->getAttributeMap()->getAll()); + + $this->session->getLogger()->debug("Sending available commands"); $this->session->syncAvailableCommands(); + + $this->session->getLogger()->debug("Sending abilities"); $this->session->syncAbilities($this->player); $this->session->syncAdventureSettings(); + + $this->session->getLogger()->debug("Sending effects"); foreach($this->player->getEffects()->all() as $effect){ $this->session->onEntityEffectAdded($this->player, $effect, false); } + + $this->session->getLogger()->debug("Sending actor metadata"); $this->player->sendData([$this->player]); + $this->session->getLogger()->debug("Sending inventory"); $this->inventoryManager->syncAll(); $this->inventoryManager->syncCreative(); $this->inventoryManager->syncSelectedHotbarSlot(); + + $this->session->getLogger()->debug("Sending crafting data"); $this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->server->getCraftingManager())); + $this->session->getLogger()->debug("Sending player list"); $this->session->syncPlayerList($this->server->getOnlinePlayers()); } diff --git a/src/scheduler/TaskHandler.php b/src/scheduler/TaskHandler.php index e1cadb652..50d9f01b0 100644 --- a/src/scheduler/TaskHandler.php +++ b/src/scheduler/TaskHandler.php @@ -69,6 +69,9 @@ class TaskHandler{ return $this->nextRun; } + /** + * @internal + */ public function setNextRun(int $ticks) : void{ $this->nextRun = $ticks; } @@ -103,11 +106,17 @@ class TaskHandler{ } } + /** + * @internal + */ public function remove() : void{ $this->cancelled = true; $this->task->setHandler(null); } + /** + * @internal + */ public function run() : void{ $this->timings->startTiming(); try{ diff --git a/src/world/sound/BurpSound.php b/src/world/sound/BurpSound.php new file mode 100644 index 000000000..a4467f71d --- /dev/null +++ b/src/world/sound/BurpSound.php @@ -0,0 +1,35 @@ +