mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Slab: placement logic clean up
past me was full of shit, because blockReplace is the same as blockClicked when we click a single slab top/bottom to make a double slab, and the logic is identical to the below block with that in mind.
This commit is contained in:
parent
d961b272c7
commit
418d0f12fb
@ -105,16 +105,6 @@ abstract class Slab extends Transparent{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
/* note these conditions can't be merged, since one targets clicked and the other replace */
|
||||
|
||||
if($blockClicked instanceof Slab and $blockClicked->slabType !== SlabType::DOUBLE() and $blockClicked->isSameType($this) and (
|
||||
($face === Facing::DOWN and $blockClicked->slabType === SlabType::TOP()) or
|
||||
($face === Facing::UP and $blockClicked->slabType === SlabType::BOTTOM())
|
||||
)){
|
||||
$this->slabType = SlabType::DOUBLE();
|
||||
return $this->level->setBlock($blockClicked, $this);
|
||||
}
|
||||
|
||||
if($blockReplace instanceof Slab and $blockReplace->slabType !== SlabType::DOUBLE() and $blockReplace->isSameType($this) and (
|
||||
($blockReplace->slabType === SlabType::TOP() and ($clickVector->y <= 0.5 or $face === Facing::UP)) or
|
||||
($blockReplace->slabType === SlabType::BOTTOM() and ($clickVector->y >= 0.5 or $face === Facing::DOWN))
|
||||
|
Loading…
x
Reference in New Issue
Block a user