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

Replace block

Discussion in 'Development' started by AkmalFairuz, Sep 17, 2018.

  1. AkmalFairuz

    AkmalFairuz Spider Jockey

    Messages:
    25
    GitHub:
    akmalfairuz
    How to replace all Block::GLASS in the world to Block::AIR
     
  2. dbcooper

    dbcooper Spider Jockey

    Messages:
    32
    GitHub:
    dbcooper
    You could use WorldEditv2 which can be found on github. Or you could also use a map converter plugin also found on github I believe nethergames uses it and set the value in it to convert. Easiest in my case is to use MagicWEv2.
     
  3. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    Would probably be more practical to use a map converter plugin. You're selecting the whole world here, not a small selection.

    If you do want to go with the WorldEdit route though, and the selection is large, use WorldStyler by Muqsit instead. It can set large selections far quicker than MagicWEv2.
     
  4. AkmalFairuz

    AkmalFairuz Spider Jockey

    Messages:
    25
    GitHub:
    akmalfairuz
    Can you give me code?
     
  5. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    ... code?
     
  6. AkmalFairuz

    AkmalFairuz Spider Jockey

    Messages:
    25
    GitHub:
    akmalfairuz
    Replace block all glass to air block
     
  7. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I think this should work
    PHP:
    $glassBlocks = [];
    foreach(
    $glassBlocks as $block) {
        
    $block->level->setBlock($blockBlockFactory::get(Block::AIR));
    }
     
  8. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Long story short, you can't do that efficiently. When the new chunk format is implemented you'll be able to swap two runtime IDs to easily achieve that.
     
    jasonwynn10 and Muqsit like this.
  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.