Block: Relocate and document addVelocityToEntity()

maybe we should consider merging this with onEntityInside(), since they are both called for the same reasons? ...
This commit is contained in:
Dylan K. Taylor 2022-09-24 17:24:35 +01:00
parent 77a18d0aea
commit 6a0c54f850
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -342,10 +342,6 @@ class Block{
return false;
}
public function addVelocityToEntity(Entity $entity) : ?Vector3{
return null;
}
final public function getPosition() : Position{
return $this->position;
}
@ -585,6 +581,19 @@ class Block{
return true;
}
/**
* Returns a direction vector describing which way an entity intersecting this block should be pushed.
* This is used by liquids to push entities in liquid currents.
*
* The returned vector is summed with vectors from every other block the entity is intersecting, and normalized to
* produce a final direction vector.
*
* WARNING: This will not be called if {@link Block::hasEntityCollision()} does not return true!
*/
public function addVelocityToEntity(Entity $entity) : ?Vector3{
return null;
}
/**
* Called when an entity lands on this block (usually due to falling).
* @return float|null The new vertical velocity of the entity, or null if unchanged.