mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Merge branch 'staging/4.1' into next-minor
This commit is contained in:
commit
466b018319
@ -29,6 +29,7 @@ use pocketmine\block\utils\BlockDataSerializer;
|
|||||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||||
use pocketmine\block\utils\InvalidBlockStateException;
|
use pocketmine\block\utils\InvalidBlockStateException;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\math\AxisAlignedBB;
|
||||||
use pocketmine\math\Facing;
|
use pocketmine\math\Facing;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
@ -78,6 +79,28 @@ final class Bell extends Transparent{
|
|||||||
return 0b1111;
|
return 0b1111;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function recalculateCollisionBoxes() : array{
|
||||||
|
if($this->attachmentType->equals(BellAttachmentType::FLOOR())){
|
||||||
|
return [
|
||||||
|
AxisAlignedBB::one()->squash(Facing::axis($this->facing), 1 / 4)->trim(Facing::UP, 3 / 16)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if($this->attachmentType->equals(BellAttachmentType::CEILING())){
|
||||||
|
return [
|
||||||
|
AxisAlignedBB::one()->contract(1 / 4, 0, 1 / 4)->trim(Facing::DOWN, 1 / 4)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$box = AxisAlignedBB::one()
|
||||||
|
->squash(Facing::axis(Facing::rotateY($this->facing, true)), 1 / 4)
|
||||||
|
->trim(Facing::UP, 1 / 16)
|
||||||
|
->trim(Facing::DOWN, 1 / 4);
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->attachmentType->equals(BellAttachmentType::ONE_WALL()) ? $box->trim($this->facing, 3 / 16) : $box
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttachmentType() : BellAttachmentType{ return $this->attachmentType; }
|
public function getAttachmentType() : BellAttachmentType{ return $this->attachmentType; }
|
||||||
|
|
||||||
/** @return $this */
|
/** @return $this */
|
||||||
|
@ -46,6 +46,9 @@ class DropItemAction extends InventoryAction{
|
|||||||
|
|
||||||
public function onPreExecute(Player $source) : bool{
|
public function onPreExecute(Player $source) : bool{
|
||||||
$ev = new PlayerDropItemEvent($source, $this->targetItem);
|
$ev = new PlayerDropItemEvent($source, $this->targetItem);
|
||||||
|
if($source->isSpectator()){
|
||||||
|
$ev->cancel();
|
||||||
|
}
|
||||||
$ev->call();
|
$ev->call();
|
||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user