Перейти к содержимому
Mineforgian

Mana Attributes

A small API that adds a mana system controlled by entity attributes.

8K загрузок9 подписчиковMITfabric

Обновлён 16 апреля 2026 г. · опубликован 2 мая 2024 г.

  • Default HUD

Mana Attributes

This API adds a mana system controlled by entity attributes.

Default implementation

LivingEntities can have up to manaattributes:max_mana amounts of mana. Mana is regenerated by manaattributes:mana_regeneration every manaattributes:mana_tick_threshold ticks.

When mana is reduced, regeneration is stopped for manaattributes:mana_regeneration_delay_threshold ticks.

When mana is <= 0, regeneration is stopped for manaattributes:depleted_mana_regeneration_delay_threshold ticks.

manaattributes:reserved_mana describes the percentage amount of maximum mana that is currently not available.

Default attribute values

  • manaattributes:max_mana: 0
  • manaattributes:mana_regeneration: 0
  • manaattributes:mana_tick_threshold: 20
  • manaattributes:mana_regeneration_delay_threshold: 20
  • manaattributes:depleted_mana_regeneration_delay_threshold: 60
  • manaattributes:reserved_mana: 0

All default values for players can be set in the server config.

Customization

The client config allows customizing the HUD element.

Using the mana system

Java

Casting a "LivingEntity" to the "ManaUsingEntity" interface gives access to all relevant methods.

Data packs

Mana Attributes implements several data driven methods to interact with the current mana value of an entity.

  • the "manaattributes:add_mana" enchantment effect allows adding a defined amount to the current mana
  • the "manaattributes:mana_using_entity" entity sub predicate passes when the current mana of an entity matches the defined range

Example

This enchantment reduces mana of the attacker by 2, as long as the attacker has at least 5 mana:

{
	"anvil_cost": 1,
	"description": {
		"translate": "enchantment.manaattributes.test"
	},
	"effects": {
		"minecraft:post_attack": [
			{
				"affected": "attacker",
				"effect": {
					"type": "manaattributes:add_mana",
					"amount": {
						"type": "minecraft:linear",
						"base": -2.0,
						"per_level_above_first": -2.0
					}
				},
				"enchanted": "attacker",
				"requirements": {
					"condition": "minecraft:entity_properties",
					"entity": "direct_attacker",
					"predicate": {
						"type_specific": {
							"type": "manaattributes:mana_using_entity",
							"mana_amount": {
								"min": 5.0
							}
						}
					}
				}
			}
		]
	},
	"max_cost": {
		"base": 25,
		"per_level_above_first": 8
	},
	"max_level": 1,
	"min_cost": {
		"base": 5,
		"per_level_above_first": 8
	},
	"slots": [
		"hand"
	],
	"supported_items": "#minecraft:swords",
	"weight": 5
}

Версии

ВерсияКаналИграЗагрузчикиДатаСкачать
4.0.0Релиз26.1, 26.1.1, 26.1.2fabric16 апреля 2026 г..jar (107 КБ)
3.2.1Релиз1.21.11fabric16 апреля 2026 г..jar (107 КБ)
3.2.0Релиз1.21.11fabric17 февраля 2026 г..jar (108 КБ)
3.1.0Релиз1.21.11fabric1 февраля 2026 г..jar (93 КБ)
3.0.0Релиз1.21.10fabric25 октября 2025 г..jar (90 КБ)
2.9.1Релиз1.21.1fabric5 октября 2025 г..jar (92 КБ)
2.9.0Релиз1.21.1fabric15 сентября 2025 г..jar (92 КБ)
2.8.1Релиз1.21.1fabric25 августа 2025 г..jar (89 КБ)
2.8.0Релиз1.21.1fabric25 августа 2025 г..jar (89 КБ)
2.7.0Релиз1.21.1fabric30 июля 2025 г..jar (88 КБ)
1.6.1Релиз1.20.1fabric13 декабря 2024 г..jar (80 КБ)
1.6.0Релиз1.20.1fabric9 декабря 2024 г..jar (80 КБ)
2.6.0Релиз1.21.1fabric9 декабря 2024 г..jar (80 КБ)
1.5.1Релиз1.20.1fabric6 декабря 2024 г..jar (86 КБ)
2.5.1Релиз1.21.1fabric6 декабря 2024 г..jar (86 КБ)

Показаны последние 15 из 26 версий. Все версии — на Modrinth.

Ченджлог

4.0.0Релиз26.1, 26.1.1, 26.1.2 · 16 апреля 2026 г.

4.0.0

  • updated to 26.1.x
3.2.1Релиз1.21.11 · 16 апреля 2026 г.

3.2.1

Fixes

  • fixed an issue where respawning would no longer reset mana after re-joining a world
3.2.0Релиз1.21.11 · 17 февраля 2026 г.

3.2.0

Additions

  • readded API methods to set and get current mana
  • added "manaattributes:add_mana" enchantment effect
  • added "manaattributes:mana_using_entity" entity sub predicate
  • the mana icon bar now blinks when mana changes, similar to the vanilla health bar. This can be disabled in the client config.
  • the mana icon bar now displays reserved mana

Fixes

  • fixed mana for players on respawn/joining a world
  • fixed regeneration delay
3.1.0Релиз1.21.11 · 1 февраля 2026 г.

3.1.0

  • updated to 1.21.11

Changes

  • regeneration delay timers no longer apply when joining a world

Technical

  • migrated to Mojang Mappings
  • replace synced data with a data attachment, following the best practice for custom entity data
3.0.0Релиз1.21.10 · 25 октября 2025 г.

3.0.0

  • updated to 1.21.10

Additions

Changes

  • removed "generic." prefix from all entity attributes, following vanillas example

Fixes

  • fixed wrong server config name. Sorry for the inconvenience this might have caused!
2.9.1Релиз1.21.1 · 5 октября 2025 г.

2.9.1

  • fixed mana bar being empty when joining a world for the first time
  • bumped various dependency versions
2.9.0Релиз1.21.1 · 15 сентября 2025 г.

2.9.0

  • replaced game rules with server config options
  • tweaked default client config settings
  • fixed mana bar being empty when joining a world / respawning
2.8.1Релиз1.21.1 · 25 августа 2025 г.

2.8.1

  • fixed game rules

Полная история изменений — на Modrinth.

Комментарии

Загружаем…