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

Started by reid3002 on Wed, 06/02/2021 - 01:49

Topic category: Help with modding (Java Edition)

Last seen on 20:50, 26. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to Edit/Change Entity Attributes Whithout Coding
Wed, 06/02/2021 - 01:49

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 20:50, 26. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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