修复检查
This commit is contained in:
parent
476b669472
commit
039fdc3f90
|
|
@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
* 为ME接口增加升级槽数量的Mixin
|
||||
* 兼容Applied Flux模组,避免冲突
|
||||
*/
|
||||
@Mixin(value = InterfaceLogic.class, remap = false, priority = 1500)
|
||||
@Mixin(value = InterfaceLogic.class, remap = false, priority = 1100)
|
||||
public class InterfaceLogicUpgradesMixin {
|
||||
|
||||
@Final
|
||||
|
|
@ -32,22 +32,34 @@ public class InterfaceLogicUpgradesMixin {
|
|||
|
||||
/**
|
||||
* 在InterfaceLogic构造函数末尾注入,增加升级槽数量
|
||||
* 使用高优先级(1500)确保在Applied Flux之后执行
|
||||
* 使用优先级1100确保在Applied Flux之后执行,但不会过度干扰其他组件
|
||||
*/
|
||||
@Inject(
|
||||
method = "<init>(Lappeng/api/networking/IManagedGridNode;Lappeng/helpers/InterfaceLogicHost;Lnet/minecraft/world/item/Item;I)V",
|
||||
at = @At("TAIL")
|
||||
at = @At("TAIL"),
|
||||
require = 0 // 设置为可选注入,避免在某些情况下导致崩溃
|
||||
)
|
||||
private void expandInterfaceUpgrades(IManagedGridNode gridNode, InterfaceLogicHost host, Item is, int slots, CallbackInfo ci) {
|
||||
try {
|
||||
// 添加更多的安全检查
|
||||
if (this.upgrades == null) {
|
||||
System.err.println("[ExtendedAE_Plus] InterfaceLogic upgrades为null,跳过升级槽扩展");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gridNode == null || host == null || is == null) {
|
||||
System.err.println("[ExtendedAE_Plus] InterfaceLogic构造参数为null,跳过升级槽扩展");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("[ExtendedAE_Plus] InterfaceLogic升级槽扩展开始");
|
||||
|
||||
int currentSlots = this.upgrades.size();
|
||||
System.out.println("[ExtendedAE_Plus] 当前升级槽数量: " + currentSlots);
|
||||
|
||||
// 检查Applied Flux是否已经修改了升级槽
|
||||
if (UpgradeSlotCompat.isAppfluxPresent()) {
|
||||
System.out.println("[ExtendedAE_Plus] 检测到Applied Flux存在");
|
||||
// Applied Flux存在,检查当前升级槽数量
|
||||
int currentSlots = this.upgrades.size();
|
||||
System.out.println("[ExtendedAE_Plus] 当前升级槽数量: " + currentSlots);
|
||||
|
||||
if (currentSlots >= 3) {
|
||||
// Applied Flux已经增加了升级槽到3个或更多,我们不需要再修改
|
||||
|
|
@ -57,17 +69,25 @@ public class InterfaceLogicUpgradesMixin {
|
|||
// Applied Flux增加到2个,我们再增加1个到3个
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux增加到2个槽,我们再增加到3个");
|
||||
this.upgrades = UpgradeInventories.forMachine(is, 3, this::onUpgradesChanged);
|
||||
} else {
|
||||
} else if (currentSlots == 1) {
|
||||
// Applied Flux可能还没有生效,我们直接增加到3个
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux可能未生效,直接增加到3个槽");
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux存在但未生效,直接增加到3个槽");
|
||||
this.upgrades = UpgradeInventories.forMachine(is, 3, this::onUpgradesChanged);
|
||||
} else {
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux存在,当前槽数异常: " + currentSlots + ",跳过修改");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux不存在");
|
||||
// Applied Flux不存在,我们将升级槽从1个增加到2个
|
||||
int currentSlots = this.upgrades.size();
|
||||
System.out.println("[ExtendedAE_Plus] 当前升级槽数量: " + currentSlots + ",增加到2个");
|
||||
this.upgrades = UpgradeInventories.forMachine(is, 2, this::onUpgradesChanged);
|
||||
|
||||
if (currentSlots == 1) {
|
||||
// Applied Flux不存在,我们将升级槽从1个增加到2个
|
||||
System.out.println("[ExtendedAE_Plus] 将升级槽从1个增加到2个");
|
||||
this.upgrades = UpgradeInventories.forMachine(is, 2, this::onUpgradesChanged);
|
||||
} else {
|
||||
System.out.println("[ExtendedAE_Plus] Applied Flux不存在,当前槽数异常: " + currentSlots + ",跳过修改");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[ExtendedAE_Plus] InterfaceLogic升级槽扩展完成,最终槽数: " + this.upgrades.size());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user