1
This commit is contained in:
parent
48a230386f
commit
d3a47ea3d3
|
|
@ -106,7 +106,7 @@ dependencies {
|
||||||
|
|
||||||
|
|
||||||
//mae2
|
//mae2
|
||||||
/* modRuntimeOnly "curse.maven:modern-ae2-additions-1028068:6827727"*/
|
modRuntimeOnly "curse.maven:modern-ae2-additions-1028068:6827727"
|
||||||
modCompileOnly "curse.maven:modern-ae2-additions-1028068:6827727"
|
modCompileOnly "curse.maven:modern-ae2-additions-1028068:6827727"
|
||||||
|
|
||||||
//aea
|
//aea
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,29 @@ public class MixinConditions implements IMixinConfigPlugin {
|
||||||
return true; // 总是加载,在Mixin内部进行运行时检查
|
return true; // 总是加载,在Mixin内部进行运行时检查
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对于CraftingCPUClusterMixin,检查MAE2是否存在
|
||||||
|
if (mixinClassName.contains("CraftingCPUClusterMixin")) {
|
||||||
|
try {
|
||||||
|
// 检查ModList是否已初始化
|
||||||
|
if (net.minecraftforge.fml.ModList.get() == null) {
|
||||||
|
System.out.println("[ExtendedAE_Plus] ModList未初始化,默认应用CraftingCPU Mixin: " + mixinClassName);
|
||||||
|
return true; // 未初始化时默认应用
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean mae2Exists = net.minecraftforge.fml.ModList.get().isLoaded("mae2");
|
||||||
|
boolean shouldApply = !mae2Exists;
|
||||||
|
|
||||||
|
System.out.println("[ExtendedAE_Plus] CraftingCPU Mixin检查: " + mixinClassName +
|
||||||
|
", MAE2存在: " + mae2Exists +
|
||||||
|
", 应用Mixin: " + shouldApply);
|
||||||
|
|
||||||
|
return shouldApply;
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("[ExtendedAE_Plus] ModList检查失败,默认跳过CraftingCPU Mixin: " + mixinClassName);
|
||||||
|
return false; // 出错时默认跳过,避免冲突
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 其他Mixin正常应用
|
// 其他Mixin正常应用
|
||||||
System.out.println("[ExtendedAE_Plus] 加载Mixin: " + mixinClassName);
|
System.out.println("[ExtendedAE_Plus] 加载Mixin: " + mixinClassName);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,36 @@
|
||||||
package com.extendedae_plus.mixin.ae2;
|
package com.extendedae_plus.mixin.ae2;
|
||||||
|
|
||||||
import appeng.blockentity.crafting.CraftingBlockEntity;
|
import appeng.blockentity.crafting.CraftingBlockEntity;
|
||||||
import appeng.blockentity.crafting.CraftingMonitorBlockEntity;
|
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||||
import appeng.me.helpers.MachineSource;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import java.util.List;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(value = CraftingCPUCluster.class, remap = false, priority = 2000)
|
@Mixin(value = CraftingCPUCluster.class, remap = false, priority = 2000)
|
||||||
public abstract class CraftingCPUClusterMixin {
|
public abstract class CraftingCPUClusterMixin {
|
||||||
|
// 1) 提升“单方块线程上限”的常量,避免抛出 IAE 的 IllegalArgumentException
|
||||||
@Shadow private List<CraftingBlockEntity> blockEntities;
|
@ModifyConstant(
|
||||||
@Shadow private List<CraftingMonitorBlockEntity> status;
|
method = "addBlockEntity(Lappeng/blockentity/crafting/CraftingBlockEntity;)V",
|
||||||
@Shadow private MachineSource machineSrc;
|
constant = @Constant(intValue = 16)
|
||||||
@Shadow private long storage;
|
)
|
||||||
@Shadow private int accelerator;
|
private int extendedae_plus$raisePerUnitLimit(int original) {
|
||||||
|
// 放宽到极大值,完全取消单方块 16 线程的硬限制
|
||||||
/**
|
return Integer.MAX_VALUE;
|
||||||
* 完全重写addBlockEntity方法,移除16线程的硬限制
|
}
|
||||||
* @author ExtendedAE_Plus
|
|
||||||
* @reason 移除单方块16线程的硬限制,允许更高的线程数
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
void addBlockEntity(CraftingBlockEntity te) {
|
|
||||||
if (this.machineSrc == null || te.isCoreBlock()) {
|
|
||||||
this.machineSrc = new MachineSource(te);
|
|
||||||
}
|
|
||||||
|
|
||||||
te.setCoreBlock(false);
|
// 2) 保持统计使用原始线程值(若存在多处调用),不再返回固定 16
|
||||||
te.saveChanges();
|
@Redirect(
|
||||||
this.blockEntities.add(0, te);
|
method = "addBlockEntity(Lappeng/blockentity/crafting/CraftingBlockEntity;)V",
|
||||||
|
at = @At(
|
||||||
if (te instanceof CraftingMonitorBlockEntity) {
|
value = "INVOKE",
|
||||||
this.status.add((CraftingMonitorBlockEntity) te);
|
target = "Lappeng/blockentity/crafting/CraftingBlockEntity;getAcceleratorThreads()I",
|
||||||
}
|
ordinal = 1
|
||||||
if (te.getStorageBytes() > 0) {
|
)
|
||||||
this.storage += te.getStorageBytes();
|
)
|
||||||
}
|
private int extendedae_plus$onGetThreadsForLimitCheck(CraftingBlockEntity te) {
|
||||||
if (te.getAcceleratorThreads() > 0) {
|
// 返回原始线程数,确保总并行单元不被错误下限
|
||||||
// 移除原来的16线程限制,直接添加线程数
|
return te.getAcceleratorThreads();
|
||||||
this.accelerator += te.getAcceleratorThreads();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user