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

Blocks takes too long to update / does not at all

Discussion in 'Development' started by CortexPE, Dec 22, 2017.

  1. CortexPE

    CortexPE Witch

    Messages:
    61
    GitHub:
    cortexpe
    I made a custom FrostedIce class (extending Ice) then registered it. Then added this onUpdate function hopefully that it'll execute this code on every few ticks...
    PHP:
    public function onUpdate(int $type){
            if((
    PMServer::getInstance()->getTick() % (mt_rand(1,2) * 10)) == 0){ // every 1-2 seconds
                
    $this->meta++;
                if(
    $this->meta 3){
                    foreach(
    $this->getAllSides() as $side){
                        
    $side->onUpdate($type);
                    }
                    
    $this->getLevel()->setBlock($this->asVector3(), Block::get(Block::WATER), falsetrue);
                }
            }
        }
    But after waiting for 5 minutes, nothing seems to happen. The block doesn't seem to even update at all.[​IMG]

    Is it supposed to do this or am I doing it wrong?
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    add like echo("tick") debugs
     
  3. Kenn Fatt

    Kenn Fatt Slime

    Messages:
    82
    GitHub:
    kennfatt
    Try to use:
    PHP:
    $level->setBlockIdAt($x$y$z$blockId);
     
  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.