Skip to main content
The Elements API exposes the full periodic table of elements as in-game items, organized by chemical category. Each element is registered through CoreElements and comes with a complete set of physical forms.

ElementType enum

ElementType is an enum that represents every element in the periodic table, plus a set of alloys. Each constant carries chemical metadata as fields.

Categories

Elements fall into the following categories based on their position in the periodic table:
CategoryExample members
Alkali MetalsLITHIUM, SODIUM, POTASSIUM, RUBIDIUM, CESIUM, FRANCIUM
Alkaline Earth MetalsBERYLLIUM, MAGNESIUM, CALCIUM, STRONTIUM, BARIUM, RADIUM
Transition MetalsTITANIUM, IRON, COPPER, SILVER, GOLD, PLATINUM
LanthanidesCERIUM, NEODYMIUM, GADOLINIUM, LUTETIUM
ActinidesTHORIUM, URANIUM, PLUTONIUM, AMERICIUM
Post-Transition MetalsALUMINUM, TIN, LEAD, BISMUTH, SILICON
AlloysSTEEL, STAINLESS_STEEL, BRASS, BRONZE

Key methods

// Returns the element's display name (e.g. "Stainless Steel" for STAINLESS_STEEL)
String getDisplayName()

// Returns true if this entry is an engineered alloy rather than a pure element
boolean isAlloy()

// Returns true if the element occurs naturally (false for most synthetic elements and all alloys)
boolean isNatural()

// Returns the chemical symbol (e.g. "Fe" for IRON)
String getSymbol()

// Returns the atomic number (0 for alloys)
int getAtomicNumber()

// Returns the atomic weight in g/mol
float getAtomicWeight()

// Returns the ARGB tint color used for item rendering
int getTintColor()

// Returns the total mass (protons + neutrons)
long getMass()

// Looks up an element by atomic number; returns null if not found
static ElementType getByAtomicNumber(int atomicNumber)

// Looks up an element by chemical symbol; returns null if not found
static ElementType getBySymbol(String symbol)

Item types

For every element registered through CoreElements.elementIngot(), six additional physical forms are automatically created and registered alongside the ingot:
ClassForm
ElementItemIngot (base form)
ElementRawItemRaw ore fragment
ElementNuggetItemNugget (1/9 ingot)
ElementDustItemGround dust
ElementPlateItemRolled plate
ElementPileItemLoose pile
ElementRodItemMachined rod
All six secondary forms are obtained directly from the ElementItem instance:
ElementItem ingotItem = CoreElements.TITANIUM_INGOT.get();

ElementRawItem   raw    = ingotItem.getRawItem();
ElementNuggetItem nugget = ingotItem.getNuggetItem();
ElementDustItem  dust   = ingotItem.getDustItem();
ElementPlateItem plate  = ingotItem.getPlateItem();
ElementPileItem  pile   = ingotItem.getPileItem();
ElementRodItem   rod    = ingotItem.getRodItem();

AlloyType class

AlloyType defines a named alloy as a composition of ElementType parts with a builder API.
// Construct an alloy definition: 2 parts Copper, 1 part Zinc (Brass)
AlloyType brass = AlloyType.builder("Brass", "CuZn")
    .add(ElementType.COPPER, 2)
    .add(ElementType.ZINC, 1)
    .build();

// Access composition data
String formula    = brass.getEmpiricalFormula();          // "CuZn"
double cuFraction = brass.getFraction(ElementType.COPPER); // 0.6667
double cuPercent  = brass.getPercentage(ElementType.COPPER); // 66.67

// Formatted formula variants
String empirical   = brass.getEmpiricalFormula(false);    // "CuZn" (1 suppressed)
String empirical1  = brass.getEmpiricalFormula(true);     // "Cu2Zn1"
String percentage  = brass.getPercentageFormula(1);       // "Cu66.7Zn33.3"
name
String
required
Human-readable alloy name (e.g. "Brass").
symbol
String
required
Chemical symbol string (e.g. "CuZn").

CoreElements registry

CoreElements holds all registered element ItemDefinition constants and provides two access methods.

elementIngot()

public static ItemDefinition<ElementItem> elementIngot(ElementType element)
Registers an ingot for the given element and automatically registers all six secondary forms (raw, nugget, dust, plate, pile, rod). Called once per element at class-load time. You should not call this yourself; use the pre-registered constants instead.
element
ElementType
required
The element to register. Must be a member of the ElementType enum.

getElements()

public static List<ItemDefinition<?>> getElements()
Returns an unmodifiable view of every item registered through CoreElements, including all ingots and their secondary forms.

Iterating all elements

for (ItemDefinition<?> def : CoreElements.getElements()) {
    Item item = def.get();
    // item may be ElementItem, ElementRawItem, ElementNuggetItem, etc.
}
To iterate only the ingot entries and inspect their element type:
for (ElementType element : ElementType.values()) {
    if (!element.isNatural()) continue; // skip alloys and synthetics
    System.out.println(element.getDisplayName() + " (" + element.getSymbol() + ")");
}

Code example: accessing a specific element ingot

import general.mechanics.registries.CoreElements;
import general.mechanics.api.item.element.ElementType;
import general.mechanics.api.item.element.metallic.ElementItem;
import net.minecraft.world.item.ItemStack;

// Get the ItemDefinition for the titanium ingot
ItemDefinition<ElementItem> ingotDef = CoreElements.TITANIUM_INGOT;

// Retrieve the actual Item instance
ElementItem ingotItem = ingotDef.get();

// Create a stack of 4 titanium ingots
ItemStack stack = new ItemStack(ingotItem, 4);

// Read element metadata
ElementType element = ElementType.TITANIUM;
System.out.println(element.getDisplayName()); // "Titanium"
System.out.println(element.getSymbol());       // "Ti"
System.out.println(element.getAtomicNumber()); // 22
System.out.println(element.isAlloy());         // false
System.out.println(element.isNatural());       // true

Build docs developers (and LLMs) love