emerald gen changes + nc 0.8 fixes

This commit is contained in:
GameHerobrine 2023-11-28 02:58:32 +03:00
parent 1bba9b83d1
commit 3ee0bd14c1
11 changed files with 29 additions and 119 deletions

View file

@ -60,9 +60,9 @@ abstract class Animal extends Creature implements Ageable, Breedable{
public function spawnChild()
{
return $this->server->api->entity->add($this->level, $this->class, $this->type, [
"x" => $this->x + Utils::randomFloat() * mt_rand(-1, 1),
"x" => $this->x + lcg_value() * mt_rand(-1, 1),
"y" => $this->y,
"z" => $this->z + Utils::randomFloat() * mt_rand(-1, 1),
"z" => $this->z + lcg_value() * mt_rand(-1, 1),
"IsBaby" => true,
"Age" => -24000,
]);

View file

@ -1239,8 +1239,8 @@ class Entity extends Position
if ($ret != false && $this->hasKnockback && is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false) {
$d = $entity->x - $this->x;
for ($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (Utils::randomFloat() - Utils::randomFloat()) * 0.01) {
$d = (Utils::randomFloat() - Utils::randomFloat()) * 0.01;
for ($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (lcg_value() - lcg_value()) * 0.01) {
$d = (lcg_value() - lcg_value()) * 0.01;
}
// attackedAtYaw = (float)((Math.atan2($d1, $d) * 180D) / 3.1415927410125732D) >
$this->knockBack($d, $d1);

View file

@ -16,7 +16,7 @@ class TaskLookAround extends TaskBase
public function canBeExecuted(EntityAI $ai)
{
return !$ai->entity->inPanic && !$ai->entity->isMoving() && Utils::randomFloat() < 0.02 && !$ai->isStarted("TaskLookAtPlayer") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath(); /*Vanilla value*/
return !$ai->entity->inPanic && !$ai->entity->isMoving() && lcg_value() < 0.02 && !$ai->isStarted("TaskLookAtPlayer") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath(); /*Vanilla value*/
}
public function onUpdate(EntityAI $ai)

View file

@ -4,7 +4,7 @@ class TaskLookAtPlayer extends TaskBase{
public $target = false;
private $state, $yaw, $pitch;
public function canBeExecuted(EntityAI $ai){
return !$ai->entity->inPanic && Utils::randomFloat() < 0.02 && !$ai->entity->isMovingHorizontally() && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath();
return !$ai->entity->inPanic && lcg_value() < 0.02 && !$ai->entity->isMovingHorizontally() && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskTempt") && !$ai->entity->hasPath();
}
protected function findTarget($e, $r){

View file

@ -18,7 +18,7 @@ class TaskSwimming extends TaskBase
$this->reset();
}
if(Utils::randomFloat() < 0.8){ #1.5.2 method
if(lcg_value() < 0.8){ #1.5.2 method
$ai->entity->speedY = 0.42;
}