Discussion in 'Plugin Help' started by Fairuz, Jun 28, 2020.
Hello, how to add shield ? I really need it for my server
Shields are not yet implemented in pocketmine :/
is there any code that allows me to add a shield?
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
What is Code Shield?
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).
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!
Owh okay, my really understand what you mean
thank all for helping me
I'm glad I helped someone, I suggest marking this as Solved then.
how do I do that, I asked for the first time here
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.
Separate names with a comma.