mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
AgeableTrait: fixed incorrect number of bits
the original method breaks if MAX_AGE is 0 or any power of 2.
This commit is contained in:
@@ -35,7 +35,7 @@ trait AgeableTrait{
|
|||||||
protected int $age = 0;
|
protected int $age = 0;
|
||||||
|
|
||||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
||||||
$w->boundedInt((int) ceil(log(self::MAX_AGE, 2)), 0, self::MAX_AGE, $this->age);
|
$w->boundedInt(((int) log(self::MAX_AGE, 2)) + 1, 0, self::MAX_AGE, $this->age);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAge() : int{ return $this->age; }
|
public function getAge() : int{ return $this->age; }
|
||||||
|
Reference in New Issue
Block a user