fixed packet spam, removed item merging, various fixes

This commit is contained in:
GameHerobrine 2024-02-14 04:22:20 +03:00
parent dee744e709
commit 908cff1317
7 changed files with 46 additions and 24 deletions

View file

@ -441,7 +441,7 @@ class Entity extends Position
if(!($this instanceof Painting) && !($this->isPlayer() && $this->player->isSleeping !== false)){ //TODO better way to fix
for($i = 0; $i < 8; ++$i){
$x = ((($i >> 0) % 2) - 0.5) * $this->width * 0.8;
$y= ((($i >> 1) % 2) - 0.5) * 0.1;
$y = ((($i >> 1) % 2) - 0.5) * 0.1;
$z = ((($i >> 2) % 2) - 0.5) * $this->width * 0.8;
$blockX = (int) ($this->x + $x);
@ -609,8 +609,8 @@ class Entity extends Position
$z1 = floor($aABB->maxZ + 1);
for($x = $x0; $x < $x1; ++$x){
for($y = $y0; $y < $y1; ++$y){
for($z = $z0; $z < $z1; ++$z){
for($z = $z0; $z < $z1; ++$z){
for($y = $y0 - 1; $y < $y1; ++$y){
$b = $this->level->level->getBlockID($x, $y, $z);
if($b != 0){
$blockBounds = Block::$class[$b]::getCollisionBoundingBoxes($this->level, $x, $y, $z, $this);

View file

@ -24,7 +24,7 @@ class Chicken extends Animal{
public function updateEntityMovement(){
parent::updateEntityMovement();
if($this->onGround && $this->speedY < 0) $this->speedY *= 0.6;
if(!$this->onGround && $this->speedY < 0) $this->speedY *= 0.6;
if($this->timeUntilEgg-- <= 0 && !$this->isBaby()){
$this->dropAnEgg();

View file

@ -94,7 +94,7 @@ class ItemEntity extends Entity{
$this->speedZ = (lcg_value() - lcg_value()) * 0.2;
}
$this->searchForOtherItemsNearby(); //not in vanilla 0.8.1
//$this->searchForOtherItemsNearby(); //not in vanilla 0.8.1, TODO reenable after fixing not correct count in inv
}
if($this->closed) return;
@ -112,6 +112,10 @@ class ItemEntity extends Entity{
if($this->onGround) $this->speedY *= -0.5;
if(abs($this->speedX) < self::MIN_POSSIBLE_SPEED) $this->speedX = 0;
if(abs($this->speedZ) < self::MIN_POSSIBLE_SPEED) $this->speedZ = 0;
if(abs($this->speedY) < self::MIN_POSSIBLE_SPEED) $this->speedY = 0;
++$this->age;
//TODO despawn after age >= 6000 ?;
}