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

Item Generator

Discussion in 'Development' started by Yan-Luca, May 30, 2018.

  1. Yan-Luca

    Yan-Luca Creeper

    Messages:
    2
    GitHub:
    chaosfreak93
    Hello, How can I do that if I place a gold block then spawn on the block of gold ingots!

    Sorry for my English!
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Use task
     
  3. Yan-Luca

    Yan-Luca Creeper

    Messages:
    2
    GitHub:
    chaosfreak93
    I need the Code! For this!
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    sorry not everyone here gives code
    but for starter

    you create a repeating task,
    the task should have a function to add and remove gold spots
    and on each tick it will spawn a gold on the spot

    then you register a listener for a gold block placed
    when you hear a gold block is placed
    you tell the task to also spawn a gold on the new position

    to prevent abuse, if you hear a gold block broken, you tell the ask to stop spawning in said position

    you are done, that's all the instructio you needed pity it's not in PHP but in english
     
    HyperxXxHound likes this.
  5. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    You can use another way:
    PHP:
    //use pocketmine\item\Item;
    //use pocketmine\tile\Sign;
    //use pocketmine\math\Vector3;

    $level $this->getServer()->getLevelByName("world");

    $tiles $level->getTiles();
    foreach(
    $tiles as $t){
       if(
    $t instanceof Sign){
          
    $text $t->getText();
          if(
    $text[0] == "GOLD"){
             
    $level->dropItem(new Vector3($t->x$t->2$t->z), Item::get(idmetacount));
          }
       }
    }
    place sign under Gold block and write in line 1 GOLD
     
    HyperxXxHound likes this.
  6. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    It require task but not sure
     
    KYUMA likes this.
  7. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    Yeah, i think he knows how to use task
     
    xXNiceAssassinlo YT likes this.
  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.