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

Solved Item Id Bug

Discussion in 'Plugin Help' started by Fritures, May 26, 2019.

  1. Fritures

    Fritures Spider Jockey

    Messages:
    47
    So, Hello i want to make a setDrops for beetroot seeds.
    I had make a setDrops() but it's give creeper baneer ! Instead of beetroot x)
    My code :
    PHP:
    <?php

    namespace Fritures\ItemCore\Ajouts;

    use 
    Fritures\ItemCore\Main;
    use 
    pocketmine\Player;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\block\BlockBreakEvent;

    class 
    WeedSeed implements Listener {

        private 
    $plugin null;

        public function 
    __construct(Main $plugin){
            
    $this->plugin $plugin;
        }
        
        public function 
    getPlugin() : ?Main
        
    {
            return 
    $this->plugin;
        }
        
        public function 
    onBreak(BlockBreakEvent $event){

            
    $block $event->getBlock();
            if(
    $block->getId() == 244){
                if(
    $block->getDamage() >= 7){
                    
                        
    /*$event->setDrops([Item::get(434,0,1)]);*/
                
                
    }

            }
        
        }

    }

    ?>
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    if you used constants instead of magic numbers you might have a better idea why the code isn't working (or maybe it wouldn't be broken to begin with).
     
  3. Fritures

    Fritures Spider Jockey

    Messages:
    47
    I don't had any ideas please help ! x)
     
  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.