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

Solved How to add Shield

Discussion in 'Plugin Help' started by Fairuz, Jun 28, 2020.

  1. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    Hello, how to add shield ? I really need it for my server
     
  2. Secretsilver313

    Secretsilver313 Silverfish

    Messages:
    18
    GitHub:
    secretsilver
    Shields are not yet implemented in pocketmine :/
     
  3. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    is there any code that allows me to add a shield?
     
  4. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    You can get it by giving an item with id 513, but it will not have any functionality. You have to code the functionality for it to work like in vanilla
     
  5. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    What is Code Shield?
     
  6. Seeker

    Seeker Spider Jockey

    Messages:
    45
    GitHub:
    seeker-devs
    This is like asking for the recipe of a cake without having the ingredients to make it. Ask yourself these questions before continuing:
    Do I know PHP?
    Do I know about OOP and know how to use it?
    Am I familiar with the Pocketmine-MP API?
    Am I experienced and have made plugins using 'Items'
    (Item.php especially)
    IF the answers to these question are 'Yes', then let me explain a bit. About a year or maybe even 2-3 years ago, I made a PR to add Cauldrons. It worked perfectly, but it got denied. Why? The cauldron could only be placed and nothing else.
    Okay! What does this have to do with my thread?
    First, make the shield. I believe there won't be any need to use a texture pack for the shield as it is already added in vanilla, so make an Item file for the Shield. Alright, done! Now what? Well... I have no idea how to actually add the animation (debugging symbols got removed anyways) so you can simply check the ItemID (or the Item name) and reduce the damage taken.
    Giv code plz
    No, no and no. Use the requests section if you want plugins (don't misunderstand this; Requests section is for requesting plugins you're not capable of making or they do not already exist, not for asking for code).
    [EDIT]
    For those who're wondering how to: so you can simply check the ItemID (or the Item name) and reduce the damage taken, you can use EntityDamageEvent and check the item in hand while the player holding the shield is hit. There might be a way for this to work with PlayerInteractEvent but.. that's for you to figure out!
     
    Fairuz likes this.
  7. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    Owh okay, my really understand what you mean
    thank all for helping me
     
  8. Seeker

    Seeker Spider Jockey

    Messages:
    45
    GitHub:
    seeker-devs
    I'm glad I helped someone, I suggest marking this as Solved then.
     
  9. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    how do I do that, I asked for the first time here
     
  10. Seeker

    Seeker Spider Jockey

    Messages:
    45
    GitHub:
    seeker-devs
    Make sure to read the rules and faq then.
    Here's how you do it:
    Go to thread tools, edit title, click on the (no prefix) button and you'll see Solved, click on that and you're good to go! Save the changes aswell.
     
  11. Fairuz

    Fairuz Spider

    Messages:
    7
    GitHub:
    fairuzembuh
    Okay thanks
     
    Seeker 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.