Origins (Fabric)

Origins (Fabric)

17M Downloads

origins:conditioned_attribute active by default on origin selection despite not meeting condition

sage1192 opened this issue ยท 2 comments

commented

This is on origins v1.13.0-alpha.12+mc1.21.1 or latest alpha at time of writing

I got a datapack here I've been working on. On selection of the origin, the attribute for movement speed is increased by about 25% immediately when it should only be activated while leather armor is equipped. I've found that removing the attributes through /attribute as well as putting on and taking off armor both reset the player to expected behavior.

This is the code for the specific power that is causing problems, full datapack is also linked:
sagsorgs.zip

{
	"name": "Longcoat Enthusiast",
	"description": "You move much more comfortably in leather armor",
	"type": "origins:multiple",
	"head_plus": {
		"type": "origins:conditioned_attribute",
		"modifier": {
			"id": "head",
			"attribute": "minecraft:generic.movement_speed",
			"operation": "add_multiplied_total",
			"amount": 0.0625
		},
		"condition": {
			"type": "origins:equipped_item",
			"equipment_slot": "head",
			"item_condition": {
				"type": "origins:ingredient",
				"ingredient": {
					"item": "minecraft:leather_helmet"
				}
			}
		},
		"tick_rate": 20
	},
	"chest_plus": {
		"type": "origins:conditioned_attribute",
		"modifier": {
			"id": "chest",
			"attribute": "minecraft:generic.movement_speed",
			"operation": "add_multiplied_total",
			"amount": 0.0625
		},
		"condition": {
			"type": "origins:equipped_item",
			"equipment_slot": "chest",
			"item_condition": {
				"type": "origins:ingredient",
				"ingredient": {
					"item": "minecraft:leather_chestplate"
				}
			}
		},
		"tick_rate": 20
	},
	"legs_plus": {
		"type": "origins:conditioned_attribute",
		"modifier": {
			"id": "legs",
			"attribute": "minecraft:generic.movement_speed",
			"operation": "add_multiplied_total",
			"amount": 0.0625
		},
		"condition": {
			"type": "origins:equipped_item",
			"equipment_slot": "legs",
			"item_condition": {
				"type": "origins:ingredient",
				"ingredient": {
					"item": "minecraft:leather_leggings"
				}
			}
		},
		"tick_rate": 20
	},
	"feet_plus": {
		"type": "origins:conditioned_attribute",
		"modifier": {
			"id": "feet",
			"attribute": "minecraft:generic.movement_speed",
			"operation": "add_multiplied_total",
			"amount": 0.0625
		},
		"condition": {
			"type": "origins:equipped_item",
			"equipment_slot": "feet",
			"item_condition": {
				"type": "origins:ingredient",
				"ingredient": {
					"item": "minecraft:leather_boots"
				}
			}
		},
		"tick_rate": 20
	}
}
commented

if anyone happens to stumble on this in the future, I fixed this specific case by running a block of commands to manually remove each of the attributes so that they can be reapplied when the conditions are met. It seems this runs fully as expected after this fix.

This block was added to the end of the block of conditioned attributes:

"start": {
	"type": "origins:action_on_callback",
	"entity_action_chosen": {
		"type": "origins:and",
		"actions": [
			{
				"type": "origins:execute_command",
				"command": "attribute @s minecraft:generic.movement_speed modifier remove head"
			},
			{
				"type": "origins:execute_command",
				"command": "attribute @s minecraft:generic.movement_speed modifier remove chest"
			},
			{
				"type": "origins:execute_command",
				"command": "attribute @s minecraft:generic.movement_speed modifier remove legs"
			},
			{
				"type": "origins:execute_command",
				"command": "attribute @s minecraft:generic.movement_speed modifier remove feet"
			}
		]
	}
}
commented

This should be fixed on upstream as well, same as #806. I'll close this when the new alpha build is out