Setting tiles

Discussion in 'Development' started by YarkaDev, Feb 8, 2019.

  1. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    Hello comrades! Please tell me how each chunk when it is loaded to put a chest (I mean, block and tile). Doing ChunkPopulateEvent, but swears like a chunk
    still empty
     
  2. jasonwynn10

    jasonwynn10 Wither Skeleton Poggit Reviewer Verified

    Messages:
    1,283
    GitHub:
    jasonwynn10
    OnChunkPopulate run a delayed task to create the tile and set the chest block in the position you want.
     
    Muqsit likes this.
  3. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    I run the task after 5 seconds, but the error remains. Below is the attached code and error
     

    Attached Files:

  4. Muqsit

    Muqsit Wither Skeleton Verified

    Messages:
    1,458
    GitHub:
    muqsit
    Replace $lvl with $event->getLevel(). Also, you should validate whether
    PHP:
    $event->getLevel()->getFolderName() === "world"
    before proceeding.
     
    jasonwynn10 likes this.
  5. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    I did as you said, but the mistake remains.
     

    Attached Files:

  6. Gianluxx

    Gianluxx Silverfish

    Messages:
    15
    GitHub:
    Gianluxx
    Send the PopulateTask file, the error is there
     
  7. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    Code:
    class PopulateTask extends Task {
      
        private $data;
      
        public function __construct($type, Level $lvl, CompoundTag $ct) {
            $this->data = [
                $type,
                $lvl,
                $ct
            ];
        }
    
        public function onRun($currentTick) {
            list($type, $lvl, $nbt) = $this->data;
            unset($this->data);
          
            Tile::createTile($type, $lvl, $nbt);
            echo "Chest spawned\n";
        }
    }
     
  8. Gianluxx

    Gianluxx Silverfish

    Messages:
    15
    GitHub:
    Gianluxx
    class PopulateTask extends Task {

    private $data;

    public function __construct($type, Level $lvl, $nbt) {
    $this->type = $type;
    $this->lvl = $lvl;
    $this->nbt = $nbt;
    }

    public function onRun($currentTick) {
    Tile::createTile($this->type, $this->lvl, $this->nbt);
    echo "Chest spawned\n";
    }
    }
     
  9. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    there are no fixes in your code that would help me, because you did what I did, just a little easier. Yes and the problem I have not in this
     
  10. KielKing

    KielKing Baby Zombie

    Messages:
    112
    GitHub:
    kielking
    can you do var_dump($this->lvl); before Tile::createTile()

    also I noticed your server's folder name is called Genisys, are you using Genisys?
     
  11. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    Yes, i`m using genisys now
     
  12. KielKing

    KielKing Baby Zombie

    Messages:
    112
    GitHub:
    kielking
    we don't support spoons here, sorry
     
    jasonwynn10 likes this.
  13. YarkaDev

    YarkaDev Spider

    Messages:
    9
    GitHub:
    yarkadev
    well, advise normal core on 1.1
     

Share This Page

  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.