mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
Bed: bounce doesn't apply if the entity was sneaking
This commit is contained in:
parent
ded778f422
commit
8e2486b96a
@ -30,6 +30,7 @@ use pocketmine\block\utils\DyeColor;
|
|||||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||||
use pocketmine\data\bedrock\DyeColorIdMap;
|
use pocketmine\data\bedrock\DyeColorIdMap;
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
|
use pocketmine\entity\Living;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\lang\KnownTranslationFactory;
|
use pocketmine\lang\KnownTranslationFactory;
|
||||||
use pocketmine\math\AxisAlignedBB;
|
use pocketmine\math\AxisAlignedBB;
|
||||||
@ -172,6 +173,9 @@ class Bed extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onEntityLand(Entity $entity) : ?float{
|
public function onEntityLand(Entity $entity) : ?float{
|
||||||
|
if($entity instanceof Living && $entity->isSneaking()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$entity->fallDistance *= 0.5;
|
$entity->fallDistance *= 0.5;
|
||||||
return $entity->getMotion()->y * -3 / 4; // 2/3 in Java, according to the wiki
|
return $entity->getMotion()->y * -3 / 4; // 2/3 in Java, according to the wiki
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user