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

Solved Trying to add items to Creative Inventory

Discussion in 'Development' started by WinterBuild7074, Aug 27, 2017.

  1. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    I'm trying to add items to the Creative Inventory, but it crashed my server with the error:
    Code:
    __clone method called on non-object
    Full crashdump: https://pastebin.com/e5BUcWTi

    My Code
    In Main.php, onEnable():
    PHP:
    BlockFactory::$list[165] = SlimeBlock::class;
    ItemBlock::addCreativeItem(new SlimeBlockMCPE());
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    Code:
    BlockFactory::$list[165] = SlimeBlock::class;
    
    DO NOT DO THIS. Since you are using ALPHA7, use the provided API methods.

    Code:
    BlockFactory::registerBlock(new SlimeBlock());
    
     
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Is it possible to add the Slime Block to the Creative Inventory without creating the block's class? If yes, how? Plus blocks that have a Meta-ID, like 201:2 (Purpur Pillar)?
    Slime Blocks (and all other blocks) are already placeable/working, but not added to PocketMine's blocks folder yet.
     
  4. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    I found it out:
    PHP:
    ItemBlock::addCreativeItem(Item::get(165));
     
  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.