mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-20 12:44:01 +00:00
Fixed other invisibility issues
This commit is contained in:
parent
05dbf7b47f
commit
71490f60f2
@ -1670,7 +1670,6 @@ class Server{
|
||||
]));
|
||||
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()]));
|
||||
|
||||
PluginManager::$pluginParentTimer = new TimingsHandler("** Plugins");
|
||||
Timings::init();
|
||||
|
||||
$this->consoleSender = new ConsoleCommandSender();
|
||||
|
@ -512,8 +512,8 @@ abstract class Entity extends Location implements Metadatable{
|
||||
* @param Player $player
|
||||
*/
|
||||
public function spawnTo(Player $player){
|
||||
if(!isset($this->hasSpawned[$player->getId()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){
|
||||
$this->hasSpawned[$player->getId()] = $player;
|
||||
if(!isset($this->hasSpawned[$player->getLoaderId()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){
|
||||
$this->hasSpawned[$player->getLoaderId()] = $player;
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,11 +557,11 @@ abstract class Entity extends Location implements Metadatable{
|
||||
* @param Player $player
|
||||
*/
|
||||
public function despawnFrom(Player $player){
|
||||
if(isset($this->hasSpawned[$player->getId()])){
|
||||
if(isset($this->hasSpawned[$player->getLoaderId()])){
|
||||
$pk = new RemoveEntityPacket();
|
||||
$pk->eid = $this->id;
|
||||
$player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
|
||||
unset($this->hasSpawned[$player->getId()]);
|
||||
unset($this->hasSpawned[$player->getLoaderId()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
public function spawnTo(Player $player){
|
||||
if($player !== $this and !isset($this->hasSpawned[$player->getId()])){
|
||||
$this->hasSpawned[$player->getId()] = $player;
|
||||
if($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])){
|
||||
$this->hasSpawned[$player->getLoaderId()] = $player;
|
||||
|
||||
if(strlen($this->skin) < 64 * 32 * 4){
|
||||
throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
|
||||
@ -221,12 +221,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
public function despawnFrom(Player $player){
|
||||
if(isset($this->hasSpawned[$player->getId()])){
|
||||
if(isset($this->hasSpawned[$player->getLoaderId()])){
|
||||
$pk = new RemovePlayerPacket();
|
||||
$pk->eid = $this->getId();
|
||||
$pk->clientID = $this->getId();
|
||||
$player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
|
||||
unset($this->hasSpawned[$player->getId()]);
|
||||
unset($this->hasSpawned[$player->getLoaderId()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,9 @@ abstract class Timings{
|
||||
self::$timerEntityAIMove = new TimingsHandler("** livingEntityAIMove");
|
||||
self::$timerEntityTickRest = new TimingsHandler("** livingEntityTickRest");
|
||||
|
||||
|
||||
PluginManager::$pluginParentTimer = new TimingsHandler("** Plugins");
|
||||
|
||||
self::$schedulerSyncTimer = new TimingsHandler("** Scheduler - Sync Tasks", PluginManager::$pluginParentTimer);
|
||||
self::$schedulerAsyncTimer = new TimingsHandler("** Scheduler - Async Tasks");
|
||||
|
||||
|
@ -49,7 +49,7 @@ class TimingsHandler{
|
||||
*/
|
||||
public function __construct($name, TimingsHandler $parent = null){
|
||||
$this->name = $name;
|
||||
if($parent instanceof TimingsHandler){
|
||||
if($parent !== null){
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ class TimingsHandler{
|
||||
public function startTiming(){
|
||||
if(PluginManager::$useTimings and ++$this->timingDepth === 1){
|
||||
$this->start = microtime(true);
|
||||
if($this->parent instanceof TimingsHandler and ++$this->parent->timingDepth === 1){
|
||||
if($this->parent !== null and ++$this->parent->timingDepth === 1){
|
||||
$this->parent->start = $this->start;
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ class TimingsHandler{
|
||||
++$this->curCount;
|
||||
++$this->count;
|
||||
$this->start = 0;
|
||||
if($this->parent instanceof TimingsHandler){
|
||||
if($this->parent !== null){
|
||||
$this->parent->stopTiming();
|
||||
}
|
||||
}
|
||||
|
@ -2191,7 +2191,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
$this->timings->syncChunkSendPrepareTimer->startTiming();
|
||||
$task = $this->provider->requestChunkTask($x, $z);
|
||||
if($task instanceof AsyncTask){
|
||||
if($task !== null){
|
||||
$this->server->getScheduler()->scheduleAsyncTask($task);
|
||||
}
|
||||
$this->timings->syncChunkSendPrepareTimer->stopTiming();
|
||||
@ -2582,9 +2582,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
return false;
|
||||
}
|
||||
|
||||
Timings::$populationTimer->startTiming();
|
||||
$chunk = $this->getChunk($x, $z, true);
|
||||
if(!$chunk->isPopulated()){
|
||||
Timings::$populationTimer->startTiming();
|
||||
$populate = true;
|
||||
for($xx = -1; $xx <= 1; ++$xx){
|
||||
for($zz = -1; $zz <= 1; ++$zz){
|
||||
@ -2606,14 +2606,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
$task = new PopulationTask($this, $chunk);
|
||||
$this->server->getScheduler()->scheduleAsyncTask($task);
|
||||
}
|
||||
Timings::$populationTimer->stopTiming();
|
||||
return false;
|
||||
}
|
||||
|
||||
Timings::$populationTimer->stopTiming();
|
||||
return false;
|
||||
}
|
||||
Timings::$populationTimer->stopTiming();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -120,14 +120,21 @@ class McRegion extends BaseLevelProvider{
|
||||
}
|
||||
|
||||
$tiles = "";
|
||||
$nbt = new NBT(NBT::LITTLE_ENDIAN);
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
if($tile instanceof Spawnable){
|
||||
$nbt->setData($tile->getSpawnCompound());
|
||||
$tiles .= $nbt->write();
|
||||
|
||||
if(count($chunk->getTiles()) > 0){
|
||||
$nbt = new NBT(NBT::LITTLE_ENDIAN);
|
||||
$list = [];
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
if($tile instanceof Spawnable){
|
||||
$list[] = $tile->getSpawnCompound();
|
||||
}
|
||||
}
|
||||
$nbt->setData($list);
|
||||
$tiles = $nbt->write();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$heightmap = pack("C*", ...$chunk->getHeightMapArray());
|
||||
$biomeColors = pack("N*", ...$chunk->getBiomeColorArray());
|
||||
|
||||
|
@ -47,6 +47,9 @@ abstract class Spawnable extends Tile{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Compound
|
||||
*/
|
||||
public abstract function getSpawnCompound();
|
||||
|
||||
public function __construct(FullChunk $chunk, Compound $nbt){
|
||||
|
Loading…
x
Reference in New Issue
Block a user