Skip to content

Manager API ​

Epiphany provides a set of static Manager classes as a public API, allowing other mods to interact with the system through Java code.

TIP

All Manager method player parameters are ServerPlayer.

INFO

KubeJS scripts also support the Manager API. See the KubeJS Compat section for details.

AptitudeManager ​

Manages player aptitude values and Insight Points. Aptitude settlement uses the server's current growth curve; new aptitude and point gains obey the total Insight Point cap.

Query Methods ​

java
// Get the player's current aptitude value
long getAptitude(ServerPlayer player)

// Get the player's current Insight Points
int getInsightPoints(ServerPlayer player)

// Get the total Insight Points the player has spent
int getTotalInsightPointsSpent(ServerPlayer player)

// Get total Insight Points (spent + unspent)
long getTotalInsightPoints(ServerPlayer player)

// Whether the player can gain more points; false at the total cap
boolean canGainInsightPoints(ServerPlayer player)

// Get the aptitude threshold for the player's next Insight Point
long getRequiredForNextPoint(ServerPlayer player)

Mutation Methods ​

java
// Set aptitude (minimum 0)
// Increases use normal level-up settlement and may grant multiple points
// Decreases do not take back Insight Points
// Fires AptitudeChangedEvent, plus level-up and point-change events when points are earned
void setAptitude(ServerPlayer player, long value)

// Add aptitude without applying the player multiplier
// Deduct each point's cost using the growth curve and retain the remainder
// Discard excess aptitude when the total point cap is reached
// Fires AptitudeChangedEvent, AptitudeLevelUpEvent, InsightPointsChangedEvent
void addAptitude(ServerPlayer player, long amount)

// Add aptitude after applying aptitude_gain_multiplier (base + modifiers)
// The scaled amount is rounded down; zero or negative results are ignored
void addAptitudeWithMultiplier(ServerPlayer player, long amount)

// Set available Insight Points (minimum 0), without changing spent points
// Increases are limited to the remaining budget; existing points can still be reduced
// Fires InsightPointsChangedEvent when points change
// Also fires AptitudeChangedEvent if reaching the cap clears aptitude
void setInsightPoints(ServerPlayer player, int value)

// Add or subtract available Insight Points (amount may be negative; minimum balance 0)
// Increases obey the remaining budget; events follow setInsightPoints
void addInsightPoints(ServerPlayer player, int amount)

// Add exactly enough aptitude to reach the next Insight Point threshold
// Uses the same settlement flow and fires normal aptitude and level-up events
// Returns the aptitude actually added, or 0 at the total point cap or if no top-up is needed
long fillAptitude(ServerPlayer player)

At the total Insight Point cap, positive aptitude and point grants no longer take effect. Normal spending and the corresponding refunds preserve total points; direct deductions through setInsightPoints or a negative addInsightPoints reduce the total.

Reversible Insight Point Rewards ​

Custom rewards that need to take points back on removal can use these methods to record and reverse the actual amount granted:

java
// Record the actual point gain under sourceKey, including grants clipped to 0 by the cap
void applyInsightPointsReward(ServerPlayer player, String sourceKey, int amount)

// Reverse the most recent recorded grant for this sourceKey
void removeInsightPointsReward(ServerPlayer player, String sourceKey)

sourceKey identifies the reward's source. Use the same key when applying and removing it. Even if the cap clips a reward, removal takes back only the amount actually granted.

EpiphanyDataUtils ​

Provides reusable cross-subsystem data operations for Java callers, UI code, and command implementations.

Event behavior

The reset methods intentionally fire no aptitude, Insight Point, or selection events. This matches the behavior of the corresponding /epiphany reset commands.

java
// Remove all applied Module, Insight, and selected Epiphany rewards
void removeAllRewards(ServerPlayer player)

// Calculate the Insight Point refund for selected Modules and unlocked Insights
// Pure read: does not modify player data
int refundInsightCosts(ServerPlayer player, PlayerEpiphanyData data)

// Remove all rewards and player Epiphany data, then restore SELECTABLE entries
// Equivalent to /epiphany reset all
void resetAll(ServerPlayer player)

