1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Copy chunks

Discussion in 'Development' started by Daniktheboss, Feb 10, 2018.

  1. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Hey, i'm trying to copy chunk X,Y to another X,Y

    Is it possible to do so?
     
  2. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    Yes.
    PHP:
    <?php
    $chunk 
    $level->getChunk($x1 >> 4$z1 >> 4); //$level is a Level object, $x1 & $x1 are integers :)
    $level->setChunk($x2$z2$chunk); //$x2 & $z2 are integers :)
     
  3. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Hmm i couldn't find those functions. Thanks
     
  4. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    That will cause unexpected behaviour when you modify either chunk, because they share an object. It may also cause unexpected behaviour for entities residing in that chunk. You need to properly copy it (fastSerialize()/fastDeserialize() is probably currently the simplest way to do it, but this won't copy tiles or entities).
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.