添加智能倍增的全局限制
This commit is contained in:
parent
ac2c524fe8
commit
2c40e0800a
|
|
@ -74,8 +74,9 @@ public final class ModConfig {
|
||||||
|
|
||||||
@Configurable
|
@Configurable
|
||||||
@Configurable.Comment(value = {
|
@Configurable.Comment(value = {
|
||||||
"全局智能倍增的最大倍数限制(0 表示不限制)",
|
"全局智能倍增的最大倍率限制(0 表示不限制)",
|
||||||
"此倍数是针对单次样板产出的放大倍数上限,用于限制一次推送中按倍增缩放的规模"
|
"此限制针对单次样板产出的倍增上限,用于控制一次推送的最大缩放规模",
|
||||||
|
"优先级低于样板自身的供应器限制"
|
||||||
})
|
})
|
||||||
@Configurable.Synchronized
|
@Configurable.Synchronized
|
||||||
@Configurable.Range(min = 0, max = Integer.MAX_VALUE)
|
@Configurable.Range(min = 0, max = Integer.MAX_VALUE)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import appeng.crafting.inv.CraftingSimulationState;
|
||||||
import appeng.crafting.pattern.AEProcessingPattern;
|
import appeng.crafting.pattern.AEProcessingPattern;
|
||||||
import com.extendedae_plus.ae.api.crafting.ScaledProcessingPattern;
|
import com.extendedae_plus.ae.api.crafting.ScaledProcessingPattern;
|
||||||
import com.extendedae_plus.api.smartDoubling.ISmartDoublingAwarePattern;
|
import com.extendedae_plus.api.smartDoubling.ISmartDoublingAwarePattern;
|
||||||
|
import com.extendedae_plus.config.ModConfig;
|
||||||
import com.extendedae_plus.util.smartDoubling.PatternScaler;
|
import com.extendedae_plus.util.smartDoubling.PatternScaler;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
@ -30,6 +31,7 @@ public abstract class CraftingSimulationStateMixin {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
if (craftsAmount <= 0 || details == null) return;
|
if (craftsAmount <= 0 || details == null) return;
|
||||||
|
|
||||||
|
// 仅处理 AEProcessingPattern
|
||||||
if (!(details instanceof AEProcessingPattern processingPattern)) {
|
if (!(details instanceof AEProcessingPattern processingPattern)) {
|
||||||
crafts.merge(details, craftsAmount, Long::sum);
|
crafts.merge(details, craftsAmount, Long::sum);
|
||||||
return;
|
return;
|
||||||
|
|
@ -40,15 +42,21 @@ public abstract class CraftingSimulationStateMixin {
|
||||||
|
|
||||||
if (processingPattern instanceof ISmartDoublingAwarePattern aware) {
|
if (processingPattern instanceof ISmartDoublingAwarePattern aware) {
|
||||||
allowScaling = aware.eap$allowScaling();
|
allowScaling = aware.eap$allowScaling();
|
||||||
perCraftLimit = aware.eap$getMultiplierLimit(); // 已经是最大倍率限制
|
perCraftLimit = aware.eap$getMultiplierLimit(); // 样板供应器限制
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不允许缩放或者需求为 1
|
// 样板不允许缩放 或者 需求量为 1 → 直接合并
|
||||||
if (!allowScaling || craftsAmount == 1) {
|
if (!allowScaling || craftsAmount == 1) {
|
||||||
crafts.merge(processingPattern, craftsAmount, Long::sum);
|
crafts.merge(processingPattern, craftsAmount, Long::sum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 样板无限制时应用全局配置
|
||||||
|
if (perCraftLimit <= 0 && ModConfig.INSTANCE.smartScalingMaxMultiplier > 0) {
|
||||||
|
perCraftLimit = ModConfig.INSTANCE.smartScalingMaxMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据限制处理
|
||||||
if (perCraftLimit <= 0) {
|
if (perCraftLimit <= 0) {
|
||||||
// 无限制 → 合并倍率并复用对象
|
// 无限制 → 合并倍率并复用对象
|
||||||
mergeUnlimited(processingPattern, craftsAmount);
|
mergeUnlimited(processingPattern, craftsAmount);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user