// Clear selections and rewards while preserving aptitude
// Refunds selected Module and unlocked Insight costs, then restores SELECTABLE entries
// Equivalent to /epiphany reset select
void resetSelections(ServerPlayer player)

ModuleManager ​

Manages player module data.

Query Methods ​

java
// Whether the module is unlocked (can be selected)
boolean isUnlocked(ServerPlayer player, ResourceLocation moduleId)

// Whether the module is currently selected
boolean isSelected(ServerPlayer player, ResourceLocation moduleId)

// Whether the module is completed
boolean isCompleted(ServerPlayer player, ResourceLocation moduleId)

// Number of modules the player currently has selected
int getSelectedModuleCount(ServerPlayer player)

// Configured hard cap on simultaneously selected modules
int getMaxSelectedModules()

Mutation Methods ​

java
// Set module unlock state
// Fires ModuleUnlockEvent (Pre) and ModuleUnlockedEvent (Post)
void setUnlocked(ServerPlayer player, ResourceLocation moduleId, boolean unlocked)

// Select a module (consumes Insight Points, checks conditions and cap)
// Fires ModuleSelectEvent (Pre) and ModuleSelectedEvent (Post)
// Applies on_select_reward
void select(ServerPlayer player, ResourceLocation moduleId)

// Complete a module (checks if all insights are unlocked, grants Epiphany Slot)
// Fires ModuleCompleteEvent (Pre) and ModuleCompletedEvent (Post)
// Applies on_complete_reward
void complete(ServerPlayer player, ResourceLocation moduleId)

// Force-select (ignores cost and conditions)
// Fires ModuleSelectedEvent (Post)
void forceSelect(ServerPlayer player, ResourceLocation moduleId)

// Force-complete (ignores insight check, grants Epiphany Slot)
// Fires ModuleCompletedEvent (Post)
void forceComplete(ServerPlayer player, ResourceLocation moduleId)

// Reset module (refunds Insight Points, removes rewards)
void resetModule(ServerPlayer player, ResourceLocation moduleId)

// Auto-unlock locked modules whose conditions are met
// skipEventDriven: whether to skip polling
// silent: whether to fire notification messages in NotificationListener
void checkAutoUnlock(ServerPlayer player, boolean skipEventDriven, boolean silent)

// Clean up module data for registry entries that no longer exist
void cleanupOrphanedData(ServerPlayer player)

InsightManager ​

Manages player insight state.

Query Methods ​

java
// Whether the insight has been unlocked
boolean isSelected(ServerPlayer player, ResourceLocation insightId)

// Whether the insight's owning module is selected
boolean isModuleSelected(ServerPlayer player, ResourceLocation insightId)

Mutation Methods ​

java
// Unlock an insight (consumes Insight Points, checks prerequisites)
// Fires InsightSelectEvent (Pre) and InsightSelectedEvent (Post)
void select(ServerPlayer player, ResourceLocation insightId, ResourceLocation moduleId)

// Force-unlock an insight (ignores cost and prerequisites)
void forceSelect(ServerPlayer player, ResourceLocation insightId, ResourceLocation moduleId)

// Reset an insight (refunds Insight Points, removes rewards)
void resetInsight(ServerPlayer player, ResourceLocation insightId)

EpiphanyManager ​

Manages player epiphany state.

Query Methods ​

java
// Whether the epiphany is unlocked (can be selected)
boolean isUnlocked(ServerPlayer player, ResourceLocation epiphanyId)

// Whether the epiphany is currently selected
boolean isSelected(ServerPlayer player, ResourceLocation epiphanyId)

// Number of Epiphany Slots the player has unlocked
int getEpiphanySlots(ServerPlayer player)

// Number of Epiphany Slots currently occupied
int getUsedEpiphanySlots(ServerPlayer player)

// Configured hard cap on selectable Epiphanies
int getMaxEpiphanySlots()

Mutation Methods ​

java
// Set epiphany unlock state
void setUnlocked(ServerPlayer player, ResourceLocation epiphanyId, boolean unlocked)

