Cobweb, Ladders and Water won't cause fall damage

This commit is contained in:
Shoghi Cervantes 2014-09-16 10:52:00 +02:00
parent c4a0c759dc
commit 3ba099b309
4 changed files with 22 additions and 1 deletions

View File

@ -22,6 +22,7 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\entity\Entity;
class Cobweb extends Flowable{ class Cobweb extends Flowable{
public function __construct(){ public function __construct(){
@ -31,6 +32,10 @@ class Cobweb extends Flowable{
$this->hardness = 25; $this->hardness = 25;
} }
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
}
public function getDrops(Item $item){ public function getDrops(Item $item){
return []; return [];
} }

View File

@ -25,6 +25,7 @@ use pocketmine\item\Item;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB; use pocketmine\math\AxisAlignedBB;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\entity\Entity;
class Ladder extends Transparent{ class Ladder extends Transparent{
public function __construct($meta = 0){ public function __construct($meta = 0){
@ -34,6 +35,10 @@ class Ladder extends Transparent{
$this->hardness = 2; $this->hardness = 2;
} }
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
}
public function getBoundingBox(){ public function getBoundingBox(){
$f = 0.125; $f = 0.125;

View File

@ -21,6 +21,7 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\entity\Entity;
class StillWater extends Water{ class StillWater extends Water{
public function __construct($meta = 0){ public function __construct($meta = 0){
@ -28,4 +29,9 @@ class StillWater extends Water{
$this->hardness = 500; $this->hardness = 500;
} }
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->extinguish();
}
} }

View File

@ -26,6 +26,7 @@ use pocketmine\level\Level;
use pocketmine\level\Position; use pocketmine\level\Position;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;
use pocketmine\entity\Entity;
class Water extends Liquid{ class Water extends Liquid{
public function __construct($meta = 0){ public function __construct($meta = 0){
@ -36,7 +37,11 @@ class Water extends Liquid{
public function getBoundingBox(){ public function getBoundingBox(){
return null; return null;
} }
public function onEntityCollide(Entity $entity){
$entity->fallDistance = 0;
$entity->extinguish();
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true); $ret = $this->getLevel()->setBlock($this, $this, true);