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

How do I create a flat world and set blocks in it?

Discussion in 'Development' started by InxGaming, Aug 28, 2017.

  1. InxGaming

    InxGaming Spider

    Messages:
    14
    PHP:
    $this->getServer()->generateLevel($levelNamenull"pocketmine\level\generator\Flat", ["preset" => "3;;1"]);
    So this is how I generate a completely empty world (void). What do I change so I can make it flat? I also want to be able to set blocks in it (something I couldn't do in the void level). ty
     
  2. Rysieku

    Rysieku Spider Jockey

    Messages:
    34
    GitHub:
    rysieku
    PHP:
    $this->getServer()->generateLevel($levelNamenull"pocketmine\level\generator\Flat", ["preset" => "2;7,2x3,2;1"]);
     
    Last edited: Aug 28, 2017
  3. InxGaming

    InxGaming Spider

    Messages:
    14
    It does work but it is just the same as in the void world. I can't set blocks in it with code. $level->setBlock() doesn't happen in neither flat nor void worlds
     
  4. Rysieku

    Rysieku Spider Jockey

    Messages:
    34
    GitHub:
    rysieku
    Ah, yeah forgot about one symbol.
    PHP:
    $this->getServer()->generateLevel($levelNamenull"pocketmine\level\generator\Flat", ["preset" => "2;7,2x3,2;1;"]);
    This should generate normal flat world.
     
  5. InxGaming

    InxGaming Spider

    Messages:
    14
    It still creates a normal world, the problem is $level->setBlock() doesn't set the blocks in flat/void levels. I want to do some kind of skyblock
     
  6. InxGaming

    InxGaming Spider

    Messages:
    14
    Could someone tell me the reason for this problem? nobody says anything about it in two weeks
     
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Send us your code.

    You created this thread just yesterday.
    ¯\(°_o)/¯
     
    Last edited: Sep 11, 2017
    Irish and Rysieku like this.
  8. InxGaming

    InxGaming Spider

    Messages:
    14
    I figured it out. I need my own world generator, don't I?
     
  9. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    you could create an own world gen for better performance if you are creating big infinite patterns.
    But I don't think you want to. setBlock() should work perfectly fine in a void/empty world. (flat world). Send your setBlock code or double check coordinates.
     
  10. InxGaming

    InxGaming Spider

    Messages:
    14
    setBlock() works perfectly fine on different worlds that aren't void/empty. I have tested the coordinates, debugged everything, everything is alright. setBlock() just doesn't set the block in flat/void levels
     
  11. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I'm not sure if this really help you, but try sending UpdateBlockPacket?
     
  12. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Are you trying to make an auto generating skyblock plugin. (does that even make sense lol..) ik a plugin when you do /skyblock it generates a skyblock island
     
  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.