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

How should I change massive amount of blocks?

Discussion in 'Development' started by Mango, Sep 1, 2019.

  1. Mango

    Mango Spider

    Messages:
    9
    By this, I mean like //set in WorldEdit. It's clear that plainly adding setBlock in nested loops is not a good practice. Of course, I already had a look at source codes of BuilderTools, MyPlot, etc, but I still don't get the logic behind it. I'd appreciate it if someone can explain the basic idea of it.
     
    Last edited: Sep 1, 2019
  2. TobiasDev

    TobiasDev Spider

    Messages:
    13
    GitHub:
    tobiasg-de
    What most people do is executing this type of actions asynchronous, so they get the Chunk from the ChunkManager ( I think it was the Chunk ), and work with this, as the Chunk is serializable, worlds are not. Then the blocks are asynchronously changed in the Chunk, and the chunk is being injected into the World in onComplete()
     
  3. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    BuilderTools never used AsyncTask for fillig areas. Filling is slow because of PocketMine sends packet after every change (that's the Level->setBlock() function). BuilderTools sends packet with whole the chunk which is edited by SubChunkIteratorManager.
     
  4. TobiasDev

    TobiasDev Spider

    Messages:
    13
    GitHub:
    tobiasg-de
    Yea I said most people, I use Async for that for example. But your Idea of how to do it is also really good, might have a look into that myself
     
  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.