|
| 1 | +# 5.5.0 |
| 2 | +Released 6th September 2023. |
| 3 | + |
| 4 | +**For Minecraft: Bedrock Edition 1.20.10** |
| 5 | + |
| 6 | +This is a minor feature release, including performance improvements, new API methods, and new gameplay features. |
| 7 | + |
| 8 | +**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace. |
| 9 | +Do not update plugin minimum API versions unless you need new features added in this release. |
| 10 | + |
| 11 | +**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.** |
| 12 | +Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly. |
| 13 | + |
| 14 | +## Dependencies |
| 15 | +- Updated `pocketmine/math` dependency to [`1.0.0`](https://github.com/pmmp/Math/releases/tag/1.0.0). |
| 16 | +- Updated `pocketmine/nbt` dependency to [`1.0.0`](https://github.com/pmmp/NBT/releases/tag/1.0.0). |
| 17 | + |
| 18 | +## Performance |
| 19 | +- Some events are now no longer fired if no handlers are registered. |
| 20 | + - This improves performance by avoiding unnecessary object allocations and function calls. |
| 21 | + - Events such as `DataPacketReceiveEvent`, `DataPacketSendEvent` and `PlayerMoveEvent` are optimized away almost completely by this change, offering some much-needed performance gains. |
| 22 | +- Significantly improved performance of small moving entities, such as dropped items. |
| 23 | + - This was achieved by a combination of changes, which together improved observed performance with 2000 item entities moving in water by 30-40%. |
| 24 | + - The benefit of this will be most noticeable in SkyBlock servers, where large cactus farms can generate thousands of dropped items. |
| 25 | +- `World->getCollisionBoxes()` now uses an improved search method, which reduces the work done by the function by almost 90% for small entities. |
| 26 | + - This improves performance of collision detection for small entities, such as dropped items. |
| 27 | + |
| 28 | +## Gameplay |
| 29 | +### General |
| 30 | +- Implemented enchanting using an enchanting table (yes, finally!) |
| 31 | + - Thanks to [@S3v3Nice](https://github.com/S3v3Nice) for investing lots of time and effort into developing this. |
| 32 | + - Since this feature is quite complex, it's possible there may be bugs. Please be vigilant and report any issues you find. |
| 33 | + |
| 34 | +### Blocks |
| 35 | +- The following new blocks have been implemented: |
| 36 | + - Pink Petals |
| 37 | +- Pressure plates are now functional, in the sense that they react when entities stand on them and perform the correct logic. |
| 38 | + - Note that since redstone is not yet implemented, pressure plates do not activate any redstone devices, similar to buttons and levers. |
| 39 | +- Signs can now be edited by right-clicking them. |
| 40 | +- Signs can now be waxed using a honeycomb, which prevents them from being edited. |
| 41 | + |
| 42 | +### Items |
| 43 | +- The following new items have been implemented: |
| 44 | + - Enchanted Book |
| 45 | + |
| 46 | +## API |
| 47 | +### `pocketmine\block` |
| 48 | +- The following new API methods have been added: |
| 49 | + - `public Block->getEnchantmentTags() : list<string>` returns a list of strings indicating which types of enchantment can be applied to the block when in item form |
| 50 | + - `public BlockTypeInfo->getEnchantmentTags() : list<string>` |
| 51 | + - `protected PressurePlate->getActivationBox() : AxisAlignedBB` - returns the AABB entities must intersect with in order to activate the pressure plate (not the same as the visual shape) |
| 52 | + - `protected PressurePlate->hasOutputSignal() : bool` - returns whether the pressure plate has an output signal - this should be implemented by subclasses |
| 53 | + - `protected PressurePlate->calculatePlateState() : array{Block, ?bool}` - returns the state the pressure plate will change to if the given list of entities are standing on it, and a bool indicating whether the plate activated or deactivated this tick |
| 54 | + - `protected PressurePlate->filterIrrelevantEntities(list<Entity> $entities) : list<Entity>` - returns the given list filtered of entities that don't affect the plate's state (e.g. dropped items don't affect stone pressure plates) |
| 55 | + - `public BaseSign->isWaxed() : bool` |
| 56 | + - `public BaseSign->setWaxed(bool $waxed) : $this` |
| 57 | + - `public inventory\EnchantInventory->getInput() : Item` |
| 58 | + - `public inventory\EnchantInventory->getLapis() : Item` |
| 59 | + - `public inventory\EnchantInventory->getOutput(int $optionId) : ?Item` - returns the item that would be produced if the input item was enchanted with the selected option, or `null` if the option is invalid |
| 60 | + - `public inventory\EnchantInventory->getOption(int $optionId) : EnchantOption` - returns the enchanting option at the given index |
| 61 | +- The following API methods have signature changes: |
| 62 | + - `BlockTypeInfo->__construct()` now accepts an optional `list<string> $enchantmentTags` parameter |
| 63 | + - `PressurePlate->__construct()` now accepts an optional `int $deactivationDelayTicks` parameter |
| 64 | + - `WeightedPressurePlate->__construct()` now accepts optional `int $deactivationDelayTicks` and `float $signalStrengthFactor` parameters |
| 65 | + - `SimplePressurePlate->__construct()` now accepts an optional `int $deactivationDelayTicks` parameter |
| 66 | +- The following new classes have been added: |
| 67 | + - `PinkPetals` |
| 68 | + - `utils\BlockEventHelper` - provides helper methods for calling block-related events |
| 69 | +- The following classes have been deprecated: |
| 70 | + - `WeightedPressurePlateLight` |
| 71 | + - `WeightedPressurePlateHeavy` |
| 72 | + |
| 73 | +### `pocketmine\entity` |
| 74 | +- The following new API methods have been added: |
| 75 | + - `public Human->getEnchantmentSeed() : int` - returns the current seed used to randomize options shown on the enchanting table for this human |
| 76 | + - `public Human->setEnchantmentSeed(int $seed) : void` |
| 77 | + - `public Human->regenerateEnchantmentSeed() : void` - returns a new randomly generated seed which can be set with `setEnchantmentSeed()` |
| 78 | + |
| 79 | +### `pocketmine\event` |
| 80 | +- The following new classes have been added: |
| 81 | + - `block\FarmlandHydrationChangeEvent` - called when farmland is hydrated or dehydrated |
| 82 | + - `block\PressurePlateUpdateEvent` - called when a pressure plate is activated or changes its power output |
| 83 | + - `player\PlayerEnchantingOptionsRequestEvent` - called when a player puts an item to be enchanted into an enchanting table, to allow plugins to modify the enchanting options shown |
| 84 | + - `player\PlayerItemEnchantEvent` - called when a player enchants an item in an enchanting table |
| 85 | + - `world\WorldDifficultyChangeEvent` - called when a world's difficulty is changed |
| 86 | +- The following new API methods have been added: |
| 87 | + - `public static Event::hasHandlers() : bool` - returns whether the event class has any registered handlers - used like `SomeEvent::hasHandlers()` |
| 88 | + - `public HandlerListManager->getHandlersFor(class-string<? extends Event> $event) : list<RegisteredListener>` - returns a list of all registered listeners for the given event class, using cache if available |
| 89 | + |
| 90 | +### `pocketmine\inventory\transaction` |
| 91 | +- The following new classes have been added: |
| 92 | + - `EnchantingTransaction` - used when a player enchants an item in an enchanting table |
| 93 | + |
| 94 | +### `pocketmine\item` |
| 95 | +- The following new API methods have been added: |
| 96 | + - `public Armor->getMaterial() : ArmorMaterial` - returns an object containing properties shared by all items of the same armor material |
| 97 | + - `public ArmorTypeInfo->getMaterial() : ArmorMaterial` |
| 98 | + - `public Item->getEnchantability() : int` - returns the enchantability value of the item - higher values increase the chance of more powerful enchantments being offered by an enchanting table |
| 99 | + - `public Item->getEnchantmentTags() : list<string>` - returns a list of strings indicating which types of enchantment can be applied to the item |
| 100 | + - `public ToolTier->getEnchantability() : int` |
| 101 | +- The following API methods have signature changes: |
| 102 | + - `Item->__construct()` now accepts an optional `list<string> $enchantmentTags` parameter |
| 103 | + - `ArmorTypeInfo->__construct()` now accepts an optional `?ArmorMaterial $material` parameter |
| 104 | +- The following new classes have been added: |
| 105 | + - `ArmorMaterial` - container for shared armor properties |
| 106 | + - `VanillaArmorMaterials` - all vanilla armor materials |
| 107 | + - `EnchantedBook` - represents an enchanted book item |
| 108 | + |
| 109 | +### `pocketmine\item\enchantment` |
| 110 | +- The following new classes have been added: |
| 111 | + - `AvailableEnchantmentRegistry` - enchantments to be displayed on the enchanting table are selected from here - custom enchantments may be added |
| 112 | + - `EnchantingHelper` - static class containing various helper methods for enchanting tables |
| 113 | + - `EnchantingOption` - represents an option on the enchanting table menu |
| 114 | + - `IncompatibleEnchantmentGroups` - list of constants naming groups of enchantments that are incompatible with each other - custom enchantments may be added using these group names to make them incompatible with existing enchantments in the same group |
| 115 | + - `IncompatibleEnchantmentRegistry` - manages which enchantments are considered incompatible with each other - custom enchantments may be added using existing group names to make them incompatible with existing enchantments in the same group, or to entirely new groups |
| 116 | + - `ItemEnchantmentTagRegistry` - manages item enchantment compatibility tags and which tags include which other tags |
| 117 | + - `ItemEnchantmentTags` - list of constants naming item types for enchantment compatibility checks |
| 118 | +- The following classes have been deprecated |
| 119 | + - `ItemFlags` |
| 120 | +- The following API methods have been added: |
| 121 | + - `public Enchantment->isCompatibleWith(Enchantment $other) : bool` |
| 122 | + - `public Enchantment->getMinEnchantingPower()` - returns the minimum enchanting power (derived from enchantability and number of bookshelves) needed to allow this enchantment to show on the enchanting table with a given level |
| 123 | + - `public Enchantment->getMaxEnchantingPower()` - upper limit of enchanting power for this enchantment to be offered on the enchanting table with a given level |
| 124 | +- The following API methods have signature changes: |
| 125 | + - `Enchantment->__construct()` now accepts optional `(\Closure(int $level) : int)|null $minEnchantingPower` and `int $enchantingPowerRange` parameters |
| 126 | + - `Enchantment->__construct()` parameters `$primaryItemFlags` and `$secondaryItemFlags` are now deprecated and no longer used |
| 127 | + - `ProtectionEnchantment->__construct()` has extra parameters to reflect `Enchantment->__construct()` changes |
| 128 | +- The following API methods have been deprecated: |
| 129 | + - `Enchantment->getPrimaryItemFlags()` - use API methods provided by `AvailableEnchantmentRegistry` instead |
| 130 | + - `Enchantment->getSecondaryItemFlags()` - use API methods provided by `AvailableEnchantmentRegistry` instead |
| 131 | + - `Enchantment->hasPrimaryItemType()` |
| 132 | + - `Enchantment->hasSecondaryItemType()` |
| 133 | + |
| 134 | +### `pocketmine\plugin` |
| 135 | +- The following new API methods have been added: |
| 136 | + - `public PluginBase->getResourcePath(string $filename) : string` - returns a URI to an embedded resource file that can be used with `file_get_contents()` and similar functions |
| 137 | + - `public PluginBase->getResourceFolder() : string` - returns a URI to the plugin's folder of embedded resources |
| 138 | +- The following API methods have been deprecated: |
| 139 | + - `PluginBase->getResource()` - prefer using `getResourcePath()` with `file_get_contents()` or other PHP built-in functions instead |
| 140 | + |
| 141 | +### `pocketmine\resourcepacks` |
| 142 | +- The following new API methods have been added: |
| 143 | + - `public ResourcePackManager->setResourcePacksRequired(bool $value) : void` - sets whether players must accept resource packs in order to join |
| 144 | + |
| 145 | +### `pocketmine\world\generator` |
| 146 | +- The following new API methods have been added: |
| 147 | + - `public GeneratorManager->addAlias(string $name, string $alias) : void` - allows registering a generator alias without copying the generator registration parameters |
| 148 | + |
| 149 | +### `pocketmine\world\sound` |
| 150 | +- The following new classes have been added: |
| 151 | +- `PressurePlateActivateSound` |
| 152 | +- `PressurePlateDeactivateSound` |
| 153 | + |
| 154 | +### `pocketmine\utils` |
| 155 | +- The following new API methods have been added: |
| 156 | + - `public StringToTParser->registerAlias(string $existing, string $alias) : void` - allows registering a string alias without copying registration parameters |
| 157 | + |
| 158 | +## Internals |
| 159 | +- Various `TypeIdMap` classes in the `pocketmine\data\bedrock` package now use the new `IntSaveIdMapTrait` to reduce code duplication. |
| 160 | +- Added a new `ServerProperties` class containing constants for all known `server.properties` keys. |
| 161 | +- Added a new `YmlServerProperties` class containing generated constants for all known `pocketmine.yml` keys. These keys can be used with `Config->getNested()`. |
| 162 | + |
0 commit comments