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

How to add custom armor

Discussion in 'Development' started by PJZ9n, Mar 4, 2021.

  1. PJZ9n

    PJZ9n Silverfish

    Messages:
    17
    GitHub:
    pjz9n
    I add an item with code like this, but the client crashes when I try to put it in the armor inventory. What does this mean?
    PHP:
    <?php

    declare(strict_types=1);

    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;

    //For ItemComponentPacketEntry

    $tag = new CompoundTag("", [
        new 
    ShortTag("minecraft:identifier"/* runtime id */),
        new 
    CompoundTag("components", [
            new 
    CompoundTag("minecraft:icon", [
                new 
    StringTag("texture""path/to/texture"),
            ]),
            new 
    CompoundTag("minecraft:armor"),
            new 
    CompoundTag("item_properties", [
                new 
    IntTag("use_duration"32),
                new 
    IntTag("max_stack_size"64),
                new 
    ByteTag("creative_category"1),
                new 
    ByteTag("can_destroy_in_creative"1),
                new 
    ByteTag("animates_in_toolbar"1),
                new 
    ByteTag("allow_off_hand"0),
                new 
    CompoundTag("minecraft:wearable", [
                    new 
    StringTag("slot""slot.armor.chest"),
                ]),
            ]),
        ]),
        new 
    CompoundTag("minecraft:on_use", [
            new 
    ByteTag("on_use"1),
        ]),
        new 
    CompoundTag("minecraft:on_use_on", [
            new 
    ByteTag("on_use_on"1),
        ]),
    ]);
     
  2. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Looks like the custom item doesn't have id @@
    //My EL is bad :<
     
  3. Moonafic

    Moonafic Silverfish

    Messages:
    24
    maybe you need to add attachable in rp
     
  4. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    As far as i can see, you have your custom item. But you don't have a model texture for the armor, so maybe that ? I didn't know that you can add a custom item with texture and actions on right click / left click
     
    Ayush likes this.
  5. Ayush

    Ayush Witch

    Messages:
    62
    If this work I will really appreciate them who help him to make and also can u give me the plugin I can make video on it
     
  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.