mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
support php8019 and some cleanup (by @D-aHTuCT)
This commit is contained in:
parent
cf0f9df267
commit
b60f0877e1
376 changed files with 6528 additions and 13472 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
class LightUtils {
|
||||
class LightUtils{
|
||||
|
||||
/*
|
||||
args: $source: <Block> instanceof LightingBlock, $block: Block
|
||||
*/
|
||||
|
|
@ -8,16 +9,13 @@ class LightUtils {
|
|||
if($source === null || $block === null){
|
||||
return 0;
|
||||
}
|
||||
$distance = sqrt(LightUtils::sqr($source->x - $block->x)+LightUtils::sqr($source->y - $block->y)+LightUtils::sqr($source->z - $block->z)); /*Distance between 2 3d objects*/
|
||||
$distance = sqrt(LightUtils::sqr($source->x - $block->x) + LightUtils::sqr($source->y - $block->y) + LightUtils::sqr($source->z - $block->z)); /*Distance between 2 3d objects*/
|
||||
$result = floor($source->getMaxLightValue() - $distance); //i dont need something like 0.2192032434454...
|
||||
return $result <= 0 ? 0 : $result; //if result is smaller or equals 0 then return 0 else return result
|
||||
}
|
||||
|
||||
|
||||
/* Used only internally for calculating 2^(2) */
|
||||
private static function sqr($val){
|
||||
return pow($val,2);
|
||||
return pow($val, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue