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

foreach tiles of level wont work

Comments in 'Plugin Development' started by MyNameIsTriXz, Feb 19, 2016.

  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    PHP:
    }elseif($team == "Blue"){
    var_dump("succes1");




    foreach(
    $this->getServer()->getLevelByName("TW-1")->getTiles() as $tile){
    1. Can you tell me why there is only getTiles not getBlocks?
    2. Title
  2. Omar2s2
    Offline

    Omar2s2 New Member

    Joined:
    Dec 23, 2015
    Posts:
    12
    Minecraft User:
    Pop
    PHP:
    Foreach($this->getServer()->getLevels() as $lev){

    }
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    do you know what is a Tile?
  4. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    yes.. ._.
  5. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    To your getBlocks question
    Think about it
    THAT FUNCTION WOULD NEED TO get every single block and return it! (In loaded chunks)
    Last edited: Feb 20, 2016
  6. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    This would lag your server, and possibly crash.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1. Because it won't load all chunks. It will only return tiles that are loaded, i.e. tiles in loaded chunks.
    There is getTiles because there are only tiles in some places. As for getBlocks, why do you need that? You just need to iterate three coordinates. Also, it is very memory-wasting to have an array that stores an object for every block.
    This is unfair comparison: getTiles doesn't load all chunks either.
    PocketKiller and MyNameIsTriXz like this.
  8. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    What would you use getBlocks for?
    PEMapModder likes this.

Share This Page

Advertisement