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

How To Make Custom Item

Discussion in 'Development' started by Arthur IV, Jul 20, 2021.

  1. Arthur IV

    Arthur IV Creeper

    Messages:
    3
    How do i fix this item not working

    How do i add a ID And Register It

    Heres The Code

    PHP:
    <?php

    /*
     *
     *
     * ░█████╗░██╗░░░██╗░██████╗████████╗░█████╗░███╗░░░███╗
     * ██╔══██╗██║░░░██║██╔════╝╚══██╔══╝██╔══██╗████╗░████║
     * ██║░░╚═╝██║░░░██║╚█████╗░░░░██║░░░██║░░██║██╔████╔██║
     * ██║░░██╗██║░░░██║░╚═══██╗░░░██║░░░██║░░██║██║╚██╔╝██║
     * ╚█████╔╝╚██████╔╝██████╔╝░░░██║░░░╚█████╔╝██║░╚═╝░██║
     * ░╚════╝░░╚═════╝░╚═════╝░░░░╚═╝░░░░╚════╝░╚═╝░░░░░╚═╝
     *
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     */

    declare(strict_types=1);

    namespace 
    Arthur\CustomItems\Items;

    use 
    pocketmine\item\Item;
    use 
    pocketmine\item\ItemFactory;
    use 
    pocketmine\nbt\tag\ByteTag;
    use 
    pocketmine\nbt\tag\CompoundTag;
    use 
    pocketmine\nbt\tag\IntTag;
    use 
    pocketmine\nbt\tag\ShortTag;
    use 
    pocketmine\nbt\tag\StringTag;

    final class 
    test2{
        
    $tag = new CompoundTag("", [
            new 
    CompoundTag("components", [
                new 
    CompoundTag("minecraft:icon", [
                    new 
    StringTag("texture"iron_ingot),
                ]),
                new 
    CompoundTag("item_properties", [
                    new 
    IntTag("max_stack_size"1),
                    new 
    ByteTag("max_damage"55)
                    new 
    ByteTag("hand_equipped"1),
                    new 
    ByteTag("creative_category"1),
                    new 
    ByteTag("can_destroy_in_creative"1),
                    new 
    ByteTag("animates_in_toolbar"1),
                    new 
    ByteTag("allow_off_hand"1),
                    new 
    ByteTag("hand_equipped"1),
                ]),
            ]),
            new 
    ShortTag("minecraft:identifier"test:item),
            new 
    CompoundTag("minecraft:display_name", [
                new 
    StringTag("value"CustomItem)
            ]),
        ]);
    }
    Any Help Would Be appreciated!
     
  2. UPL

    UPL Silverfish

    Messages:
    15
    Hi! You have any error in console?
     
  3. UPL

    UPL Silverfish

    Messages:
    15
  4. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    'Nbt thing' as you say, is not in pocketmine. It is in the vendor folder. In github, its NBT repository.
     
  5. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
  6. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    He wouldn't cause he only has an nbt tag right now, nothing is registered, no resource packs, nothing. So it won't work
     
  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.