Hey guys, I want to send ChangeDimensionPacket , but i want to do it fast and i want to change dimension to normal (0) again, can you help me to do it? If not, are there any ways to send loading screen to player for 2 - 3 sec. ?
PHP: $time = 3;$time--;$pk = new StartGamePacket();$pk->seed = -1;$pk->dimension = $player->getLevel()->getDimension();$pk->x = $player->x;$pk->y = $player->y;$pk->z = $player->z;$pk->generator = 1; //0 old, 1 infinite, 2 flat$pk->gamemode = $player->gamemode & 0x01;$pk->eid = 0;$player->dataPacket($pk);if($time == 0){unset($pk);unset($time);} Maybe this would work, never tried
It can be done, and has been attempted several times by various developers. The problem is that frequently one of the packets ends up lost and then the sky colour of the destination ends up incorrect.
Will this send the player to a new, freshly generator world? And would it keep them in the same gamemode?
I have done this and it works but I did notice that using the dimension of the players level can crash the player, I would suggest generating a new level and teleporting them there so you can send a fresh packet then teleporting them back.
Sure, I'm not going to give exact code (don't feel like digging through my core) but what I did is generated an empty world (no blocks or anything) then sent the player a ChangeDimensionPacket with the dimension set as Nether. After I sent that packet I teleported them to the empty world and then transferred them to another server (if thats what you want to do) then when a player joins I teleport them back to the default world and send them a Normal ChangeDimensionPacket.