mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
Block: rename onEntityCollide() -> onEntityInside()
this better describes what the hook is for.
This commit is contained in:
parent
d586a18a16
commit
425ad6101f
@ -705,9 +705,12 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Called when an entity's bounding box clips inside this block's cell. Note that the entity may not be intersecting
|
||||||
|
* with the collision box or bounding box.
|
||||||
|
*
|
||||||
* @param Entity $entity
|
* @param Entity $entity
|
||||||
*/
|
*/
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Cactus extends Transparent{
|
|||||||
return AxisAlignedBB::one()->contract($shrinkSize, 0, $shrinkSize)->trim(Facing::UP, $shrinkSize);
|
return AxisAlignedBB::one()->contract($shrinkSize, 0, $shrinkSize)->trim(Facing::UP, $shrinkSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1);
|
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1);
|
||||||
$entity->attack($ev);
|
$entity->attack($ev);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class Cobweb extends Flowable{
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$entity->resetFallDistance();
|
$entity->resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class Fire extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
|
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
|
||||||
$entity->attack($ev);
|
$entity->attack($ev);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Ladder extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$entity->resetFallDistance();
|
$entity->resetFallDistance();
|
||||||
$entity->onGround = true;
|
$entity->onGround = true;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class Lava extends Liquid{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$entity->fallDistance *= 0.5;
|
$entity->fallDistance *= 0.5;
|
||||||
|
|
||||||
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4);
|
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4);
|
||||||
|
@ -60,7 +60,7 @@ class Magma extends Solid{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
if(!$entity->isSneaking()){
|
if(!$entity->isSneaking()){
|
||||||
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
|
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
|
||||||
$entity->attack($ev);
|
$entity->attack($ev);
|
||||||
|
@ -66,7 +66,7 @@ class TNT extends Solid{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
if($entity instanceof Arrow and $entity->isOnFire()){
|
if($entity instanceof Arrow and $entity->isOnFire()){
|
||||||
$this->ignite();
|
$this->ignite();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class Vine extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$entity->resetFallDistance();
|
$entity->resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class Water extends Liquid{
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityCollide(Entity $entity) : void{
|
public function onEntityInside(Entity $entity) : void{
|
||||||
$entity->resetFallDistance();
|
$entity->resetFallDistance();
|
||||||
if($entity->isOnFire()){
|
if($entity->isOnFire()){
|
||||||
$entity->extinguish();
|
$entity->extinguish();
|
||||||
|
@ -1548,7 +1548,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
$vector = $this->temporalVector->setComponents(0, 0, 0);
|
$vector = $this->temporalVector->setComponents(0, 0, 0);
|
||||||
|
|
||||||
foreach($this->getBlocksAround() as $block){
|
foreach($this->getBlocksAround() as $block){
|
||||||
$block->onEntityCollide($this);
|
$block->onEntityInside($this);
|
||||||
$block->addVelocityToEntity($this, $vector);
|
$block->addVelocityToEntity($this, $vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user