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

function spawnToAll on null?

Comments in 'Plugin Development' started by JonsMC, Sep 12, 2016.

  1. JonsMC
    Offline

    JonsMC Active Member

    Joined:
    Jul 26, 2016
    Posts:
    107
    Minecraft User:
    JonsMC
    im recently making a spawners plugin, but im having a problem on setting spawner's entity id,

    PHP:
    $pos = new Vector3($x$y$z);
       
    $tile $level->getTile($pos);
            if(
    $tile instanceof MobSpawner) {
               
    $type $this->getPlug()->type[$player->getName()];
               
               if(
    $type == "zombies") {
                 
    $tile->setEntityId(54);
                 }
    And call it on Block place event, but console keep returning: call to a member function spawnToAll() on null, i tried to fix it but nothing change. Please help as soon as possible
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Spawner code issue. Are you using PocketMine?
    ImagicalGamer likes this.
  3. JonsMC
    Offline

    JonsMC Active Member

    Joined:
    Jul 26, 2016
    Posts:
    107
    Minecraft User:
    JonsMC
    Not really :p
  4. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    Is this your code? If so we need all the code your using so we can help you fix your issue, we don't know how your using spawnToAll().

    EDIT: If your trying to use spawnToAll() to add a tile your not adding it correctly. Create a tile and use Level::addTile() to add your tile.
  5. JonsMC
    Offline

    JonsMC Active Member

    Joined:
    Jul 26, 2016
    Posts:
    107
    Minecraft User:
    JonsMC
    Nope, i add that in my task, repeating task every 20 ticks, it will detect the tile that player spawn in BlockPlaceEvent, then store that block's coordinates in public variables, then setEntityId to that tile :/

Share This Page

Advertisement