[TUTORIAL] Learn everything about Attributes!

Started by SparkleArts on

Topic category: User side tutorials

Last seen on 14:00, 24. Apr 2024
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] Learn everything about Attributes!
Sun, 03/12/2023 - 11:24 (edited)

Getting Started

Before we start with attributes, we need to know how they work and what exactly attributes are.

What are Attributes?

Attributes is a buff/debuff system that represents the various attributes of entities in Minecraft. Attributes also have modifiers that add a value to the attribute without changing the attribute's base value.

How Attributes really works

Attributes work like properties. These properties can be changed in several ways. However, each entity in Minecraft has general attributes. There are also exclusive attributes that only exist for certain entities. An example would be the attribute luck. Only players have this attribute. Attributes can also be modified.
There are several ways to change attributes of entities:

  • Enchantments: Enchantments can be applied to certain pieces of equipment to increase specific attributes.
  • Potions: Potions are items that you can drink to gain temporary advantages or disadvantages. Some can even change the attributes temporarily.
  • Items: Each item can also receive modifiers to change certain attributes. These modifiers do not change the base value of the attribute, but add a modifier that separately changes the overall value of the attribute.
  • Commands: There are also Commands to add modifiers to items or directly to a player.

How are the Attributes synchronized?

This section is important when working with attributes, especially vanilla attributes. Each attribute is synchronized between client and server by default. However, some attributes are only synchronized with the server. That is, in order to get the value of these attributes, you must first test whether it is on the server. Here is the list of all attributes in Minecraft and if they are synced with client.

Attributes Syncable with Client
Max Health True
Follow Range False
Knockback Resistance False
Movement Speed True
Flying Speed True
Attack Damage False
Attack Knockback False
Attack Speed True
Armor True
Armor Thoughness True
Luck True
Spawn Reinforcements Chance                                           False
Jump Strength True

 

Use the Procedure Block "Is provided world client side" and place a "not" Block to check if it is Server Side or Client Side. You can find "Is provided world client side" Block in the Category "World Data".

Edited by SparkleArts on Sun, 03/12/2023 - 11:24