mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Falling Entities, better Physics [not final]
This commit is contained in:
@@ -715,18 +715,28 @@ class BlockAPI{
|
||||
}
|
||||
}*/
|
||||
|
||||
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL){
|
||||
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL, $delay = false){
|
||||
if(!($pos instanceof Block)){
|
||||
$block = $pos->level->getBlock($pos);
|
||||
}else{
|
||||
$block = $pos;
|
||||
}
|
||||
$this->blockUpdate($block->getSide(0), $type);
|
||||
$this->blockUpdate($block->getSide(1), $type);
|
||||
$this->blockUpdate($block->getSide(2), $type);
|
||||
$this->blockUpdate($block->getSide(3), $type);
|
||||
$this->blockUpdate($block->getSide(4), $type);
|
||||
$this->blockUpdate($block->getSide(5), $type);
|
||||
|
||||
if($delay !== false){
|
||||
$this->scheduleBlockUpdate($block->getSide(0), $delay, $type);
|
||||
$this->scheduleBlockUpdate($block->getSide(1), $delay, $type);
|
||||
$this->scheduleBlockUpdate($block->getSide(2), $delay, $type);
|
||||
$this->scheduleBlockUpdate($block->getSide(3), $delay, $type);
|
||||
$this->scheduleBlockUpdate($block->getSide(4), $delay, $type);
|
||||
$this->scheduleBlockUpdate($block->getSide(5), $delay, $type);
|
||||
}else{
|
||||
$this->blockUpdate($block->getSide(0), $type);
|
||||
$this->blockUpdate($block->getSide(1), $type);
|
||||
$this->blockUpdate($block->getSide(2), $type);
|
||||
$this->blockUpdate($block->getSide(3), $type);
|
||||
$this->blockUpdate($block->getSide(4), $type);
|
||||
$this->blockUpdate($block->getSide(5), $type);
|
||||
}
|
||||
}
|
||||
|
||||
public function blockUpdate(Position $pos, $type = BLOCK_UPDATE_NORMAL){
|
||||
|
@@ -170,6 +170,10 @@ class LevelAPI{
|
||||
"yaw" => $entity["Rotation"][0],
|
||||
"pitch" => $entity["Rotation"][1],
|
||||
));
|
||||
}elseif($entity["id"] === FALLING_SAND){
|
||||
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_FALLING, $entity["id"], $entity);
|
||||
$e->setPosition(new Vector3($entity["Pos"][0], $entity["Pos"][1], $entity["Pos"][2]), $entity["Rotation"][0], $entity["Rotation"][1]);
|
||||
$e->setHealth($entity["Health"]);
|
||||
}elseif($entity["id"] === OBJECT_PAINTING){ //Painting
|
||||
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_OBJECT, $entity["id"], $entity);
|
||||
$e->setPosition(new Vector3($entity["Pos"][0], $entity["Pos"][1], $entity["Pos"][2]), $entity["Rotation"][0], $entity["Rotation"][1]);
|
||||
|
Reference in New Issue
Block a user