[TUTORIAL] How to Edit/Change Entity Attributes Whithout Coding

Started by reid3002 on

Topic category: Help with modding (Java Edition)

Last seen on 19:10, 27. Dec 2022
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to Edit/Change Entity Attributes Whithout Coding

Hi, I'm new here and I'm not sure if this is the right section to post this or not, if not please let me know since I plan to make a couple more tutorials.

I've seen a lot of people asking how to do this in the forums and people saying that it can't be done whithout coding. Well I don't like imposibles, and also I don't know how to code :P , so I found a way to do it without coding, just procedure blocks and minecraft comands, and here it is.

In this tutorial we will be making an item that increases the max health of an entity using minecraft.

https://imgur.com/nwWrzPn

So the first thing that you need, as with any procedure, it's a condition or reason for it to be executed. In this case the procedure is tied to de "when right click on entity" trigger and IF you have the especific item in your hand when doing it the procedure runs.

The second line of blocks sets a local STRING variable called "max_health" to the maximum health of the target entity + 0.5. This is done with the help of the "format number to ##.##" wich in english what it does is it translates a numerical value or variable to a text or string. (DO NOT CHANGE THE ##.## simbols! All you have to do for this block to work properly is give it a number to translate. that's it. The ##.## stays as it is)

The third line of blocks asembles the minecraft comand text that will be executed and saves it to another local STRING variable called "max_health_comand". For this, since I wanted to increase the max health by 1 every time the item was used I used the "replace text, with, on" block to always replace the text ""(max health)"" in this text that I used "attribute @s minecraft:generic.max_health base set (max health)" with the STRING variable that we translated from a number in the previous step.

The fourth line takes the text that I saved in the variable "max_health_comand" from before and executes the comand in Minecraft in the name of the entity. Wich increases it's max health by half a heart.

The rest it's just to test if it worked. For this you can translate the current max health of the target entity to text and then save it to another variable called "hp".

Then you send your self a message that includes that new "hp" to make sure the max health of the entity is increasing.

 

I will link here two pages from where you can get:

How to wirite in the comand the attributes that you can modify

https://minecraft.fandom.com/wiki/Attribute#Attributes_available_on_all_living_entities

And this one has some useful comands, including a comand to turn on WATER DAMAGE wich is another issue that I've seen in the topics.

https://www.pcgamesn.com/minecraft/minecraft-console-commands-and-cheats

but most importantly that last page has this wich is something very important when runing comands:

Target selector shortcuts
@p – nearest player
@r – random player
@a – all players
@e – all entities
@s – the entity executing the command
Target selector variables set a specific target without typing out their full name. Above are the five different shorthand commands.

 

Well that's the end of this tutorial. If there is something you don't understand or I didn't explain something clearly enough please leave a coment and I'll try to answer your question to the best of my abilities. Good luck ;)

Oh! I almost forgot I will leave this video here too. This video explains how to change attributes in older versions of minecraft as well as the 1.16 version

https://www.youtube.com/watch?v=9Tqjpr6HNyA

Last seen on 19:10, 27. Dec 2022
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's also worth mentioning…
Wed, 06/02/2021 - 01:54

It's also worth mentioning that "minecraft:generic.max_health", unlike most health related tuff, recognises the number 1 as a FULL HEART instead of the usual half heart. Wich is why I increased the max health by 0.5

Last seen on 20:34, 16. Apr 2024
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am so grateful, I really…
Sat, 10/15/2022 - 02:15

I am so grateful, I really needed this! I will try it out! However, the Imgur image you sent is a little blurry for me... I can't see what to do on it that well. If there is a better quality image, that would be great! Thanks!

Last seen on 19:10, 27. Dec 2022
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi and sorry for the late…
Wed, 11/23/2022 - 16:52

Hi and sorry for the late reply. The image looks fine to me, I don't know how to make a better quality image, but if you have any suggestions for how to do it, then I'll try to fix it. Also, let me know if you managed to do what you wanted with this or if you need a hand ;)

Last seen on 16:19, 18. May 2023
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hi, and this works on 1.19.2
Thu, 05/18/2023 - 16:14
hi, and this works on 1.19.2
Last seen on 17:30, 27. Jun 2023
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi! It didn't work for me…
Thu, 06/15/2023 - 20:06

Hi! It didn't work for me. 2022.3 + 1.16.5 plugin
When i click the block it just shows ( hp = 20) and nothing changes.