Custom Pets
In this tutorial, I will be custom pets using slimes and custom skulls. If you are here for the commands rather than learning they are all at the bottom of the page.
The commands I will be using to achieve this are:
• Summon
• Execute
• Teleport
• Particle
• Playsound
Method / Explanation:
To begin, we need to know how this works and what we are trying to achieve. The small slimes follow the player as they are aggressive however the smallest ones do not do any damage. We can use this to create a pet. However for it to be new we need it to look different. For this we use custom skulls as they are about the same size as the slimes so their hitboxes would make sense.
Custom skulls are player heads that look like a specific players ign, This could be yours, a friends etc. We get them with the give command.
/give @p minecraft:player_head{SkullOwner:"Subscribe"} 1
But with custom heads, mojang also have a collection is usernames you can put in for a specific look. For example a cake. We call these MHF heads as they all begin with 'MHF_'
A full list of these can we found here.
Once you have decided what head you want we can continue
/give @p minecraft:player_head{SkullOwner:"MHF_TNT"} 1
Next we need to create our slime summon command and an invisible armor stand with our custom skull on it's head. To create summon commands with lots of data tags the easiest way is not doing it by hand but instead with McStacker. On this website you put in the mob and all the data tags you want and it gives you the summon command for you!
The commands I will be using to achieve this are:
• Summon
• Execute
• Teleport
• Particle
• Playsound
Method / Explanation:
To begin, we need to know how this works and what we are trying to achieve. The small slimes follow the player as they are aggressive however the smallest ones do not do any damage. We can use this to create a pet. However for it to be new we need it to look different. For this we use custom skulls as they are about the same size as the slimes so their hitboxes would make sense.
Custom skulls are player heads that look like a specific players ign, This could be yours, a friends etc. We get them with the give command.
/give @p minecraft:player_head{SkullOwner:"Subscribe"} 1
But with custom heads, mojang also have a collection is usernames you can put in for a specific look. For example a cake. We call these MHF heads as they all begin with 'MHF_'
A full list of these can we found here.
Once you have decided what head you want we can continue
/give @p minecraft:player_head{SkullOwner:"MHF_TNT"} 1
Next we need to create our slime summon command and an invisible armor stand with our custom skull on it's head. To create summon commands with lots of data tags the easiest way is not doing it by hand but instead with McStacker. On this website you put in the mob and all the data tags you want and it gives you the summon command for you!
You should end up with two commands like these. Just paste each one into a command block and leave them for now.
/summon slime ~ ~1 ~ {Silent:1b,Size:0,CustomName:"{\"text\":\"Slime1\"}",ActiveEffects:[{Id:14b,Amplifier:1b,Duration:20000000,ShowParticles:0b}]} /summon armor_stand ~ ~1 ~ {NoGravity:1b,Marker:1b,Invisible:1b,ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Name:"MHF_TNT2"}}}],CustomName:"{\"text\":\"Skull1\"}"} |
These are the two elements we need to make our pet. Now we need to work on making the armor stand constantly follow the slime so they are like one mob. For this we will execute at our slime which I called Slime1 and then make the Armor Stand I named Skull1 to it.
/execute as @e[name=Slime1] at @s run teleport @e[name=Skull1] ~ ~-1.4 ~
The reason I have given them numbers is because for every different one with this system they will need different names and tp commands for each one so it doesn't confuse the system. We could fix this with scoreboards but at the moment the best way forward would to just to add a new teleport command and names for each one. So if you have a second it would be:
/execute as @e[name=Slime2] at @s run teleport @e[name=Skull2] ~ ~-1.4 ~
Or whatever you named them. For this we are not caring about head rotation so teleport or tp would work it doesn't really matter but teleport is generally a better command so I would use /teleport to get yourself into a habit of using it.
Now we have it teleporting it is essentially working! Now we can add some particles and/or playsounds. Both of these commands are commands that I recommend just using tab completion to work out what you need to put but here is my two commands.
/execute at @e[name=Slime1] run particle minecraft:witch ~ ~ ~ 0.1 0.1 0.1 0.01 10 force
/execute at @e[name=Slime1] run playsound minecraft:entity.creeper.hurt voice @a[distance=..3] ~ ~ ~
/execute as @e[name=Slime1] at @s run teleport @e[name=Skull1] ~ ~-1.4 ~
The reason I have given them numbers is because for every different one with this system they will need different names and tp commands for each one so it doesn't confuse the system. We could fix this with scoreboards but at the moment the best way forward would to just to add a new teleport command and names for each one. So if you have a second it would be:
/execute as @e[name=Slime2] at @s run teleport @e[name=Skull2] ~ ~-1.4 ~
Or whatever you named them. For this we are not caring about head rotation so teleport or tp would work it doesn't really matter but teleport is generally a better command so I would use /teleport to get yourself into a habit of using it.
Now we have it teleporting it is essentially working! Now we can add some particles and/or playsounds. Both of these commands are commands that I recommend just using tab completion to work out what you need to put but here is my two commands.
/execute at @e[name=Slime1] run particle minecraft:witch ~ ~ ~ 0.1 0.1 0.1 0.01 10 force
/execute at @e[name=Slime1] run playsound minecraft:entity.creeper.hurt voice @a[distance=..3] ~ ~ ~
However after doing this I decided the playsound was annoying as it didn't stop so I made it when it wasn't on ground. I did this with the {OnGround:0b} data tag as 0 being false, 1 being true and also OnGround because?
Yes that's right! It isn't an arrow so it is OnGround not inGround! Glad you remembered ;)
So I added a nbt parameter in the selector
/execute at @e[name=Slime1,nbt={OnGround:0b}] run playsound minecraft:entity.creeper.hurt voice @a[distance=..3] ~ ~ ~ 1 1 1
Now we are done! I hope you learned something! ~Blue
Yes that's right! It isn't an arrow so it is OnGround not inGround! Glad you remembered ;)
So I added a nbt parameter in the selector
/execute at @e[name=Slime1,nbt={OnGround:0b}] run playsound minecraft:entity.creeper.hurt voice @a[distance=..3] ~ ~ ~ 1 1 1
Now we are done! I hope you learned something! ~Blue
Your commands should look like this: