From ad9ac6dc48e3be3c18fe50c99f18ccedb81ee091 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Mon, 26 Sep 2022 00:40:14 +0300 Subject: [PATCH] standing on chest should not kick you now --- src/API/BanAPI.php | 1 - src/entity/Entity.php | 15 +++++++++++++-- src/material/block/nonfull/Chest.php | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 93ddc698..55b90f6d 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -93,7 +93,6 @@ class BanAPI{ return; } return false; - break; } } diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 6ef0c2fe..3d14e452 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -346,7 +346,8 @@ class Entity extends Position{ if($this->isStatic === false){ $startX = floor($this->x - 0.5 - $this->size - 1); //prefix for flying when player on fence - $y = (int) floor($this->y - 1); + $y = floor($this->y - 1); + $yC = ceil($this->y - 1); $startZ = floor($this->z - 0.5 - $this->size - 1); $endX = ceil($this->x - 0.5 + $this->size + 1); $endZ = ceil($this->z - 0.5 + $this->size + 1); @@ -355,8 +356,9 @@ class Entity extends Position{ for($z = $startZ; $z <= $endZ; ++$z){ for($x = $startX; $x <= $endX; ++$x){ $v = new Vector3($x, $y, $z); + $v1 = new Vector3($x, $yC, $z); if($this->isSupport($v, $this->size)){ - $b = $this->level->getBlock($v); + $b = $this->level->getBlock($v); if($b->isSolid === true){ $support = true; $isFlying = false; @@ -364,6 +366,15 @@ class Entity extends Position{ }elseif(($b instanceof LiquidBlock) or $b->getID() === COBWEB or $b->getID() === LADDER or $b->getID() === FENCE or $b->getID() === STONE_WALL or $b->getID() === IRON_BARS){ $isFlying = false; } + }elseif($this->isSupport($v1, $this->size)){ + $b = $this->level->getBlock($v1); + if($b->isSolid === true){ + $support = true; + $isFlying = false; + break; + }elseif(($b instanceof LiquidBlock) or $b->getID() === COBWEB or $b->getID() === LADDER or $b->getID() === FENCE or $b->getID() === STONE_WALL or $b->getID() === IRON_BARS){ + $isFlying = false; + } } } if($support === true){ diff --git a/src/material/block/nonfull/Chest.php b/src/material/block/nonfull/Chest.php index 269b5ab7..9da2f542 100644 --- a/src/material/block/nonfull/Chest.php +++ b/src/material/block/nonfull/Chest.php @@ -4,6 +4,7 @@ class ChestBlock extends TransparentBlock{ public function __construct($meta = 0){ parent::__construct(CHEST, $meta, "Chest"); $this->isActivable = true; + $this->isFullBlock = false; $this->hardness = 15; } public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){