From 9b196c2c1cd6013bb826028f9e87908636ebf89b Mon Sep 17 00:00:00 2001 From: AzaleeX Date: Sat, 9 Nov 2024 16:38:49 +0100 Subject: [PATCH] fix: phpstan --- src/world/generator/object/NetherGrass.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/world/generator/object/NetherGrass.php b/src/world/generator/object/NetherGrass.php index 6a8e780a355..f8a74ad8d9b 100644 --- a/src/world/generator/object/NetherGrass.php +++ b/src/world/generator/object/NetherGrass.php @@ -32,7 +32,7 @@ class NetherGrass{ public static function growGrass(ChunkManager $world, Vector3 $pos, Random $random, int $count = 8, int $radius = 5) : void{ - $nyliumType = $world->getBlockAt((int) $pos->x, (int) $pos->y, (int) $pos->z)->getTypeId(); + $nyliumType = $world->getBlockAt($pos->x, $pos->y, $pos->z)->getTypeId(); $blocksToGrow = []; //Todo: Add more blocks to grow on nether nylium @@ -56,17 +56,17 @@ public static function growGrass(ChunkManager $world, Vector3 $pos, Random $rand $blocksCount = count($blocksToGrow) - 1; if ($blocksCount >= 0) { for ($c = 0; $c < $count; ++$c) { - $x = $random->nextRange((int)($pos->x - $radius), (int)($pos->x + $radius)); - $z = $random->nextRange((int)($pos->z - $radius), (int)($pos->z + $radius)); - $blockBelow = $world->getBlockAt((int)$x, (int)$pos->y, (int)$z); - if ($world->getBlockAt((int)$x, (int)($pos->y + 1), (int)$z)->getTypeId() === BlockTypeIds::AIR && $blockBelow->getTypeId() !== BlockTypeIds::AIR) { + $x = $random->nextRange($pos->x - $radius, $pos->x + $radius); + $z = $random->nextRange($pos->z - $radius, $pos->z + $radius); + $blockBelow = $world->getBlockAt($x, $pos->y, $z); + if ($world->getBlockAt($x, $pos->y + 1, $z)->getTypeId() === BlockTypeIds::AIR && $blockBelow->getTypeId() !== BlockTypeIds::AIR) { $blockToGrow = $blocksToGrow[$random->nextRange(0, $blocksCount)]; if ($blockToGrow === VanillaBlocks::CRIMSON_ROOTS()) { if ($random->nextFloat() < 0.1) { // 10% chance for rare blocks - $world->setBlockAt((int)$x, (int)($pos->y + 1), (int)$z, $blockToGrow); + $world->setBlockAt($x, $pos->y + 1, $z, $blockToGrow); } } else { - $world->setBlockAt((int)$x, (int)($pos->y + 1), (int)$z, $blockToGrow); + $world->setBlockAt($x, $pos->y + 1, $z, $blockToGrow); } } }