// Select an epiphany (checks slots and conditions)
// Fires EpiphanySelectEvent (Pre) and EpiphanySelectedEvent (Post)
void select(ServerPlayer player, ResourceLocation epiphanyId)

// Force-select (ignores slots and conditions)
void forceSelect(ServerPlayer player, ResourceLocation epiphanyId)

// Reset an epiphany
void resetEpiphany(ServerPlayer player, ResourceLocation epiphanyId)

// Clean up epiphany data for registry entries that no longer exist
void cleanupOrphanedData(ServerPlayer player)

// Auto-unlock locked epiphanies whose conditions are met
// skipEventDriven: whether to skip polling
// silent: whether to fire notification messages in NotificationListener
void checkAutoUnlock(ServerPlayer player, boolean skipEventDriven, boolean silent)

AptitudeSourceManager ​

Resolves datapack-defined aptitude sources and grants their rewards.

java
// Resolve one behavior and target without rolling random values, applying the multiplier,
// or modifying player data. Returns the regular and available first-time reward ranges
// and the first-time reward claim key
AptitudeSourceResolver.Resolution resolve(
    ServerPlayer sp, ResourceLocation behaviorId,
    ResourceLocation targetId, @Nullable Registry<?> registry)

// Grant aptitude: roll regular and first-time rewards separately, add them together,
// then apply the player multiplier once and round down
// On success, record the claim and settle aptitude; returns whether a grant occurred
// behaviorId: behavior ID (e.g., "mymod:foo")
// targetId: target ID (e.g., the entity type that was killed)
// registry: the registry targetId belongs to, used for tag lookup. Can be null
boolean grant(
    ServerPlayer sp, ResourceLocation behaviorId,
    ResourceLocation targetId, @Nullable Registry<?> registry)

Usage example:

java
@SubscribeEvent
static void onCustomMobKill(LivingDeathEvent event) {
    if (!(event.getSource().getEntity() instanceof ServerPlayer sp)) return;
    ResourceLocation targetId = BuiltInRegistries.ENTITY_TYPE.getKey(event.getEntity().getType());
    AptitudeSourceManager.grant(
        sp,
        ResourceLocation.fromNamespaceAndPath("mymod", "custom_kill"),
        targetId,
        BuiltInRegistries.ENTITY_TYPE
    );
}

AptitudeSourceResolver ​

Provides the same read-only resolution as AptitudeSourceManager.resolve(...). The returned Resolution describes the possible rewards for the behavior, suitable for queries or previews:

MethodReturnsMeaning
applies()booleanThe rules match and allow a positive reward; does not indicate whether the player has remaining point budget
baseReward()AptitudeAmountRegular reward range
firstReward()AptitudeAmountAvailable first-time reward range; fixed 0 if none is available
claimKey()ResourceLocation or nullThe key for the available first-time reward claim
isFixed()booleanWhether both rewards are fixed values
minReward() / maxReward()longMinimum / maximum combined reward before applying the player multiplier

Use AptitudeAmount.min() and max() to inspect each range. The old Resolution.reward() is deprecated and works only for fixed values. Calling it on a random range throws an exception; query the bounds instead.

For example, with a regular reward of [3, 7] and an available first-time reward of 50, minReward() is 53 and maxReward() is 57. Repeated resolve calls neither roll rewards nor consume first-time claims. Use grant to issue the reward.

AptitudeFormula ​

Queries aptitude costs on the server using the active growth curve. With n = totalSpent + insightPoints, it returns the curve's f(n) cost, rounded up.

The default curve is f(n) = 10 + n. You can also configure segments using constant, linear, quadratic, exponential, and convergent functions. See Growth Curve.

java
// Calculate the aptitude required for the next Insight Point
// totalSpent: total Insight Points spent
// insightPoints: currently available Insight Points
// Returns: required aptitude value
long calcRequiredAptitude(long totalSpent, int insightPoints)

For a specific player, use AptitudeManager.getRequiredForNextPoint(player) directly. Use canGainInsightPoints(player) to check whether further progression is possible.

Processing Pattern ​

All Manager methods follow a common flow:

1. player.getData(AttachmentType) → read current data
2. Create a new immutable data record (with* methods)
3. player.setData(AttachmentType, newData) → persist and automatically sync to the client
4. NeoForge.EVENT_BUS.post(Event) → fire events

