mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Fixed falling blocks getting moved by currents, closes #2080
This commit is contained in:
parent
5d32587cf7
commit
1d5978df98
@ -189,11 +189,13 @@ abstract class Liquid extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addVelocityToEntity(Entity $entity, Vector3 $vector) : void{
|
public function addVelocityToEntity(Entity $entity, Vector3 $vector) : void{
|
||||||
|
if($entity->canBeMovedByCurrents()){
|
||||||
$flow = $this->getFlowVector();
|
$flow = $this->getFlowVector();
|
||||||
$vector->x += $flow->x;
|
$vector->x += $flow->x;
|
||||||
$vector->y += $flow->y;
|
$vector->y += $flow->y;
|
||||||
$vector->z += $flow->z;
|
$vector->z += $flow->z;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function tickRate() : int;
|
abstract public function tickRate() : int;
|
||||||
|
|
||||||
|
@ -1698,6 +1698,15 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
return $this->blocksAround;
|
return $this->blocksAround;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this entity can be moved by currents in liquids.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canBeMovedByCurrents() : bool{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected function checkBlockCollision(){
|
protected function checkBlockCollision(){
|
||||||
$vector = new Vector3(0, 0, 0);
|
$vector = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
@ -79,6 +79,10 @@ class FallingBlock extends Entity{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canBeMovedByCurrents() : bool{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function attack(EntityDamageEvent $source){
|
public function attack(EntityDamageEvent $source){
|
||||||
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){
|
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){
|
||||||
parent::attack($source);
|
parent::attack($source);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user