-
Notifications
You must be signed in to change notification settings - Fork 0
API
Sleys edited this page Jul 29, 2026
·
5 revisions
This page is aimed at mod/addon developers building on top of SLM: Elements. It documents the public, stable API classes intended for external use.
These classes are
finalwith private constructors they're pure static utility APIs, safe to call from anywhere (items, entities, event handlers, other mods).
ElementAPI is the main entry point for reading and writing elemental state on an ItemStack. Elemental state is stored via data components (ElementsRegistryDataComponents).
| Method | Description |
|---|---|
applyElement(ItemStack, ElementsType) |
Infuses the stack with an element permanently. |
applyTemporaryElement(ItemStack, ElementsType, int ticks) |
Infuses the stack with an element that expires after ticks. |
applyAndConsumeElement(ItemStack, ElementsType) |
Infuses the stack with an element flagged to be consumed on use (single application). |
| Method | Description |
|---|---|
getElement(ItemStack) |
Returns Optional<ElementsType> the currently applied element, if any. |
hasAnyElement(ItemStack) |
true if the stack has any element applied. |
hasNotAnyElement(ItemStack) |
Inverse of hasAnyElement. |
hasElement(ItemStack, ElementsType) |
true if the stack has that specific element. |
hasNotElement(ItemStack, ElementsType) |
Inverse of hasElement. |
isTemporaryElement(ItemStack) |
true if the stack's element is time-limited and still active. |
getElementTicks(ItemStack) |
Remaining ticks for a temporary element (0 if none). |
isConsumeElement(ItemStack) |
true if the stack's element is flagged as consumable. |
| Method | Description |
|---|---|
removeElement(ItemStack) |
Clears the elemental value entirely. |
removeTimedElement(ItemStack) |
Clears the elemental value and its tick-duration component. |
removeConsumerElement(ItemStack) |
Clears the elemental value and its consumer-flag component. |
// Infuse a sword with Ignis for 200 ticks
ElementAPI.applyTemporaryElement(sword, ElementsType.IGNIS, 200);
// Check before applying combat logic
if (ElementAPI.hasElement(sword, ElementsType.IGNIS)) {
// trigger Ignis-specific behavior
}
// Read the element defensively
ElementAPI.getElement(sword).ifPresent(element -> {
// do something with the current element
});Controls whether the ICD system (see Combat Mechanics) is active for a given LivingEntity.
| Method | Description |
|---|---|
enable(LivingEntity) |
Enables ICD for this entity. |
disable(LivingEntity) |
Disables ICD for this entity. No metadata or elements will be transferred upon impact. |
isEnabled(LivingEntity) |
true if ICD is currently active for this entity. |
isDisabled(LivingEntity) |
Inverse of isEnabled. |
// Disable the transfer of elements; we will only use the pipeline's damage functions.
InternalCooldownDealerAPI.disable(player);
// Later, check state before applying custom logic
if (InternalCooldownDealerAPI.isDisabled(player)) {
// do things or reactivate if something happens
}See also: Combat Mechanics · Elements
SLM: Elements
External