INFO

PlayerEpiphanyData is an immutable record. All changes use with*() methods to return a new instance.

Method Summary ​

ManagerMethodDescriptionReturns
AptitudeManagergetAptitudeCurrent aptitudelong
AptitudeManagergetInsightPointsAvailable Insight Pointsint
AptitudeManagergetTotalInsightPointsSpentTotal spent Insight Pointsint
AptitudeManagergetTotalInsightPointsSpent + unspent Insight Pointslong
AptitudeManagercanGainInsightPointsWhether more points can be gainedboolean
AptitudeManagergetRequiredForNextPointNext point's aptitude requirementlong
AptitudeManagersetAptitudeSet aptitudevoid
AptitudeManageraddAptitudeSettle aptitude using the growth curve and retain the remaindervoid
AptitudeManageraddAptitudeWithMultiplierAdd aptitude with the player multipliervoid
AptitudeManagersetInsightPointsSet available points; increases obey the total capvoid
AptitudeManageraddInsightPointsAdd or subtract points; increases obey the total capvoid
AptitudeManagerapplyInsightPointsRewardGrant a point reward and record the actual changevoid
AptitudeManagerremoveInsightPointsRewardReverse the latest corresponding point rewardvoid
AptitudeManagerfillAptitudeTop up aptitude for the next pointlong
EpiphanyDataUtilsremoveAllRewardsRemove all applied rewardsvoid
EpiphanyDataUtilsrefundInsightCostsCalculate selection cost refundsint
EpiphanyDataUtilsresetAllReset all player Epiphany datavoid
EpiphanyDataUtilsresetSelectionsReset selections while preserving aptitudevoid
ModuleManagerisUnlockedWhether the module is unlockedboolean
ModuleManagerisSelectedWhether the module is selectedboolean
ModuleManagerisCompletedWhether the module is completedboolean
ModuleManagergetSelectedModuleCountCurrently selected module countint
ModuleManagergetMaxSelectedModulesConfigured cap on selected modulesint
ModuleManagersetUnlockedSet unlock statevoid
ModuleManagerselectSelect a modulevoid
ModuleManagerforceSelectForce-select a modulevoid
ModuleManagercompleteComplete a modulevoid
ModuleManagerforceCompleteForce-complete a modulevoid
ModuleManagerresetModuleReset a modulevoid
ModuleManagercheckAutoUnlockAuto-unlock LOCKED modules whose conditions are metvoid
ModuleManagercleanupOrphanedDataClean up removed module entriesvoid
InsightManagerisSelectedWhether the insight is unlockedboolean
InsightManagerisModuleSelectedWhether its owning module is selectedboolean
InsightManagerselectUnlock an insightvoid
InsightManagerforceSelectForce-unlock an insightvoid
InsightManagerresetInsightReset an insightvoid
EpiphanyManagerisUnlockedWhether the epiphany is unlockedboolean
EpiphanyManagerisSelectedWhether the epiphany is selectedboolean
EpiphanyManagergetEpiphanySlotsUnlocked Epiphany Slotsint
EpiphanyManagergetUsedEpiphanySlotsOccupied Epiphany Slotsint
EpiphanyManagergetMaxEpiphanySlotsConfigured Epiphany Slot capint
EpiphanyManagersetUnlockedSet unlock statevoid
EpiphanyManagerselectSelect an epiphanyvoid
EpiphanyManagerforceSelectForce-select an epiphanyvoid
EpiphanyManagerresetEpiphanyReset an epiphanyvoid
EpiphanyManagercheckAutoUnlockAuto-unlock LOCKED epiphanies whose conditions are metvoid
EpiphanyManagercleanupOrphanedDataClean up removed epiphany entriesvoid
AptitudeSourceManagergrantGrant aptitudeboolean
AptitudeSourceManagerresolveQuery reward ranges without rollingResolution
AptitudeSourceResolverresolveResolve behavior rules and available first-time rewardsResolution
AptitudeFormulacalcRequiredAptitudeCalculate the next point's aptitude costlong