Minecraft Blogs / Tutorial

Pendants in Vanilla Minecraft | Command Block Tutorial

  • 1,679 views, 3 today
  • 1
  • 1
  • 1
Brodie The Nerd's Avatar Brodie The Nerd
Level 44 : Master Nerd
18
Picture this: A villager gives a player a pendant, which holds great magic. The only problem is that it isn't actually magical because the map creator doesn't know how to use commands. Lucky for you, you will never need to experience this situation now that you are here! In this tutorial, I will show you how to create magical and completely customisable pendants in Vanilla Minecraft using command blocks!

To start off, you will need to spawn in the pendant! To do that, use the following command (or customise it if you wish) in chat:

[spoiler="/give" Command]/give @p dye 1 9 {display:{Name:"Health Pendant",Lore:["Heals the player completely","Automatically activates at 5 HP"]}}[/spoiler]

Next you need to create the scoreboard objectives. Type the following commands (or customise if you wish) in chat:

The scoreboard objectives
/scoreboard objectives add HealthPendant dummy
/scoreboard objectives add Health health

The first scoreboard objective is only effected by commands and can be customised to suit what fits your pendant (the name, not the criteria type). The second scoreboard objective monitors everyone's health and is not recommended to be customised (unless your pendant does not require the player's health to be activated).

Next, you need to detect players with the pendant. To do this type the following commands into a command block chain (the first command goes into a repeating command block set to always active, the rest go into chain command blocks set to always active), changing the scoreboard objective and item data if you customised them:

Detecting the pendant
/scoreboard players set @a HealthPendant 0
/scoreboard players set @a HealthPendant 1 {Inventory:[{id:"minecraft:dye",Count:1b,Damage:1s,tag:{display:{Name:"Health Pendant",Lore:"Heals the player completely","Automatically activates at 5 HP"]}}}]}

The first command goes into the repeating command block and the second one begins the chain. These then set the scoreboard objective "HealthPendant" (or a different one if you customised it) to 1 for players who have the item in their inventory and resets it in case somebody lost or dropped the item BEFORE it checks again. If the command blocks switch positions, the rest of the command block chain will believe nobody has the pendant.

Now, we need the command blocks to heal people who own the pendant but are on low health (you can completely customise this, whether it is the effect or whether or not they need to be on low health to activate it). To do this, continue the command block chain with one more chain command block and enter the following command:

The Magic Maker
/effect @a[score_HealthPendant_min=1,score_Health=5] minecraft:regeneration 5 5 true

What this does is effect the player with regeneration 5 for 5 seconds if they have a Health Pendant in their inventory and their health has gone below 5 HP. This can completely be customised, as you can change the effect, seconds, amplifier, whether or not particles are invisible, how much HP the player has or even if the pendant relies on the players health at all and just works 100% of the time. You can even take it much further (like I've done on my map) to summon armour stands which spawn particles, effect enemy players, give the player multiple buffs or even give enemies multiple debuffs.

I hope you guys enjoy messing around on your servers or PvP maps with these easy to make pendants (unless you are like me and added an extra 20 command blocks)! If you enjoyed this tutorial, please leave a diamond! If you hope to see more tutorials as they come out, please subscribe! Also, feel free to explore what I've done in the past (including maps)! I hope to see you in my next tutorial!
Tags

Create an account or sign in to comment.

1
01/05/2018 1:51 am
Level 44 : Master Nerd
Brodie The Nerd
Brodie The Nerd's Avatar
If you have any suggestions for future tutorials, post them here!
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome