Skip to content

Get Attribute Operation

Converts minecraft:living_entity prototype into minecraft:entity_attribute_instance prototype such that it represents the instance of given attribute. If the target has no attribute returns nothing.

Properties

Attribute

Property attribute defines an Attribute. The operation will return minecraft:entity_attribute_instance of this attribute from the living entity.

Examples

The operation is used to get attribute generic.luck on the player and then the value of it, such that the experience source gives extra experience every time player kill entity.

Click to view
json
{
	"type": "puffish_skills:kill_entity",
	"data": {
		"variables": {
			"luck_value": {
				"operations": [
					{
						"type": "get_player"
					},
					{
						"type": "as_living_entity"
					},
					{ 
						"type": "puffish_skills:get_attribute",
						"data": {
							"attribute": "generic.luck"
						}
					},
					{
						"type": "get_value"
					}
				],
				"fallback": 0
			},
			"dropped_experience": {
				"operations": [
					{
						"type": "get_dropped_experience"
					}
				]
			},
		},
		"experience": "dropped_experience + luck_value * dropped_experience"
	}
}

JSON structure

PropertyTypeRequired
attributeattribute identifieryes