Ability Core
Just like Items and Blocks in minecraft all abilities exist only once, that is an AbilityCore
. An IAbility
object
thus represents specific information that each ability can have, while the important, immutable information of the
ability (such as name, description, unlock requirements etc) are stored within the AbilityCore
and applied to all
abilities of that type.
They are created at startup and are registered in a specific AbilityCore
registry found at ModRegistries
,
specifically here we're talking about ModRegistries.ABILITIES
.
AbilityCore
s are created via a builder class found inside of them (AbilityCore.Builder
) and allows devs to customize
an ability's information while also providing some defaults.
Mandatory properties
Mandatory for all AbilityCore
s are 3 things:
- a name
- an
AbilityCategory
- and an
AbilityCore.IFactory
used to create the ability
The name is self explanatory, this should be the default english localized name, such as Hiken
The AbilityCategory
is the category which this ability is part of, this is used only for filtering and for the ability
selection menu sorting them in tabs. Possible values are:
- DEVIL_FRUIT
- RACIAL
- STYLE
- HAKI
- FACTION
- EQUIPMENT
The AbilityCore.IFactory
factory is a standard java factory pattern taking in an AbilityCore<A extends IAbility>
and
outputting A
, a generic ability. In practice, as long as the default constructor for abilities (offered by Ability
or PassiveAbility
) is kept the factory needed will purely be a ::new
call.
Optional properties
There are also a bunch of optional properties an AbilityCore
can have, such as:
AbilityType
- active vs passive abilities, used in menus to separate them as well as for filtering abilities- default:
AbilityType.Action
(abilities that manually need activation)
- default:
SourceHakiNature
- the kind of haki that should affect this ability- default:
SourceHakiNature.UNKNOWN
(not affected by haki at all) - more info
- default:
SourceType
- a list of types that this ability has- default:
SourceType.UNKNOWN
(no type) - more info
- default:
SourceElement
- element of the ability- default:
SourceElement.NONE
(no elemental affinity) - more info
- default:
AbilityCore.ICanUnlock
- functional interface that determines if a player can unlock this ability, checked on multiple occasions. They are similar with predicates however they take aLivingEntity
(the entity trying to unlock this ability) and return aboolean
which is the result of this attempt (true if it can unlock it, false if they can't)- default:
null
(has no natural way of obtaining it)
- default:
- hidden - a property determining if the ability should be visible for the player, such as in menus
- default: false (visible in menus)
- phantom key - a
ResourceLocation
used as a fake registry key for an ability, used when needing to display bonuses or information as abilities without them actually being registered abilities, used for information or display purposes- default:
null
(not needed)
- default:
- icon - used to set an icon for the ability
- note that while this is not mandatory it is recommended to set one manually, there is a fallback here trying to get
the ability icon based on the path used by Mine Mine no Mi if no icon is found. (Example if mod
example
adds a new ability namedability
but forgets to assign an icon, the system will try to find an icon at pathassets/example/textures/abilities/ability.png
)
- note that while this is not mandatory it is recommended to set one manually, there is a fallback here trying to get
the ability icon based on the path used by Mine Mine no Mi if no icon is found. (Example if mod
- description - used for the description tooltips of the ability
- default: empty description