motion packet spam fix, explosion optimizations, tnt gravity fix

This commit is contained in:
GameHerobrine 2023-11-06 15:55:59 +03:00
parent 6e8d7bead3
commit 69d5589191
4 changed files with 96 additions and 53 deletions

View file

@ -8,9 +8,10 @@ class PrimedTNT extends Entity{
if(!isset($this->data["fuse"])){
$this->data["fuse"] = 0;
}
$this->hasGravity = true;
$this->gravity = 0.04;
$this->setHealth(10000000, "generic");
$this->server->schedule(5, [$this, "updateFuse"], [], true);
$this->update();
}
public function getMetadata(){
@ -18,7 +19,14 @@ class PrimedTNT extends Entity{
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
return $d;
}
public function createSaveData(){
$data = parent::createSaveData();
$data["fuse"] = $this->data["fuse"];
$data["power"] = $this->data["power"];
return $data;
}
public function updateFuse(){
if($this->closed === true){
return false;