mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Merge branch 'master' into mcpe-1.2.5
This commit is contained in:
commit
08092f17e0
@ -164,7 +164,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector) : bool{
|
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
|
||||||
return $blockReplace->canBeReplaced();
|
return $blockReplace->canBeReplaced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,16 +36,20 @@ abstract class Slab extends Transparent{
|
|||||||
|
|
||||||
abstract public function getDoubleSlabId() : int;
|
abstract public function getDoubleSlabId() : int;
|
||||||
|
|
||||||
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector) : bool{
|
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
|
||||||
return parent::canBePlacedAt($blockReplace, $clickVector) or
|
if(parent::canBePlacedAt($blockReplace, $clickVector, $face, $isClickedBlock)){
|
||||||
(
|
return true;
|
||||||
$blockReplace->getId() === $this->getId() and
|
}
|
||||||
$blockReplace->getVariant() === $this->getVariant() and
|
|
||||||
(
|
if($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->getVariant()){
|
||||||
(($blockReplace->getDamage() & 0x08) !== 0 and ($clickVector->y <= 0.5 or $clickVector->y === 1.0)) or //top slab, fill bottom half
|
if(($blockReplace->getDamage() & 0x08) !== 0){ //Trying to combine with top slab
|
||||||
(($blockReplace->getDamage() & 0x08) === 0 and ($clickVector->y >= 0.5 or $clickVector->y === 0.0)) //bottom slab, fill top half
|
return $clickVector->y <= 0.5 or (!$isClickedBlock and $face === Vector3::SIDE_UP);
|
||||||
)
|
}else{
|
||||||
);
|
return $clickVector->y >= 0.5 or (!$isClickedBlock and $face === Vector3::SIDE_DOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
|
||||||
|
@ -1793,10 +1793,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hand->canBePlacedAt($blockClicked, $facePos)){
|
if($hand->canBePlacedAt($blockClicked, $facePos, $face, true)){
|
||||||
$blockReplace = $blockClicked;
|
$blockReplace = $blockClicked;
|
||||||
$hand->position($blockReplace);
|
$hand->position($blockReplace);
|
||||||
}elseif(!$hand->canBePlacedAt($blockReplace, $facePos)){
|
}elseif(!$hand->canBePlacedAt($blockReplace, $facePos, $face, false)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user