pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.23k stars 1.51k forks source link

Add onEntityCollide function when entity are above a block #6347

Open Dhaiven opened 1 month ago

Dhaiven commented 1 month ago

Introduction

PocketMine don't have function to detect if an entity are above a block. So i add a function and fix the bug with magma block. But there are other bug of this type (with top of cactus...), so i must to be fix in this pr or open an other pr to fix them ?

Relevant issues

Fix #2041

Changes

API changes

Add Block::onEntityCollide()

Follow-up

Tests

https://github.com/pmmp/PocketMine-MP/assets/55756021/b196bbad-4dce-4118-9a2e-d1546f597df0

IvanCraft623 commented 1 month ago

This does not really check if there is a collision so if there is a slab between the magma block and the player, the player will be burned.

Dhaiven commented 1 month ago

This does not really check if there is a collision so if there is a slab between the magma block and the player, the player will be burned.

Thanks for the feedback, it's fixed

Dhaiven commented 6 days ago

The current implementation only works for collsions on down side. An appropriate solution to the problem would be to detect when colliding with any face of the block, not just one.

Fixed