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

Outdated Infinite World 1.3

Simple Infinite World

  1. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    Update.

    Attached Files:

  2. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    In front
  3. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    What!?
    111.png
    jojoe77777, Tuff and PEMapModder like this.
  4. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    it works but the second map is not working. the chunk is not loading. i suggest that this plugin should need SimpleWorlds in generating new world. just a though ;)
  5. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    My plugin not need a SimpleWorlds. It generate the map by PM-MP api.
    You change the level-name to "2"?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    SimpleWorlds is just a plugin that redirects commands to functions, like how /tell converts the commend into the chat API function.
    EkiFoX likes this.
  7. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    the second map it generated is corrupted.
  8. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    If it's corrupted then that's not the plugin (unless he hard-coded the world generation for no reason). If the server crashed or wasn't stopped via the "stop" command, that's why your map is corrupt.
    EkiFoX and PEMapModder like this.
  9. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    the chunk in the second map just disappears
  10. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    It's probably lag.
    PEMapModder likes this.
  11. JayKay
    Offline

    JayKay New Member

    Joined:
    Jun 1, 2014
    Posts:
    3
    I'm not sure if it's a bug or some other issue (server or api versions ect.) but in my setup (pocketmine 1.3.12/windows server and android client) $data->x and data->y positions return a float and since you test with integers it's impossible to go to next map:

    $data->x == $this->coord["x"]) // which in my case is about 254.9953970595 == 255

    simple fix is (intval($data->x) == $this->coord["x"])

    but after that I get "Trying to get property of non-object" from the line "$lv = $this->server->api->level->get($newworld);" whenever I try to cross the border which is strange...
    PEMapModder likes this.
  12. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    s
    see update
  13. must_
    Offline

    must_ Active Member

    Joined:
    Aug 23, 2013
    Posts:
    139
    Minecraft User:
    must
    i dont understand what to do? please explane
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It says experimental and experimental means experimental.
    iJoshuaHD likes this.
  15. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    Yet people still want this even though its going to be in 0.9.0...
    EkiFoX, Smarticles101 and PEMapModder like this.
  16. EkiFoX
    Offline

    EkiFoX Active Member Plugin Developer

    Joined:
    Feb 28, 2014
    Posts:
    94
    Plugins:
    2
    Minecraft User:
    ekifox
    How I edited the lobby for future mini-games server.
    Tested TheWalls and TNTRun :)
  17. Smarticles101
    Offline

    Smarticles101 Active Member

    Joined:
    Sep 2, 2013
    Posts:
    122
    Minecraft User:
    Smarticles101
    Hmm seems pretty good. It ran just fine, I'll keep learning php then I'll take a look at the code...
  18. Arune
    Offline

    Arune New Member

    Joined:
    Jun 24, 2014
    Posts:
    4
    Minecraft User:
    AruneKH
    It apparently will not allow me to upload the file.

    However, I have fixed it. Here is the file - simply copy the code below and place it into an Infworld.php

    Code:
    <?php
    /*
    __PocketMine Plugin__
    name=InfWorld
    description=Simple infinity world by loading a new world.
    version=1.2
    author=EkiFoX
    class=InfWorld
    apiversion=12,13
    */
    class InfWorld implements Plugin {
        private $api;
      
        public $minworld = 1;
        public $maxworld = 12;
      
        public function __construct(ServerAPI $api, $server = false) {
            $this->api = $api;
        }
    
        public function init() {
            $this->api->addHandler("player.move", array($this, "move"));
            $this->api->console->register("infinity", "Information of infinity world plugin", array($this, "command"));
            $this->api->ban->cmdWhitelist("infinity");
            console("[InfWorld] Loaded, version 1.2");
        }
    
        public function __destruct() {}
      
        public function command($cmd, $params, $issuer) {
            switch ($cmd) {
                case "infinity":
                    $issuer->sendChat("Plugin made by EkiFoX");
                    $issuer->sendChat("*For PocketMine Forum*");
                    break;
            }
        }
            public function generateLevel($name, $seed, $generator = false){
            if($this->api->level->levelExists($name)){
                return false;
            }
          
            if($generator === false){
                $generator = $this->config->get("default-generator");
            }
          
            return $this->api->level->generateLevel($name, $seed, $generator);
        }
        public function getSafeZone($xs, $ys, $zs, $lvl){
        //Code from PocketMine-MP/src/world/Level.php
                $x = (int)round($xs);
                $y = (int)round($ys);
                $z = (int)round($zs);
                $lvl = (string)$lvl;
              
            $world = $this->api->level->get($lvl);
            if ($world != false){
                for(; $y > 0; --$y){
                    $v = new Vector3($x, $y, $z);
                    $b = $world->getBlock($v);
                    if($b === false){
                        return new Position($xs, $ys, $zs, $world);
                    }elseif(!($b instanceof AirBlock)){
                        break;
                    }
                }
                for(; $y < 128; ++$y){
                    $v = new Vector3($x, $y, $z);
                    if($world->getBlock($v) instanceof AirBlock){
                        return new Position($x, $y, $z, $world);
                    }else{
                        ++$y;
                    }
                }
                return new Position($x, $y, $z, $world);
            }else{
                console("err1");
                return false;
            }
        }
    
        public function move($data){
            $plobj = $this->api->player->get($data->name);
            $x = round($data->x);
            $z = round($data->z);
            if($x == 255){
                $world = $plobj->level->getName();
                $newworld = ((int)$world + 1);
                if(($newworld > $this->minworld) AND ($newworld < $this->maxworld)){
                    if($this->api->level->loadLevel($newworld)){                  
                        $safe = $this->getSafeZone(2,128,$z,$newworld);
                        if($safe != false){
                        $plobj->teleport($safe);
                      
                        $plobj->sendChat("[InfWorld] You in new world: ".$newworld);
                        }else $plobj->sendChat("[InfWorld] Failed.");
                      
                    }else{
                        $plobj->sendChat("[InfWorld] Generating new world.");
                        $this->api->level->generateLevel($newworld);
                    }
                }else{
                    $plobj->sendChat("[InfWorld] You in max coord.");
                }
            }
            if($x == 0){
                $world = $plobj->level->getName();
                $newworld = ((int)$world - 1);
                if(($newworld > $this->minworld) AND ($newworld < $this->maxworld)){
                    if($this->api->level->loadLevel($newworld)){                  
                        $safe = $this->getSafeZone(254,128,$z,$newworld);
                        if($safe != false){
                        $plobj->teleport($safe);
                      
                        $plobj->sendChat("[InfWorld] You in old world: ".$newworld);
                        }else $plobj->sendChat("[InfWorld] Failed.");
                      
                    }else{
                        $plobj->sendChat("[InfWorld] Generating new world.");
                        $this->api->level->generateLevel($newworld);
                    }
                }else{
                    $plobj->sendChat("[InfWorld] You in max coord.");
                }
            }
            if($z == 0){
                $world = $plobj->level->getName();
                $newworld = ((int)$world - 1);
                if(($newworld > $this->minworld) AND ($newworld < $this->maxworld)){
                    if($this->api->level->loadLevel($newworld)){                  
                        $safe = $this->getSafeZone($x,128,254,$newworld);
                        if($safe != false){
                        $plobj->teleport($safe);
                      
                        $plobj->sendChat("[InfWorld] You in old world: ".$newworld);
                        }else $plobj->sendChat("[InfWorld] Failed.");
                      
                    }else{
                        $plobj->sendChat("[InfWorld] Generating new world.");
                        $this->api->level->generateLevel($newworld);
                    }
                }else{
                    $plobj->sendChat("[InfWorld] You in max coord.");
                }
            }
            if($z == 255){
                $world = $plobj->level->getName();
                $newworld = ((int)$world + 1);
                if(($newworld > $this->minworld) AND ($newworld < $this->maxworld)){
                    if($this->api->level->loadLevel($newworld)){                  
                        $safe = $this->getSafeZone($x,128,2,$newworld);
                        if($safe != false){
                        $plobj->teleport($safe);
                      
                        $plobj->sendChat("[InfWorld] You in new world: ".$newworld);
                        }else $plobj->sendChat("[InfWorld] Failed.");
                      
                    }else{
                        $plobj->sendChat("[InfWorld] Generating new world.");
                        $this->api->level->generateLevel($newworld);
                    }
                }else{
                    $plobj->sendChat("[InfWorld] You in max coord.");
                }
            }
            return true;
        }
    }
    
    Ensure if you already have the plugin, simply select all contents of the php plugin and remove it. Replace the contents with the code posted above.

    Thanks,
    Kevin
  19. Arune
    Offline

    Arune New Member

    Joined:
    Jun 24, 2014
    Posts:
    4
    Minecraft User:
    AruneKH
    Quick FYI:

    This works incredibly well now with the fix implemented. Seems very stable transitioning between worlds, walking, flying, etc. /tp between worlds as well. However, ensure you change your default world in server properties per the original instructions.
  20. Jag
    Offline

    Jag Active Member

    Joined:
    Mar 26, 2014
    Posts:
    53
    Minecraft User:
    Jag
    I am testing this but after a while I seem to get stuck in a loop where I can only move between worlds 3 and 4. Meaning, if I am in world 3, no matter what direction I exit the world from it take me back to world 4. And vice versa.
    LDX likes this.

Share This Page

Advertisement