fix:默认样板不翻倍,避免导致未进行适配的供应器无法发配材料。去掉对高级ae的样板供应器翻倍支持

This commit is contained in:
C-H716 2025-09-03 20:41:10 +08:00
parent f78fb6e977
commit 6f941ed928
8 changed files with 62 additions and 47 deletions

View File

@ -80,13 +80,14 @@ dependencies {
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
modCompileOnly "curse.maven:applied-flux-965012:${applied_flux_version}"
modCompileOnly "curse.maven:applied-flux-965012:${applied_flux_version}"
modCompileOnly "curse.maven:mega-cells-622112:${mega_cells_version}"
modCompileOnly "curse.maven:jade-324717:${jade_version}"
// GregTech
modCompileOnly "curse.maven:gregtechceu-modern-890405:${gregtech_version}"
modCompileOnly "curse.maven:ldlib-626676:${ldlib_version}"
modCompileOnly files('libs/gtlcore-1.2.2.1-fix5.jar')
//curios
modRuntimeOnly "curse.maven:curios-309927:${curios_version}"

View File

@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
loom.platform = forge
# Mod properties
mod_version = 1.4.1.beta
mod_version = 1.4.1-beta-gtm
maven_group = com.extendedae_plus
archives_name = extendedae_plus
@ -26,7 +26,7 @@ rei_version=12.0.622
cloth_config_version=9.0.94
projecte_version=4901949
appliede_version=5364294
gregtech_version=5369020
gregtech_version=5753724
ldlib_version=5394816
ie_version=5224387
mixin_version=0.8.4

Binary file not shown.

View File

@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.Unique;
@Mixin(value = AEProcessingPattern.class, remap = false)
public class AEProcessingPatternMixin implements SmartDoublingAwarePattern {
@Unique
private boolean eap$allowScaling = true; // 默认允许缩放
private boolean eap$allowScaling = false; // 默认允许缩放
@Override
public boolean eap$allowScaling() {

View File

@ -1,39 +0,0 @@
package com.extendedae_plus.mixin.ae2.autopattern.adaptation;
import appeng.api.crafting.IPatternDetails;
import com.extendedae_plus.content.ScaledProcessingPattern;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.List;
/**适配
* Redirect PatternProviderLogic.pushPattern 中对 List.contains 的调用
* 在遇到缩放样板时回退匹配到原始样板实例
*/
@Pseudo
@Mixin(targets = "net.pedroksl.advanced_ae.common.logic.AdvPatternProviderLogic", remap = false)
public class AdvPatternProviderLogicContainsRedirectMixin {
@Redirect(method = "pushPattern",
at = @At(
value = "INVOKE",
target = "Ljava/util/List;contains(Ljava/lang/Object;)Z")
)
private boolean eap$patternsContains(List<?> list, Object o) {
try {
if (o instanceof ScaledProcessingPattern scaled) {
IPatternDetails base = scaled.getOriginal();
if (base != null && list.indexOf(base) != -1) {
return true;
}
}
// 使用 indexOf 避免再次触发对 List.contains redirect防止递归
return list.indexOf(o) != -1;
} catch (Throwable t) {
return list.indexOf(o) != -1;
}
}
}

View File

@ -1,20 +1,47 @@
package com.extendedae_plus.mixin.ae2.autopattern.gtceu;
import appeng.api.crafting.IPatternDetails;
import appeng.crafting.pattern.AEProcessingPattern;
import com.extendedae_plus.api.SmartDoublingAwarePattern;
import com.extendedae_plus.content.ScaledProcessingPattern;
import com.google.common.collect.BiMap;
import org.gtlcore.gtlcore.common.machine.multiblock.part.ae.MEPatternBufferPartMachine;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.extendedae_plus.util.ExtendedAELogger.LOGGER;
@Pseudo
@Mixin(targets = "org.gtlcore.gtlcore.common.machine.multiblock.part.ae.MEPatternBufferPartMachine",remap = false)
@Mixin(value = MEPatternBufferPartMachine.class, remap = false)
public class GTLCoreMEPatternBufferPartMachineMixin {
@Final
@Shadow
private BiMap<IPatternDetails, Integer> patternSlotMap;
// 设置样板总成是否翻倍
@Inject(method = "getAvailablePatterns", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;toList()Ljava/util/List;", shift = At.Shift.BEFORE))
private void beforeToList(CallbackInfoReturnable<List<IPatternDetails>> cir) {
if (patternSlotMap == null) return;
for (Map.Entry<IPatternDetails, Integer> entry : patternSlotMap.entrySet()) {
IPatternDetails key = entry.getKey();
if (key instanceof AEProcessingPattern proc && proc instanceof SmartDoublingAwarePattern aware) {
aware.eap$setAllowScaling(true);
LOGGER.info("设置true{}", aware);
}
}
}
// 重定向containsKey检查
@Redirect(method = "pushPattern(Lappeng/api/crafting/IPatternDetails;[Lappeng/api/stacks/KeyCounter;)Z",
at = @At(value = "INVOKE", target = "Lcom/google/common/collect/BiMap;containsKey(Ljava/lang/Object;)Z"))

View File

@ -1,20 +1,47 @@
package com.extendedae_plus.mixin.ae2.autopattern.gtceu;
import appeng.api.crafting.IPatternDetails;
import appeng.crafting.pattern.AEProcessingPattern;
import com.extendedae_plus.api.SmartDoublingAwarePattern;
import com.extendedae_plus.content.ScaledProcessingPattern;
import com.google.common.collect.BiMap;
import com.gregtechceu.gtceu.integration.ae2.machine.MEPatternBufferPartMachine;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
;
import static com.extendedae_plus.util.ExtendedAELogger.LOGGER;
@Mixin(targets = "com.gregtechceu.gtceu.integration.ae2.machine.MEPatternBufferPartMachine",remap = false)
@Pseudo
@Mixin(value = MEPatternBufferPartMachine.class, remap = false)
public class MEPatternBufferPartMachineMixin {
@Shadow
@Final
private BiMap<IPatternDetails, Integer> detailsSlotMap;
// 设置样板总成是否翻倍
@Inject(method = "getAvailablePatterns", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;toList()Ljava/util/List;", shift = At.Shift.BEFORE))
private void beforeToList(CallbackInfoReturnable<List<IPatternDetails>> cir) {
if (detailsSlotMap == null) return;
for (Map.Entry<IPatternDetails, Integer> entry : detailsSlotMap.entrySet()) {
IPatternDetails key = entry.getKey();
if (key instanceof AEProcessingPattern proc && proc instanceof SmartDoublingAwarePattern aware) {
aware.eap$setAllowScaling(true);
LOGGER.info("设置true{}", aware);
}
}
}
// 重定向containsKey检查
@Redirect(method = "pushPattern(Lappeng/api/crafting/IPatternDetails;[Lappeng/api/stacks/KeyCounter;)Z",
at = @At(value = "INVOKE", target = "Lcom/google/common/collect/BiMap;containsKey(Ljava/lang/Object;)Z"))

View File

@ -41,7 +41,6 @@
"ae2.autopattern.CraftingTreeNodeMixin",
"ae2.autopattern.CraftingTreeProcessMixin",
"ae2.autopattern.PatternProviderLogicContainsRedirectMixin",
"ae2.autopattern.adaptation.AdvPatternProviderLogicContainsRedirectMixin",
"ae2.autopattern.gtceu.GTLCoreMEPatternBufferPartMachineMixin",
"ae2.autopattern.gtceu.MEPatternBufferPartMachineMixin",
"ae2.helpers.PatternProviderLogicAdvancedMixin",