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

I can't set sign text

Discussion in 'Development' started by tsan, May 1, 2017.

  1. tsan

    tsan Spider

    Messages:
    9
    PHP:
    public function onPlaceEvent(BlockPlaceEvent $event){
        
    $block $event->getBlock();

        if(
    $block->getId() != 63 and $block->getId() != 323) return;
        
    $tile $block->getLevel()->getTile($block);
        if(!(
    $tile instanceof Sign))
        {
            
    $this->getLogger()->info('tile is not instance of Sign');
            return;
        }
              
        
    $tile->setText('123');
    }
    Here's my code, when I place a sign, the console says 'tile is not instance of Sign', I just don't understand why is it not working, someone help please?
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Make very sure that you add the use statement: pocketmine\tile\Sign
    And not: pocketmine\item\Sign
     
  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.