Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/compatibility/digital-packaged-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ P P P
| 精灵传送门 Elven Gateway | **精灵门核心方块** | 多方块有效、提前开启且已完成开启等待;没有待交易物;附近原生结构中的魔力池有足够魔力 | 投入交易材料,回收此次交易产生的实体 |
| 泰拉凝聚板 Terrestrial Agglomeration Plate | 凝聚板本体 | 下方多方块有效、处于空闲状态、板上无已有物品实体 | 投料并请求原生开始处理;自行提供魔力,完成后回收 |
| 符文祭坛 Runic Altar | 祭坛本体 | 库存空、没有未完魔力目标、合成冷却结束 | 先投配方材料,等魔力就绪后投收尾试剂并调用法杖激活逻辑,回收结果及原生返还物 |
| 植物酿造器 Botanical Brewery | 酿造器本体 | 槽位为空;配方和酿造容器匹配;有足够魔力 | 编码补齐容器和剩余物;按槽位与堆叠上限循环投料,回收配方结果 |

花药台、符文祭坛在编码阶段会补齐配方的辅助耗材:花药台加入水桶、空桶返还和配方收尾试剂;符文祭坛补齐所需催化剂、收尾试剂和返还物。以编码后的样板为准,不要再手工重复追加。辅助试剂取自配方,不能假设所有配方都固定为同一种种子或活石。

Expand Down Expand Up @@ -301,7 +302,7 @@ R L R
| 末影合成器 Ender Crafter | 合成器本体 | 输入与输出槽为空、九宫格配方匹配;原生周边装置/时间条件满足 | 放入九宫格,等待机器运行,从输出槽回收 |
| 通量合成器 Flux Crafter | 合成器本体 | 同上,并满足原生能源与周边装置要求 | 放入九宫格,等待原生合成,从输出槽回收 |
| 自动末影/自动通量合成器 | 自动合成器本体 | 与对应普通合成器相同 | 任务占用时暂停原生邻接拉料,原生加工继续,任务结束后恢复 |
| 量子压缩器 Quantum Compressor | 压缩器本体 | 库存、累计材料与进度为空;关闭弹出模式并供能 | 自动借用催化剂,按槽容量分批投入真实数量材料,原生压缩后回收结果和催化剂 |
| 量子压缩器 Quantum Compressor | 压缩器本体 | 库存、累计材料与进度为空;关闭弹出模式并供能 | 按配方补全材料与催化剂输入;可独立识别的催化剂由三位一体借用一次,按槽容量分批投入材料,原生压缩后归还催化剂和结果 |

组合合成当前拒绝“中央主材料自身带合成返还物”的配方,因为原生核心不返还该位置;基座返还物则需要计入样板输出。末影/通量合成器按原生机器行为直接消耗网格输入,不执行配方的容器返还逻辑,样板只声明实际主产物;若期待额外返还桶等物品,这条路线不提供。上述路线优先按单轮样板使用。

Expand All @@ -321,7 +322,7 @@ P · P · P

**末影/通量合成器:**连接合成器本体,把对应的原生交替器/配套装置按该 Mod 指南摆在合成器周围,通量路线还需供能。外围装置的有效距离与加速条件由原 Mod 决定,封包不会代替它们;先确认机器原生界面可以推进目标配方,再交给供应器。

**量子压缩器:**连接压缩器本体。JEI 的单个材料显示会在编码时补成原生要求的完整数量,并补入借用催化剂及其返还输出。一份任务使用一种完整材料 key,标签可以选其中一种材料,但不混合不同 key 累加;这是该版本原生累计材料插入规则的限制。
**量子压缩器:**连接压缩器本体。JEI 的单个材料显示会在编码时补成原生要求的完整数量,并补入配方的催化剂输入。可独立识别的催化剂会作为可复用输入随三位一体任务借入并归还,编码输出只列压缩结果;编码前已存在的旧样板仍保留原有催化剂返还输出行为。无法与材料区分的催化剂仍使用返还输出行为。一份任务使用一种完整材料 key,标签可以选其中一种材料,但不混合不同 key 累加;这是该版本原生累计材料插入规则的限制。

