Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

teleport / chunk issue

Comments in 'Plugin Development' started by udwarf, Aug 27, 2016.

  1. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Hello, guys!
    I'm fighting with this problem for weeks, and feel absolutly stuck whith it and really need your advice how to solve that issue.
    I am running a mini-games server. Player taps on the wall-sign and then he teleported to the game arena (on the same level).
    After catching player's PlayerInteractEvent I do simply $player->teleport($pos);
    Here goes the first problem:
    Everyone sees the player on the previous position, (like he was not teleported!) until he makes a move.
    How to make him appear immediately on the place he was teleported to?

    When he finally makes any move he don't simply dissapear in one place and appear in the new positions.
    It looks like he moves very fast from the teleportation source position to the teleportation target point.
    And here goes the trouble that really makes me crazy: looks like that when he moves through the chunk that not loaded on his client, the player stuks in the void, glitching and twitching without possibility to make any move until he relogs!

    I was thinking that the problem with the chunk of the teleportation target and try to force it to be loaded by player:
    PHP:
    //try to avoid tp glitch
    $lvl->loadChunk($pos->getX()>>4$pos->getZ()>>4); 
    $lvl->requestChunk($pos->getX()>>4$pos->getZ()>>4$player);
    Didn't help.
    Do I really have to trace every chunks through which player will be teleported?! and force them to be loaded by player?! Sounds very odd, its teleportation afrer all, not a moving!

    I replaced teleport with teleportImmediate - nothing changed!

    Please help, how to safely teleport a player!?
    How to avoid stucking in unload chunks?

    In advance thank you very much, I believe in your wisdom and experience!
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Do you use pocketmine/genisys? and maybe your world is broken :D
  3. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Initially I do thought that m.b. my world is broken, but how can I check it?
    I've converted the world from mcregion to anvil format.
    I've iterated over all world blocks and fixed all lost tiles (tiles without corresponding tiles-blocks and tiles-blocks without corresponding tiles)
    How else could be tested the world?

    Now I can reproduce that glitch for 100%, and I starting to think that its a game client unloading chunk, not server
    1. reconnect to the server
    2. in my world player spawns in the chunk x=7 z = 9 (115 65 159)
    3. tp to the chunk x=-2 z=-8 (/tp -32 65 -128)
    4. tp back to the spawn (/tp 115 65 159)
    5. tp AGAIN to the chunk x=-2 z=-8 (/tp -32 65 -128) - BOOM! stuks in the void, glitching and twitching!
    Other players could be on the same world position in the same time without any glitching

    During all this teleportation I do not see that server unloads chunk -2/-8, ChunkUnloadEvent was not fired
    Can it be that a client unloads it? how to deal with it?
    Can it be something connected with config settings ?
    Code:
    chunk-sending.per-tick = 4
    chunk-sending.max-chunks = 32
    chunk-sending.spawn-threshold  = 56
    chunk-sending.cache-chunks = true
    
    I played with them but nothing changed
    My game client is 0.15.6, but the same bug was and with older versions

    I dont really know how to resolve this issue. Make the world smaller?! Is there really limitations of teleportation distance?
    Please help anyone! Thank you in advance.

    PS: And yes, I'm using the latest Genisys. Hope, it not a genisys-only issue
    Last edited: Sep 5, 2016
  4. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    If im not wrong, chunk-sending.max-chunks need to be more than chunk-sending.spawn-threshold, can you try that out?
  5. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    I've put back default
    Code:
    max-chunks: 192
    spawn-threshold: 56
    
    I've even removed all plugins!

    But nothing changes, still stuck and glitch 100%
  6. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    may be that after teleport you can move
    PHP:
    setMotion(new Vector3(00.10));

    maybe it works or not, I do not know. but it could solve the problem of player block to the sign?

Share This Page

Advertisement