PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

[Fix] ItemEntity bounces on Slime Block

Open Swift-Strider opened this issue 3 years ago • 2 comments

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.

Swift-Strider avatar Jun 05 '22 18:06 Swift-Strider

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.

dktapps avatar Sep 21 '22 11:09 dktapps

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.

ColinHDev avatar Sep 27 '22 13:09 ColinHDev