### 4.8 Avaritia(无尽贪婪)

Expand Down Expand Up @@ -540,6 +541,15 @@ y-1 [下方不能放 IBin]
其他结构和仪式条件:遵循原生要求
```

### 4.16 Astral Sorcery(星辉魔法)

| 机器 | 连接目标 | 下单前要求 | 发配与回收 |
| --- | --- | --- | --- |
| 星辉祭坛 Altar Crafting | 祭坛方块实体 | 配方对应的基座、继电器、流体与星光条件均有效 | 投入配方材料与流体,保留原生祭坛加工;占用实际使用的继电器并回收产物、剩余物与流体余量 |
| 灌注器 Infuser | 灌注器方块实体 | 单件输入、配方流体环有效且没有运行中的仪式 | 投入一个材料实体,由原生灌注器消耗液态星辉并推进;回收配方结果 |

祭坛和灌注器均按单轮接单;封包不会替代星光、基座或液态星辉条件。Astral 的数字供应接口还可传输流明、星座与液态星辉资源。

## 5. 全局三态匹配、返还物与 CPU

匹配模式属于全局物品匹配规则,供终端、CPU、普通供应器和封包适配器共同使用。在加工样板槽位的数量编辑界面中切换,输入与各输出槽独立保存:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static boolean contradictory(TrinityCycleFeasibilityRequest request) {
}

/**
* Reuses the exact lower firing bounds as a shortage candidate if they already satisfy all net
* production rows. Virtual reserves and an executable order still have to be checked by the caller.
* Proposes the exact lower firing bounds if they already satisfy all net production rows.
* The caller still needs to verify the reserves and find an executable order.
*/
public static Object2ObjectMap<TrinityPatternVariant, BigInteger> shortageFirings(TrinityCycleFeasibilityRequest request) {
public static Object2ObjectMap<TrinityPatternVariant, BigInteger> lowerBoundFirings(TrinityCycleFeasibilityRequest request) {
FiringIntervals firing = inferFiringBounds(request);
if (firing == null) return FastUtilCollections.mapOf();
for (var bound : request.demand().requiredNetChangeLowerBounds().entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.ObjectList;
import it.unimi.dsi.fastutil.objects.ObjectSet;
import org.jspecify.annotations.Nullable;
import org.ojalgo.optimisation.Variable;

import java.math.BigInteger;
Expand Down Expand Up @@ -103,13 +104,10 @@ public TrinityAlgorithmResult<TrinityCycleFeasibilitySolution> solveShortage(
TrinityRadixSolverMetrics metrics = new TrinityRadixSolverMetrics();
TrinityCycleSolveBudget stateBudget = TrinityCycleSolveBudget.limited(request.shortageStateLimit());
BigInteger logicalUpper = initialFiringUpper;
if (request.fixedExternalTotal().isEmpty() && !control.cancellationRequested() && !control.deadlineExceeded()) {
var firings = TrinityExactCycleBalanceBounds.shortageFirings(request);
if (!firings.isEmpty()) {
BigInteger firingUpper = firings.values().stream().reduce(initialFiringUpper, BigInteger::max);
TrinityRadixSolvedModel solved = reconstructShortageReserves(request, firings, firingUpper);
return shortageCandidate(request, solved, false, stateBudget, metrics);
}
TrinityRadixSolvedModel candidate = lowerBoundCandidate(request, control, logicalUpper);
if (candidate != null) {
var verified = shortageCandidate(request, candidate, false, stateBudget, metrics);
if (verified.successful()) return verified;
}
try {
for (int domain = 0; domain < MAX_FEASIBILITY_DOMAINS; domain++) {
Expand All @@ -128,14 +126,14 @@ public TrinityAlgorithmResult<TrinityCycleFeasibilitySolution> solveShortage(
control.recordSolverModel();
TrinityRadixModelPass pass = TrinityRadixModelPass.Feasibility.INSTANCE;
TrinityRadixBuiltModel built = this.modelAssembler.assemble(request, pass, logicalUpper);
TrinityAlgorithmResult<Object2ObjectMap<Variable, BigInteger>> candidate = this.objectiveSearch.findFeasible(
TrinityAlgorithmResult<Object2ObjectMap<Variable, BigInteger>> witness = this.objectiveSearch.findFeasible(
built, control, metrics, stateBudget);
if (candidate.successful()) {
TrinityRadixSolvedModel solved = built.decode(candidate.value());
if (witness.successful()) {
TrinityRadixSolvedModel solved = built.decode(witness.value());
return shortageCandidate(request, solved, true, stateBudget, metrics);
}
if (candidate.diagnostic().code() != TrinityPlanningDiagnosticCode.MIP_NO_INTEGER_SOLUTION) {
return shortageFailure(candidate.diagnostic(), stateBudget, metrics);
if (witness.diagnostic().code() != TrinityPlanningDiagnosticCode.MIP_NO_INTEGER_SOLUTION) {
return shortageFailure(witness.diagnostic(), stateBudget, metrics);
}
} catch (TrinityRadixInfeasibleException finiteDomain) {
// A fixed/lower value can exceed this temporary domain before any solver call.
Expand Down Expand Up @@ -174,22 +172,28 @@ private TrinityAlgorithmResult<TrinityCycleFeasibilitySolution> shortageCandidat
allocation.actualInputs(), allocation.missingInputs(), stateBudget.used()));
}

private TrinityRadixSolvedModel reconstructShortageReserves(
TrinityCycleFeasibilityRequest request,
Object2ObjectMap<TrinityPatternVariant, BigInteger> firings,
BigInteger firingUpper) {
private @Nullable TrinityRadixSolvedModel lowerBoundCandidate(
TrinityCycleFeasibilityRequest request,
TrinityPlanningControl control,
BigInteger logicalUpper) {
if (request.fixedExternalTotal().isPresent() || control.cancellationRequested() || control.deadlineExceeded()) {
return null;
}
var firings = TrinityExactCycleBalanceBounds.lowerBoundFirings(request);
if (firings.isEmpty()) return null;
BigInteger firingUpper = firings.values().stream().reduce(logicalUpper, BigInteger::max);
BigInteger reserveUpper = this.exactBounds.reserveDomainUpper(request, firingUpper);
return new TrinityRadixSolvedModel(
firings,
TrinityFeasibilityReserveProjection.reduce(request, firings, reserveCaps(request.internalKeys(), reserveUpper),
TrinityFeasibilityReserveProjection.reduce(request, firings, reserveCaps(request, request.internalKeys(), reserveUpper),
this.exactBounds.minimumFirstInternalInput(request).max(request.seedLowerBound())),
TrinityFeasibilityReserveProjection.reduce(request, firings, reserveCaps(this.exactBounds.externalReserveKeys(request), reserveUpper),
TrinityFeasibilityReserveProjection.reduce(request, firings, reserveCaps(request, this.exactBounds.externalReserveKeys(request), reserveUpper),
this.exactBounds.minimumFirstExternalInput(request)));
}

private static Object2ObjectMap<AEKey, BigInteger> reserveCaps(ObjectSet<AEKey> keys, BigInteger cap) {
private Object2ObjectMap<AEKey, BigInteger> reserveCaps(TrinityCycleFeasibilityRequest request, ObjectSet<AEKey> keys, BigInteger cap) {
Object2ObjectLinkedOpenHashMap<AEKey, BigInteger> caps = new Object2ObjectLinkedOpenHashMap<>();
keys.forEach(key -> caps.put(key, cap));
keys.forEach(key -> caps.put(key, this.exactBounds.reserveUpperBound(request, key, cap)));
return caps;
}

Expand All @@ -213,10 +217,14 @@ private TrinityAlgorithmResult<TrinityCycleFeasibilitySolution> solveFirstFeasib
TrinityRadixSolverMetrics metrics = new TrinityRadixSolverMetrics();
TrinityCycleSolveBudget stateBudget = TrinityCycleSolveBudget.limited(MAX_FEASIBILITY_DOMAINS);
BigInteger logicalUpper = this.exactBounds.compactFiringUpper(request);
TrinityRadixModelPass pass = TrinityRadixModelPass.Feasibility.INSTANCE;
TrinityRadixSolvedModel candidate = lowerBoundCandidate(request, control, logicalUpper);
if (candidate != null && verifyExact(request, pass, candidate).successful()) {
return feasibleSolution(candidate, metrics);
}
BigInteger proofUpper = null;
try {
while (true) {
TrinityRadixModelPass pass = TrinityRadixModelPass.Feasibility.INSTANCE;
control.recordSolverModel();
TrinityRadixBuiltModel built = this.modelAssembler.assemble(request, pass, logicalUpper);
TrinityAlgorithmResult<Object2ObjectMap<Variable, BigInteger>> witness = this.objectiveSearch.findFeasible(
Expand All @@ -230,17 +238,7 @@ private TrinityAlgorithmResult<TrinityCycleFeasibilitySolution> solveFirstFeasib
if (!exact.successful()) {
return TrinityAlgorithmResult.failure(exact.diagnostic());
}
return TrinityAlgorithmResult.success(new TrinityCycleFeasibilitySolution(
solved.firings(),
solved.modelSeed(),
solved.externalInputs(),
metrics.passes(),
metrics.nanos(),
true,
TrinityPlanQuality.VERIFIED_FEASIBLE,
FastUtilCollections.mapOf(),
FastUtilCollections.mapOf(),
0));
return feasibleSolution(solved, metrics);
}
if (witness.diagnostic().code() != TrinityPlanningDiagnosticCode.MIP_NO_INTEGER_SOLUTION) {
return TrinityAlgorithmResult.failure(witness.diagnostic());
Expand Down Expand Up @@ -586,7 +584,7 @@ private static TrinityCycleFeasibilitySolution feasibleSolutionValue(
solved.externalInputs(),
metrics.passes(),
metrics.nanos(),
true,
metrics.passes() > 0,
TrinityPlanQuality.VERIFIED_FEASIBLE,
FastUtilCollections.mapOf(),
FastUtilCollections.mapOf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fish_dan_.data_energistics.integration.technology.extendedcrafting.packaged.CombinationCraftingAdapter;
import com.fish_dan_.data_energistics.integration.technology.extendedcrafting.packaged.PoweredTableAdapter;
import com.fish_dan_.data_energistics.integration.technology.extendedcrafting.packaged.QuantumCompressionAdapter;
import com.fish_dan_.data_energistics.integration.technology.extendedcrafting.packaged.QuantumCompressionRecipeRoles;
import com.fish_dan_.data_energistics.integration.technology.extendedcrafting.packaged.TableCrafterAdapter;

/** Real powered and alternator-driven crafting; optional classes load only with their owning mods. */
Expand All @@ -23,6 +24,9 @@ public void register(DataEnergisticsRegistry registry) {
registry.packagedCrafting().register(new AlternatorCrafterAdapter(false));
registry.packagedCrafting().register(new AlternatorCrafterAdapter(true));
registry.packagedCrafting().register(new QuantumCompressionAdapter());
var quantumCompressionRoles = new QuantumCompressionRecipeRoles();
registry.recipeMatching().register(quantumCompressionRoles);
registry.reusableInputs().register(quantumCompressionRoles);
registry.packagedCrafting().register(new PoweredTableAdapter());
}
}
Loading
Loading