FFItemCreationTracker

This guide describes the public API in the current source version 0.2.2. Use the dependency guidance below and check that the mod is loaded when integrating conditionally.

Item Creation Tracker — Modding API

Primary class: com.fyxe.ffitemcreationtracker.api.ItemCreationAPI. The creation component is ffitemcreationtracker:creation; CreationRecord stores creator name and UUID, game day, timestamp, source ID, dimension, biome, moon phase, and custom extras.

Read and write stamps

MethodPurpose
get(ItemStack)Returns Optional<CreationRecord>.
has(ItemStack)Whether a stamp exists.
tryStamp(ItemStack, Player, CreationSource)Try a built-in source.
tryStamp(ItemStack, Player, String, Map<String,String>)Try a custom source and extras.
putExtra(ItemStack, String, String)Add or replace an extra on an existing stamp.
create(Player, String, Map<String,String>)Construct a record without writing it.

tryStamp runs on the logical server, returns true only when it writes a stamp, and respects enabled state, creative/spectator rules, item eligibility, and overwrite settings. It posts CreationStampEvent before writing.

Custom sources and display

Use a namespaced source ID such as mymod:cooking. Call ItemCreationAPI.registerSource(sourceId, byKey, nounKey, nounFirstKey) to supply wording, or provide translation keys. registerExtra(extraKey, formatter) formats an extra field in tooltips. Built-in sources include CRAFTED, SMELTED, ANVIL, SMITHING, ENCHANTED, TRADED, FISHED, and UNKNOWN.

ItemCreationAPI.tryStamp(result, player, "mymod:cooking", Map.of("mymod:recipe", "stew"));

Pre-write event

com.fyxe.ffitemcreationtracker.api.event.CreationStampEvent is cancellable and posted on NeoForge.EVENT_BUS after config checks but before the component is written. Inspect getPlayer(), getStack(), getSourceId(), and getExtras(); call setSourceId, putExtra, or setCanceled(true) to change or stop the stamp.

@SubscribeEvent
public static void onStamp(CreationStampEvent event) {
    if (event.getSourceId().equals("mymod:cooking")) {
        event.putExtra("mymod:station", "campfire");
    }
}

The mod requires FFUtilities. Add an optional dependency check before calling this API from another mod when Item Creation Tracker is optional.