添加智能倍增在多供应器情况下的轮询支持
This commit is contained in:
parent
be19dce5ab
commit
124c008700
|
|
@ -71,18 +71,27 @@ public abstract class CraftingSimulationStateMixin implements ICraftingSimulatio
|
||||||
if (providerCount <= 0) providerCount = 1;
|
if (providerCount <= 0) providerCount = 1;
|
||||||
|
|
||||||
if (perCraftLimit <= 0) {
|
if (perCraftLimit <= 0) {
|
||||||
// 无限倍率 → 按供应器均分并处理余数
|
// 检查是否开启 provider 轮询分配功能
|
||||||
long base = totalAmount / providerCount;
|
if (ModConfig.INSTANCE.providerRoundRobinEnable) {
|
||||||
long remainder = totalAmount % providerCount;
|
long base = totalAmount / providerCount;
|
||||||
|
long remainder = totalAmount % providerCount;
|
||||||
|
|
||||||
if (remainder > 0) {
|
// base+1 组(数量 remainder 个)
|
||||||
ScaledProcessingPattern scaled_r = PatternScaler.createScaled(processingPattern, base + remainder);
|
if (remainder > 0) {
|
||||||
finalCrafts.put(scaled_r, 1L);
|
ScaledProcessingPattern scaledPlus = PatternScaler.createScaled(processingPattern, base + 1);
|
||||||
ScaledProcessingPattern scaled_b = PatternScaler.createScaled(processingPattern, base);
|
finalCrafts.merge(scaledPlus, remainder, Long::sum);
|
||||||
finalCrafts.put(scaled_b, providerCount - 1);
|
}
|
||||||
|
|
||||||
|
// base 组(数量 providerCount - remainder 个)
|
||||||
|
long countBase = providerCount - remainder;
|
||||||
|
if (countBase > 0) {
|
||||||
|
ScaledProcessingPattern scaledBase = PatternScaler.createScaled(processingPattern, base);
|
||||||
|
finalCrafts.merge(scaledBase, countBase, Long::sum);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ScaledProcessingPattern scaled = PatternScaler.createScaled(processingPattern, base);
|
// 未开启轮询 → 直接分配一次总量
|
||||||
finalCrafts.put(scaled, providerCount);
|
ScaledProcessingPattern scaled = PatternScaler.createScaled(processingPattern, totalAmount);
|
||||||
|
finalCrafts.put(scaled, 1L);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 有限制 → 拆分 full + remainder
|
// 有限制 → 拆分 full + remainder
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user