For Minecraft PE 1.1.0.55
Many breaking API changes for type safety, major entity performance improvements, custom blocks & items
DISCLAIMER: This is an ALPHA snapshot. This version is NOT FEATURE COMPLETE and may be unstable. PMMP is not responsible for nuclear war, explosions or loss of data resulting from use of this build. Please use our issue tracker to report bugs.
This build has breaking API changes, so the API has been bumped to 3.0.0-ALPHA7. These changes are NOT yet complete.
NOTE: This will be the last big release to support PHP 7.0.
Notable changes
Core
- Backtraces no longer incorrectly show a
boolean
parameter when a function call in the stack trace had no parameters. - Configs will now save correctly when the type was auto-detected due to being unspecified.
- Fixed RakLibInterface crashing when exceptions are raised during packet handling, after the player was closed.
- Fixed UUIDs becoming corrupted when converted to strings
- Fixed crashes caused by NBT TAG_Short being written as signed but read as unsigned.
- Plugin load error messages such as "incompatible API version" and "Unknown dependency" are now more verbose
- Significant performance enhancements to entity ticking and to explosions
- The server will no longer crash when players join if the spawn radius is set to 0.
API
The big breaking changes
A large number of API methods and interfaces have prototype changes - addition of scalar typehints throughout the code. The most breaking of these for plugins are the following:
CommandExecutor->onCommand()
:- before:
onCommand(CommandSender $sender, Command $command, $label, $args)
- after:
onCommand(CommandSender $sender, Command $command, string $label, $args) : bool
- before:
Task->onRun()
:- before:
onRun($currentTick)
- after:
onRun(int $currentTick)
- before:
Plugins implementing these methods will require the implementing methods' signatures changing to comply with the core code.
NOTE THAT THESE CHANGES ARE NOT FINAL. PHP 7.2 will add void
and nullable return typehints which will also be made use of when we move to PHP 7.2.
Other changes
Commands
- Added
InvalidCommandSyntaxException
. Throwing this exception in a Command's execution function will cause its usage to be displayed. This is used to reduce repeated code in the built-in commands and has not been tested from aCommandExecutor
perspective (yet).
Block
- Plugins can now register their own custom blocks and/or override existing implementations. Refer to
BlockFactory
for documentation. - Block ID constants are now generated automatically from vanilla. In the mix, many old aliases which didn't make sense have been removed.
- Several Block classes have been removed due to excess duplication. Blocks are now instantiated by creating clones of pre-initialized objects registered in BlockFactory.
Block->canBeActivated()
andItem->canBeActivated()
have been removed due to extra confusion they caused in the implementation of new gameplay features.Block->getDrops()
now returnsItem[]
instead ofint[][]
. Plugins which use this method will need alterations.Block::get()
now redirects toBlockFactory::get()
. This is backwards compatible with existing implementations.Block::get()
will now throw exceptions when out-of-bounds block IDs or block meta values are given.new Block()
should now only be used for constructing block types.Block::get()
orBlockFactory::get()
should be used instead for getting block instances to set into the world.Block->getResistance()
has been deprecated, superseded byBlock->getBlastResistance()
.- Added API method
Block->ticksRandomly() : bool
(used for level random block ticking registration, see below)
Entity
- Obsolete first parameters have been removed from
Entity->attack()
andEntity->heal()
. Entity->getHealth()
now returns a float, andEntity->setHealth()
now accepts floats.- Redundant public property
Entity->length
has been removed. Entity->closed
is now protected, useEntity->isClosed()
instead. (eebc52e)
Events
- Added the following events:
- NetworkInterfaceCrashEvent
- NetworkInterfaceRegisterEvent
- NetworkInterfaceUnregisterEvent
- PlayerJumpEvent
- Fixed
EntityEatBlockEvent
not being called when a player eats a slice of cake - Fixed
PlayerBucketEmptyEvent
not being used anywhere
Item
- Plugins can now register their own custom items and/or override existing implementations. Refer to
ItemFactory
for documentation. - Item ID constants are now generated automatically from vanilla. In the mix, many old aliases which didn't make sense have been removed.
- Added API methods
Item->hasEnchantment(int, int) : bool
,Item->removeEnchantment(int, int)
,Item->removeEnchantments()
- Added API methods
Item->getAttackPoints() : int
andItem->getDefensePoints() : int
- Many redundant item classes have been removed due to excess duplication. Items are now instantiated by creating clones of pre-initialized objects registered in
ItemFactory
. Item->clearCustomBlockData()
now works correctly.new Item()
should now only be used for constructing item types.Item::get()
orItemFactory::get()
should be used instead for getting item instances to set into an inventory.Item::get()
andItem::fromString()
now redirect to their respective methods inItemFactory
. This is backwards compatible with existing implementations.- The
count
parameter has been removed fromItem::__construct()
. - Fixed issues with serialize/deserialize items from NBT where the tag kept the wrong name
Level
Level->dropItem()
now returns a reference to the created item entity.Nether
generator no longer returnsnormal
ingetName()
.
Math
- Added precision and rounding mode arguments to
Vector3->round()
. This defaults to the original behaviour if the arguments are not specified. Position->equals()
andLocation->equals()
will now additionally check level (if the parameter is an instance of Position) and yaw/pitch (if the parameter is an instance of Location) respectively. (b8a3030)
Network
- MCPE packets are now registered in
pocketmine\network\mcpe\protocol\PacketPool
. API methodsregisterPacket()
andgetPacket()
have been removed fromNetwork
. This is to allow easier auto-generation of protocol-related code. - Added
PlayerNetworkSessionAdapter
. This is currently used to reduce the amount of empty handlers inPlayer
, however this may cause problems which override handlers inPlayer
to handle packets. Plugins which overridePlayer->handleDataPacket()
should still work correctly, provided that you remember to call the parent.
The developers are aware that this is an API problem and this will be resolved in a future update. Please remember that the network refactor is not finished and don't kill the developers. Packet->decode()
andPacket->encode()
should no longer be overridden by plugins as core functionality is performed in here. UsePacket->decodePayload()
andPacket->encodePayload()
when creating new packets.
Plugin handling
- Plugins can now specify the
mcpe-protocol
attribute in plugin.yml to specify compatible protocol versions. - Specifying API as
2.0
when the server API is2.0.0
or similar is now legal and will work correctly. - Fixed plugins with unknown dependencies claiming to have circular dependencies.
Tasks
- The
MainLogger
is now accessible in AsyncTasks by use ofMainLogger::getLogger()
. - Throwing exceptions during
Task->onCancel()
will no longer cause server crashes and undesirable behaviour. ServerScheduler->scheduleAsyncTask()
now returns the ID of the worker the task was scheduled to.
Tile
- Added some methods to
tile\Sign
andSignChangeEvent
for consistency. (42fb1d1) Sign->setText()
now accepts null parameters to leave the text on those lines as-is.Spawnable->getSpawnCompound()
is now final. Plugins implementing custom tiles should instead overrideSpawnable->addAdditionalSpawnData()
. See #1259 for changes and examples.
Gameplay
Blocks
- Implemented: bone block, coloured beds, concrete, double plants, end rod, glazed terracotta, magma, nether wart, nether wart block, red nether brick, stained glass
- Beds can no longer be slept in beyond a 2-block distance.
- Fixed beds not requiring a solid block under the head
- Fixed bookshelves dropping themselves instead of 3 books
- Fixed quartz pillar rotation not working correctly
- Grass growth and death now works correctly.
- Lit redstone lamp block now emits the correct amount of light.
- Obsidian can no longer be destroyed by TNT
- Placing rails is now less weird (they still won't join up though yet).
- Re-added Nether Reactor core (decorative only, as in vanilla)
Commands
- Command usage messages are now translated server-side to resolve client-side translation issues.
Entities
- Armor will now correctly absorb damage when the resulting damage from an attack is less than 1 point.
- Fixed mobs such as zombies and villagers not having their positions updated server-side when something causes them to gain motion. This fixes problems with floating mobs and zombies being unkillable in earlier versions. As an added bonus, the change fixing this problem brought in substantial performance improvements. See 2f3c77c and c32b75f for details.
- Fixed cake not applying any food/saturation to the eater
- Absorption and damage resistance now absorb the correct amount of damage when armor is worn.
Inventory
- Several furnace fuel items which did not work before now work correctly.
- Armor screen on PE will no longer duplicate armor items when equipping armor.
World
- Fixed level random block ticking not being random anymore on the third iteration
- The presence of a spectator player will no longer prevent building at a target.
- Players will no longer take decades to spawn when the server is generating a new world. This was caused by a bug in chunk requesting causing the server not to fully utilize the CPU, which significantly delayed chunk generation before spawn.