mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
entities will update every tick, fixed air(hopefully)
This commit is contained in:
parent
338902af19
commit
a6f2c7e257
2 changed files with 10 additions and 14 deletions
|
|
@ -1331,6 +1331,7 @@ class Player{
|
|||
if(EventHandler::callEvent(new DataPacketReceiveEvent($this, $packet)) === BaseEvent::DENY){
|
||||
return;
|
||||
}
|
||||
ConsoleAPI::debug("Got packet: {$packet->pid()}");
|
||||
switch($packet->pid()){
|
||||
case 0x01:
|
||||
break;
|
||||
|
|
@ -1917,7 +1918,7 @@ class Player{
|
|||
$this->teleport($this->spawnPosition);
|
||||
if($this->entity instanceof Entity){
|
||||
$this->entity->fire = 0;
|
||||
$this->entity->air = 300;
|
||||
$this->entity->air = $this->entity->maxAir;
|
||||
$this->entity->setHealth(20, "respawn", true);
|
||||
$this->entity->updateMetadata();
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class Entity extends Position
|
|||
public $boundingBox;
|
||||
public $age;
|
||||
public $air;
|
||||
public $maxAir = 300;
|
||||
public $spawntime;
|
||||
public $dmgcounter;
|
||||
public $eid;
|
||||
|
|
@ -103,7 +104,7 @@ class Entity extends Position
|
|||
$this->health = 20;
|
||||
$this->hasGravity = false;
|
||||
$this->dmgcounter = array(0, 0, 0);
|
||||
$this->air = 200;
|
||||
$this->air = $this->maxAir;
|
||||
$this->fire = 0;
|
||||
$this->crouched = false;
|
||||
$this->invincible = false;
|
||||
|
|
@ -360,7 +361,7 @@ class Entity extends Position
|
|||
|
||||
if($this->dead === true){
|
||||
$this->fire = 0;
|
||||
$this->air = 200;
|
||||
$this->air = $this->maxAir;
|
||||
return false;
|
||||
}
|
||||
if($this->isInVoid()){
|
||||
|
|
@ -423,10 +424,10 @@ class Entity extends Position
|
|||
$this->harm(2, "water");
|
||||
}
|
||||
}else{
|
||||
$this->air = 200; //TODO $this->maxAir;
|
||||
$this->air = $this->maxAir;
|
||||
}
|
||||
}else{
|
||||
$this->air = 200; //TODO $this->maxAir;
|
||||
$this->air = $this->maxAir;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -500,14 +501,8 @@ class Entity extends Position
|
|||
$this->lastUpdate = $now;
|
||||
return;
|
||||
}
|
||||
$tdiff = $now - $this->lastUpdate;
|
||||
if($this->tickCounter === 0){
|
||||
$this->tickCounter = 1;
|
||||
$hasUpdate = $this->environmentUpdate();
|
||||
} else{
|
||||
$hasUpdate = true;
|
||||
$this->tickCounter = 0;
|
||||
}
|
||||
|
||||
$hasUpdate = $this->environmentUpdate();
|
||||
|
||||
if($this->closed === true){
|
||||
return false;
|
||||
|
|
@ -1418,7 +1413,7 @@ class Entity extends Position
|
|||
public function makeDead($cause){
|
||||
if($this->server->api->dhandle("entity.death", ["entity" => $this, "cause" => $cause]) === false) return false;
|
||||
$this->spawnDrops();
|
||||
$this->air = 200;
|
||||
$this->air = $this->maxAir;
|
||||
$this->fire = 0;
|
||||
$this->crouched = false;
|
||||
$this->fallY = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue