mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 03:35:33 +00:00
Fixed bottom bed offset
This commit is contained in:
parent
08d93fa021
commit
41b1a0f991
@ -301,7 +301,7 @@ class Player{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->isSleeping = $pos;
|
$this->isSleeping = $pos;
|
||||||
$this->teleport(new Position($pos->x + 0.5, $pos->y, $pos->z + 0.5, $this->level));
|
$this->teleport(new Position($pos->x + 0.5, $pos->y + 1, $pos->z + 0.5, $this->level), false, false, false, false);
|
||||||
if($this->entity instanceof Entity){
|
if($this->entity instanceof Entity){
|
||||||
$this->entity->updateMetadata();
|
$this->entity->updateMetadata();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,31 @@ class BedBlock extends TransparentBlock{
|
|||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if($player->sleepOn($this) === false){
|
|
||||||
|
$blockNorth = $this->getSide(2); //Gets the blocks around them
|
||||||
|
$blockSouth = $this->getSide(3);
|
||||||
|
$blockEast = $this->getSide(5);
|
||||||
|
$blockWest = $this->getSide(4);
|
||||||
|
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
|
||||||
|
$b = $this;
|
||||||
|
}else{ //Bottom Part of Bed
|
||||||
|
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
|
||||||
|
$b = $blockNorth;
|
||||||
|
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
|
||||||
|
$b = $blockSouth;
|
||||||
|
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
|
||||||
|
$b = $blockEast;
|
||||||
|
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
||||||
|
$b = $blockWest;
|
||||||
|
}else{
|
||||||
|
$player->dataPacket(MC_CLIENT_MESSAGE, array(
|
||||||
|
"message" => "The bed is incomplete"
|
||||||
|
));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($player->sleepOn($b) === false){
|
||||||
$player->dataPacket(MC_CLIENT_MESSAGE, array(
|
$player->dataPacket(MC_CLIENT_MESSAGE, array(
|
||||||
"message" => "This bed is occupied"
|
"message" => "This bed is occupied"
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user