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

Problems creating new item

Discussion in 'Development' started by BaleineSanguine, Apr 21, 2020.

  1. BaleineSanguine

    BaleineSanguine Spider

    Messages:
    10
    GitHub:
    baleinesanguine
    Hi! I'm currently developping a plugin adding new block, and having no knowledge on this I started looking on the github. I saw I first needed an item for this block so I'm currently doing a Test item.

    For this test Item I made a Test class :
    PHP:
    <?php
    declare(strict_types=1);

    namespace 
    Baleine\CoffresPlusPlus\Items;

    use 
    pocketmine\item\item;

    class 
    Test extends Item{
        public function 
    __construct(int $meta 0){
            
    parent::__construct(900$meta"Test");
        }
    }
    ?>
    And in my Main class I register this Item :
    PHP:
    <?php

    namespace Baleine\CoffresPlusPlus;

    use 
    Baleine\CoffresPlusPlus\Items\Test;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\inventory\transaction\action\SlotChangeAction;
    use 
    pocketmine\Player;
    use 
    pocketmine\item\item;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerInteractEvent;
    use 
    pocketmine\Item\ItemFactory;


    class 
    Main extends PluginBase implements Listener{
        public function 
    onEnable()
        {
            
    $this->getLogger()->notice("Made with love by Baleine !");
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    ItemFactory::registerItem(new Test());
            
    Item::addCreativeItem(Item::get(900));
        }
    }
    ?>
    I also made a Texture pack with Item.png as a texture.

    Then pocketmine launches fine but my game crashes every time I try to connect. Did I missed something ?
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    I believe you need to use a behaviour pack and the resource pack to register the custom item with the client
    For examples you can search google for "How to create custom blocks on bedrock"
     
  3. BaleineSanguine

    BaleineSanguine Spider

    Messages:
    10
    GitHub:
    baleinesanguine
    Ok thanks
     
    RicardoMilos384 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.