This happened in versions bellow 1.0.0 for sure. I know how to do that with the change dimension packet but the player becomes something like immoble for a weird reason. PHP: public function onLevelChange(EntityLevelChangeEvent $event) { if(($player = $event->getEntity()) instanceof Player && !$event->isCancelled()){ $packet = new ChangeDimensionPacket(); $packet->dimension = 1; $packet->position = $player->asVector3(); $packet->respawn = true; $player->dataPacket($packet); $this->getScheduler()->scheduleDelayedTask(new UnshowTask1($this, $player), 20); //show loading screen for 1 second } }class UnshowTask1 extends Task { public function __construct(Main $plugin, Player $player) { $this->plugin = $plugin; $this->player = $player; } public function onRun(int $currentTick) : void { $player = $this->player; $pk = new PlayStatusPacket(); $pk->status = 3; $player->dataPacket($pk); $packet = new ChangeDimensionPacket(); //I tried doing that with a delay but the same thing happened $packet->dimension = 0; $packet->position = $player->asVector3(); $packet->respawn = true; $player->dataPacket($packet); $this->plugin->getScheduler()->scheduleDelayedTask(new UnshowTask2($player), 10); //show loading screen again for 0.5 seconds }}class UnshowTask2 extends Task { public function __construct(Player $player) { $this->player = $player; } public function onRun(int $currentTick) : void { $pk = new PlayStatusPacket(); $pk->status = 3; $this->player->dataPacket($pk); }} I searched across the forums for a reply to that but I did not find anything that is working. Maybe the $packet->respawn should be false but I am not sure. There are no errors in the console. Here is a link to the dimension ids: https://github.com/pmmp/PocketMine-.../mcpe/protocol/types/DimensionIds.php#L28-L30
Wow. It should be a very difficult question to reply. I tried a bit more and I figured out that setting the dimension to 1 or 2 with respawn off works, without sending the packet twice and it worked, but how to change the sky/atmosphere? The featured servers do hatand end the packet once, or at least, that's what it looks like. Will 3 as a dimension case any errors? EDIT: The send the packet twice, with dimension 1, but how does the player not crash?
Okay, I send the packet twice, one in overload and then in nether. In nether it unshows in 10 ticks. Now when I go to a word it is nether but when I come back it is overload.
I give up. The dimension shows as nether every 2 times I teleport. No errors nor freezes. What I can say for sure now is that I need help.
As I can see it is a pretty hard thing to do. Would you recommend me any way for fixing the crashes when teleporting to another world? Crashes for windows 10 users, hotbar crash for pocket edition ones.
Do you spawn fake player entities (eg: for NPCs or floating texts)? They could cause that if you didn't send a PlayerListPacket.
Yes. All my server works with fake player entities because there are easier to use. Also, every 5 seconds which I despawn and spawn some new npcs, if I go to the list I can see them there for like one tick or less.
I removed the PlayerListPacket workaround for a while and had experienced crashes while changing dimensions. I reverted back to the PlayerListPacket workaround and it worked fine after then. You can find the workaround in pmmp's FloatingTextParticle class.
By the way, $respawn is used when the client dies in a dimension other than the main dimension. Eg: dying in nether and getting teleported to overworld on respawn. For a vanilla impl, you would do something like this: PHP: $pk->respawn = !$player->isAlive();
It does not happen every time. I would send you the IP of my server in a dm because here it would be considered as advertising. Is that what you are talking about? https://github.com/pmmp/PocketMine-...vel/particle/FloatingTextParticle.php#L96-L99
Okay, just came back from school. Correct me if wrong. I have an entity that extends human. I go to that file and I add something like that: public function spawnToAll() : void{ //player list packet, I add the npc parent::spawnToAll(); //remove it from the player list shown in the client } But why should I do that when pocketmine does itself? https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/entity/Human.php#L840 Are you sure that's what is causing it? That's the reason i need the loading screen. Since huge servers like hivemc did not solve that, it means it cannot be fixed that easy or it is impossible to fix without that trick. What they actually do it to prevent it from happening.
People will choose to help you in their own time. If you’re that rude about it, then you should go looking for help in your trash can.