From 38d4bd664434ef5494e07edb241524e351f7d1ec Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Tue, 10 Jan 2023 00:55:15 +0300 Subject: [PATCH] 143 fix --- src/entity/Entity.php | 40 ++++----------------- src/material/block/ore/RedstoneOreBlock.php | 2 +- src/world/Level.php | 1 - src/world/MobSpawner.php | 2 +- 4 files changed, 8 insertions(+), 37 deletions(-) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index a0336b6e..ca19dc27 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -570,9 +570,9 @@ class Entity extends Position $y1 = $y1 > 128 ? 128 : $y1; $z1 = $z1 > 256 ? 256 : $z1; $waterDone = false; - for($x = $x0 - 1; $x < $x1 + 1; ++ $x){ - for($y = $y0; $y < $y1; ++ $y){ - for($z = $z0 - 1; $z < $z1 + 1; ++ $z){ + for($x = $x0; $x < $x1; ++$x){ + for($y = $y0; $y < $y1; ++$y){ + for($z = $z0; $z < $z1; ++$z){ $pos = new Vector3($x, $y, $z); $b = $this->level->getBlock($pos); switch($b->getID()) { @@ -637,37 +637,9 @@ class Entity extends Position } } + } - if(!$support){ - for($z = $startZ; $z <= $endZ; ++ $z){ - for($x = $startX; $x <= $endX; ++ $x){ - $v = new Vector3($x, $y, $z); - $v1 = new Vector3($x, $yC, $z); - if($this->isSupport($v, $this->width)){ - $b = $this->level->getBlock($v); - if($b->isSolid === true){ - $support = true; - $isFlying = false; - break; - } elseif(($b instanceof LiquidBlock) or $b->getID() === COBWEB or $b->getID() === LADDER or $b->getID() === FENCE or $b->getID() === STONE_WALL or $b->getID() === IRON_BARS){ - $isFlying = false; - } - } elseif($this->isSupport($v1, $this->width)){ - $b = $this->level->getBlock($v1); - if($b->isSolid === true){ - $support = true; - $isFlying = false; - break; - } elseif(($b instanceof LiquidBlock) or $b->getID() === COBWEB or $b->getID() === LADDER or $b->getID() === FENCE or $b->getID() === STONE_WALL or $b->getID() === IRON_BARS){ - $isFlying = false; - } - } - } - if($support === true){ - break; - } - } - } + if($this->speedX != 0){ $this->x += $this->speedX; $this->speedX -= $this->speedX * $drag; @@ -1524,7 +1496,7 @@ class Entity extends Position if($this->speedY > 0.40000000596046448){ $this->speedY = 0.40000000596046448; } - $this->speedY /= 2; + //$this->speedY /= 2; } public function getHealth() diff --git a/src/material/block/ore/RedstoneOreBlock.php b/src/material/block/ore/RedstoneOreBlock.php index 7529a6f7..499a580e 100644 --- a/src/material/block/ore/RedstoneOreBlock.php +++ b/src/material/block/ore/RedstoneOreBlock.php @@ -16,7 +16,7 @@ class RedstoneOreBlock extends SolidBlock{ } public function getDrops(Item $item, Player $player){ - if($item->getPickaxeLevel() >= 2){ + if($item->getPickaxeLevel() >= 4){ return array( array(REDSTONE_DUST, 0, mt_rand(4, 5)), ); diff --git a/src/world/Level.php b/src/world/Level.php index 0b46fc56..19d9b6f3 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -271,7 +271,6 @@ class Level{ $e->update(); } } - if(Entity::$updateOnTick && $server->ticks % 40 === 0){ //40 ticks delay $this->mobSpawner->handle(); } diff --git a/src/world/MobSpawner.php b/src/world/MobSpawner.php index 1e554d99..f76ed5c0 100644 --- a/src/world/MobSpawner.php +++ b/src/world/MobSpawner.php @@ -11,7 +11,7 @@ class MobSpawner{ public function countEntities(){ $ents = 0; - foreach($this->level->entityList as $e){ + foreach($this->level->entityList as $e){ //TODO no for loop if(!$e->isPlayer() && $e->class === ENTITY_MOB){ ++$ents; }