mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
small tweaks
This commit is contained in:
parent
08f9193191
commit
2ea5fcd034
2 changed files with 17 additions and 17 deletions
|
|
@ -474,8 +474,10 @@ class PocketMinecraftServer{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->tick();
|
$this->tick();
|
||||||
foreach($this->api->level->levels as $l){
|
if($this->ticks % 2 === 0){
|
||||||
$l->onTick($this);
|
foreach($this->api->level->levels as $l){
|
||||||
|
$l->onTick($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ class Entity extends Position{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function environmentUpdate(){
|
public function environmentUpdate(){
|
||||||
$hasUpdate = $this->class === ENTITY_MOB; //force true for mobs
|
$hasUpdate = Entity::$updateOnTick ? $this->class === ENTITY_MOB : false; //force true for mobs
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true && !$this->dead){
|
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true && !$this->dead){
|
||||||
foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){
|
foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){
|
||||||
|
|
@ -438,12 +438,14 @@ class Entity extends Position{
|
||||||
$update = false;
|
$update = false;
|
||||||
if((($this->class !== ENTITY_OBJECT and $this->type !== OBJECT_PRIMEDTNT) or $support === false)){
|
if((($this->class !== ENTITY_OBJECT and $this->type !== OBJECT_PRIMEDTNT) or $support === false)){
|
||||||
$drag = 0.2;
|
$drag = 0.2;
|
||||||
$blocks = $this->level->getCubes($this->boundingBox->getOffsetBoundingBox($this->speedX, $this->speedY, $this->speedZ));
|
if($this->class === ENTITY_MOB || $this->class === ENTITY_ITEM){
|
||||||
foreach($blocks as $b){
|
$blocks = $this->level->getCubes($this->boundingBox->getOffsetBoundingBox($this->speedX, $this->speedY, $this->speedZ));
|
||||||
$this->speedX = $b->calculateXOffset($this->boundingBox, $this->speedX);
|
foreach($blocks as $b){
|
||||||
$this->speedY = $b->calculateYOffset($this->boundingBox, $this->speedY);
|
$this->speedX = $b->calculateXOffset($this->boundingBox, $this->speedX);
|
||||||
$this->speedZ = $b->calculateZOffset($this->boundingBox, $this->speedZ);
|
$this->speedY = $b->calculateYOffset($this->boundingBox, $this->speedY);
|
||||||
}
|
$this->speedZ = $b->calculateZOffset($this->boundingBox, $this->speedZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($this->speedX != 0){
|
if($this->speedX != 0){
|
||||||
$this->speedX -= $this->speedX * $drag;
|
$this->speedX -= $this->speedX * $drag;
|
||||||
|
|
@ -463,7 +465,7 @@ class Entity extends Position{
|
||||||
$z = (int) ($this->z - 0.5);
|
$z = (int) ($this->z - 0.5);
|
||||||
$lim = (int) floor($ny);
|
$lim = (int) floor($ny);
|
||||||
for($y = (int) ceil($this->y) - 1; $y >= $lim; --$y){
|
for($y = (int) ceil($this->y) - 1; $y >= $lim; --$y){
|
||||||
if($this->level->getBlock(new Vector3($x, $y, $z))->isSolid === true){
|
if($this->level->getBlockWithoutVector($x, $y, $z)->isSolid === true){
|
||||||
$support = true;
|
$support = true;
|
||||||
if($this->class === ENTITY_FALLING){
|
if($this->class === ENTITY_FALLING){
|
||||||
$this->y = $ny;
|
$this->y = $ny;
|
||||||
|
|
@ -490,8 +492,7 @@ class Entity extends Position{
|
||||||
}
|
}
|
||||||
|
|
||||||
if($support === false){
|
if($support === false){
|
||||||
$this->speedY -= 0.08;
|
$this->speedY -= $this->class === ENTITY_FALLING ? 0.08 : 1.6;
|
||||||
|
|
||||||
$update = true;
|
$update = true;
|
||||||
}else{
|
}else{
|
||||||
//$this->speedX = 0;
|
//$this->speedX = 0;
|
||||||
|
|
@ -551,10 +552,7 @@ class Entity extends Position{
|
||||||
if($this->class !== ENTITY_PLAYER){
|
if($this->class !== ENTITY_PLAYER){
|
||||||
$this->updateMovement();
|
$this->updateMovement();
|
||||||
}
|
}
|
||||||
if(self::$updateOnTick && $this->class === ENTITY_MOB){
|
$this->needsUpdate = $hasUpdate;
|
||||||
$this->needsUpdate = $hasUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->lastUpdate = $now;
|
$this->lastUpdate = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue