Merge branch 'kotyaralih:master' into master

This commit is contained in:
yefengeeeeeeeeeee 2025-04-13 10:28:29 +08:00 • committed by GitHub
commit f2e82b77de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 90 additions and 60 deletions

View file

@ -501,9 +501,16 @@ class BlockAPI{
$hand->position($block);
//$face = -1;
}
if($hand->isSolid === true and $block->boundingBox->intersectsWith($player->entity->boundingBox) && ($hand->getID() != BED_BLOCK && $hand->getID() != CARPET)){
return $this->cancelAction($block, $player, false); //Entity in block
if($hand->isSolid === true && ($hand->getID() != BED_BLOCK && $hand->getID() != CARPET)){
$aabb = $hand->getAABB($block->level, $block->x, $block->y, $block->z);
$playerbb = $player->entity->boundingBox;
//$aabb->intersectsWith($playerbb) is not good enough for this case
//minY+0.21 is used to stop sneaking from triggering action cancelling
if(($aabb->maxX > $playerbb->minX && $aabb->minX < $playerbb->maxX) && ($aabb->maxY > ($playerbb->minY+0.21) && $aabb->minY < $playerbb->maxY) && ($aabb->maxZ > $playerbb->minZ && $aabb->minZ < $playerbb->maxZ)){
return $this->cancelAction($block, $player, false); //Entity in block
}
}
if($this->server->api->dhandle("player.block.place", ["player" => $player, "block" => $block, "target" => $target, "item" => $item]) === false){