mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-25 21:04:06 +00:00
Player: avoid using NBT for onGround hack
This commit is contained in:
parent
1205432c34
commit
0a1bb0041b
@ -283,9 +283,11 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
|
|
||||||
if($namedtag !== null and ($world = $this->server->getWorldManager()->getWorldByName($namedtag->getString("Level", ""))) !== null){
|
if($namedtag !== null and ($world = $this->server->getWorldManager()->getWorldByName($namedtag->getString("Level", ""))) !== null){
|
||||||
$spawn = EntityFactory::parseLocation($namedtag, $world);
|
$spawn = EntityFactory::parseLocation($namedtag, $world);
|
||||||
|
$onGround = $namedtag->getByte("OnGround", 1) === 1;
|
||||||
}else{
|
}else{
|
||||||
$world = $this->server->getWorldManager()->getDefaultWorld();
|
$world = $this->server->getWorldManager()->getDefaultWorld();
|
||||||
$spawn = Location::fromObject($world->getSafeSpawn(), $world);
|
$spawn = Location::fromObject($world->getSafeSpawn(), $world);
|
||||||
|
$onGround = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load the spawn chunk so we can see the terrain
|
//load the spawn chunk so we can see the terrain
|
||||||
@ -293,14 +295,8 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
$world->registerChunkListener($this, $spawn->getFloorX() >> 4, $spawn->getFloorZ() >> 4);
|
$world->registerChunkListener($this, $spawn->getFloorX() >> 4, $spawn->getFloorZ() >> 4);
|
||||||
$this->usedChunks[World::chunkHash($spawn->getFloorX() >> 4, $spawn->getFloorZ() >> 4)] = UsedChunkStatus::NEEDED();
|
$this->usedChunks[World::chunkHash($spawn->getFloorX() >> 4, $spawn->getFloorZ() >> 4)] = UsedChunkStatus::NEEDED();
|
||||||
|
|
||||||
if($namedtag === null){
|
parent::__construct($spawn, $this->playerInfo->getSkin(), $namedtag ?? new CompoundTag());
|
||||||
$namedtag = new CompoundTag();
|
$this->onGround = $onGround; //TODO: this hack is needed for new players in-air ticks - they don't get detected as on-ground until they move
|
||||||
|
|
||||||
$namedtag->setByte("OnGround", 1); //TODO: this hack is needed for new players in-air ticks - they don't get detected as on-ground until they move
|
|
||||||
//TODO: old code had a TODO for SpawnForced
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($spawn, $this->playerInfo->getSkin(), $namedtag);
|
|
||||||
|
|
||||||
$ev = new PlayerLoginEvent($this, "Plugin reason");
|
$ev = new PlayerLoginEvent($this, "Plugin reason");
|
||||||
$ev->call();
|
$ev->call();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user