aaa i hate sql(mobs will cause less lags)

This commit is contained in:
GameHerobrine 2022-11-02 20:21:44 +03:00
parent f40fe179c1
commit 51442ed771
5 changed files with 1411 additions and 1210 deletions

View file

@ -1,12 +1,15 @@
<?php
class Level{
/**
* List of entities in this world
* @var array
*/
/**
* @var Config
*/
public $entities;
/**
* This is an array of entities in this world.
* @var Entity[]
*/
public $entityList;
public $tiles, $blockUpdates, $nextSave, $players = [], $level;
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $stopTime;
@ -230,7 +233,7 @@ class Level{
if($e->level->getName() != $this->getName()){
return false; //not the same world
}
foreach($this->entities as $e1){
foreach($this->entityList as $e1){
if($e->boundingBox->intersectsWith($e1->boundingBox) && $e1->isCollidable){
$e->onCollideWith($e1);
$e1->onCollideWith($e);
@ -336,8 +339,12 @@ class Level{
}
public function onTick(PocketMinecraftServer $server){
$ents = $server->api->entity->getAll($this);
foreach($ents as $e){
//$ents = $server->api->entity->getAll($this);
foreach($this->entityList as $k => $e){
if(!($e instanceof Entity)){
unset($this->entityList[$k]);
continue;
}
if($e->needsUpdate){
$e->update();
}