PocketMine-MP
PocketMine-MP copied to clipboard
[Fix] ItemEntity bounces on Slime Block
Introduction
This PR fixes items previously not bouncing on slime blocks.
Relevant issues
- Fixes #4830
Changes
Items now bounce on slime blocks.
API changes
No significant API changes, as onHitGround() was only overriden. It may break plugins that depend on ItemEntity's previous behavior of landing without calling $fallBlock->onEntityLand().
Behavioural changes
Items now bounce on slime blocks.
Backwards compatibility
This is a backwards compatible change.
Follow-up
Perhaps moving generic physics code and applying that to ItemEntity, armor_stand, etc.
Tests
I haven't added any tests.
I think the code for calling
Block::onEntityLand()should be moved from Living to Entity while leaving the fall damage code in Living instead of creating boilerplate for this use case.
You might be right about this, but it might have other unintended consequences, e.g. bouncy XP orbs, bouncy arrows, etc.
And limiting the affected entities in the Slime class itself?
The Block::onEntityLand() already has it in its name: It's supposedly called once an entity lands on it. So every block extending that method should decide for themselves to which entities they want to limit their behaviour.