Restrict XpSeed to the bounds of an int32, close #1040

This commit is contained in:
Dylan K. Taylor 2017-06-09 16:05:28 +01:00
parent 7870a8672e
commit cd66f58526

View File

@ -357,7 +357,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
}
if(!isset($this->namedtag->XpSeed) or !($this->namedtag->XpSeed instanceof IntTag)){
$this->namedtag->XpSeed = new IntTag("XpSeed", $this->xpSeed ?? ($this->xpSeed = mt_rand(PHP_INT_MIN, PHP_INT_MAX)));
$this->namedtag->XpSeed = new IntTag("XpSeed", $this->xpSeed ?? ($this->xpSeed = mt_rand(-0x80000000, 0x7fffffff)));
}else{
$this->xpSeed = $this->namedtag["XpSeed"];
}