mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Falling Entities, better Physics [not final]
This commit is contained in:
parent
cb03daf28a
commit
58fd67d2ed
8 changed files with 125 additions and 32 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue