Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2019-05-02 15:04:23 +01:00
commit 732e27751c
3 changed files with 16 additions and 9 deletions

View File

@ -1692,6 +1692,12 @@ class Server{
Item::initCreativeItems();
Biome::init();
LevelProviderManager::init();
if(extension_loaded("leveldb")){
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
}
GeneratorManager::registerDefaultGenerators();
$this->craftingManager = new CraftingManager();
$this->resourceManager = new ResourcePackManager($this->getDataPath() . "resource_packs" . DIRECTORY_SEPARATOR, $this->logger);
@ -1713,13 +1719,6 @@ class Server{
$this->network->registerInterface(new RakLibInterface($this));
LevelProviderManager::init();
if(extension_loaded("leveldb")){
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
}
GeneratorManager::registerDefaultGenerators();
foreach((array) $this->getProperty("worlds", []) as $name => $options){
if($options === null){
$options = [];

View File

@ -593,6 +593,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
throw new \InvalidStateException("Cannot create entities in unloaded chunks");
}
$this->motion = new Vector3(0, 0, 0);
if($this->namedtag->hasTag("Motion", ListTag::class)){
/** @var float[] $motion */
$motion = $this->namedtag->getListTag("Motion")->getAllValues();

View File

@ -112,6 +112,8 @@ use function trim;
use const INT32_MAX;
use const INT32_MIN;
use const M_PI;
use const PHP_INT_MAX;
use const PHP_INT_MIN;
#include <rules/Level.h>
@ -762,7 +764,7 @@ class Level implements ChunkManager, Metadatable{
*/
public function sendTime(Player ...$targets){
$pk = new SetTimePacket();
$pk->time = $this->time;
$pk->time = $this->time & 0xffffffff; //avoid overflowing the field, since the packet uses an int32
$this->server->broadcastPacket(count($targets) > 0 ? $targets : $this->players, $pk);
}
@ -790,7 +792,12 @@ class Level implements ChunkManager, Metadatable{
protected function actuallyDoTick(int $currentTick) : void{
if(!$this->stopTime){
$this->time++;
//this simulates an overflow, as would happen in any language which doesn't do stupid things to var types
if($this->time === PHP_INT_MAX){
$this->time = PHP_INT_MIN;
}else{
$this->time++;
}
}
$this->sunAnglePercentage = $this->computeSunAnglePercentage(); //Sun angle depends on the current time