mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
World: don't assume that random Vector3 are int vectors
we can safely assume this for blocks (though the type info doesn't reflect it) but this is not safe to assume for random APIs that might be used by plugins.
This commit is contained in:
parent
bbe66e8e09
commit
d09af2e30d
@ -109,7 +109,7 @@ final class CropGrowthHelper{
|
||||
$world = $position->getWorld();
|
||||
|
||||
//crop growth is not affected by time of day since 1.11 or so
|
||||
return $world->getPotentialLight($position) >= $minLevel;
|
||||
return $world->getPotentialLightAt($position->x, $position->y, $position->z) >= $minLevel;
|
||||
}
|
||||
|
||||
public static function canGrow(Block $block) : bool{
|
||||
|
@ -1670,7 +1670,10 @@ class World implements ChunkManager{
|
||||
* time of day.
|
||||
*/
|
||||
public function getFullLight(Vector3 $pos) : int{
|
||||
return $this->getFullLightAt($pos->x, $pos->y, $pos->z);
|
||||
$floorX = $pos->getFloorX();
|
||||
$floorY = $pos->getFloorY();
|
||||
$floorZ = $pos->getFloorZ();
|
||||
return $this->getFullLightAt($floorX, $floorY, $floorZ);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1699,7 +1702,10 @@ class World implements ChunkManager{
|
||||
* This is not affected by weather or time of day.
|
||||
*/
|
||||
public function getPotentialLight(Vector3 $pos) : int{
|
||||
return $this->getPotentialLightAt($pos->x, $pos->y, $pos->z);
|
||||
$floorX = $pos->getFloorX();
|
||||
$floorY = $pos->getFloorY();
|
||||
$floorZ = $pos->getFloorZ();
|
||||
return $this->getPotentialLightAt($floorX, $floorY, $floorZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,6 +425,21 @@ parameters:
|
||||
count: 3
|
||||
path: ../../../src/block/tile/Spawnable.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getPotentialLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/CropGrowthHelper.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getPotentialLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/CropGrowthHelper.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getPotentialLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/CropGrowthHelper.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addParticle\\(\\) on pocketmine\\\\world\\\\World\\|null\\.$#"
|
||||
count: 1
|
||||
@ -910,11 +925,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getTileAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
@ -940,11 +950,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getTileAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
@ -975,11 +980,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getTileAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user