appliedflux下供应器jade显示

This commit is contained in:
GaLicn 2025-09-25 16:23:25 +08:00
parent 2a4dd481a0
commit 1d4524fb16
4 changed files with 58 additions and 2 deletions

View File

@ -132,7 +132,7 @@ configurations {
dependencies {
// --- Added dependencies for target mods ---
implementation "curse.maven:glodium-957920:5821676"
implementation "org.appliedenergistics:appliedenergistics2:19.2.8"
implementation "org.appliedenergistics:appliedenergistics2:19.2.15"
implementation "org.appliedenergistics:guideme:2.5.1"
// jarJar configuration not set in this build; use implementation for API for now
implementation "de.mari_023:ae2wtlib_api:19.2.0"

View File

@ -47,4 +47,11 @@ public interface InterfaceWirelessLinkBridge {
default void eap$handleDelayedInit() {
// 默认实现为空
}
/**
* 指示是否需要保持慢速tick用于轮询频道卡或维持无线状态
*/
default boolean eap$shouldKeepTicking() {
return false;
}
}

View File

@ -392,6 +392,48 @@ public abstract class PatternProviderLogicCompatMixin implements CompatUpgradePr
}
}
/**
* 指示 PatternProviderLogic Ticker 是否需要保持慢速 tick 以轮询频道卡或维持无线连接
*/
public boolean eap$shouldKeepTicking() {
try {
// 仅在服务端保持tick
if (host.getBlockEntity() == null || host.getBlockEntity().getLevel() == null || host.getBlockEntity().getLevel().isClientSide) {
return false;
}
// 未初始化需要继续tick直到初始化完成
if (!eap$compatHasInitialized) {
return true;
}
// 安装了 AppliedFlux根据连接状态与频道卡存在性决定是否维持慢速tick
if (!UpgradeSlotCompat.shouldEnableUpgradeSlots()) {
// 若曾经设置过频道或者当前存在未连通的链接则保持tick
if (eap$compatLastChannel != 0L) {
return true;
}
if (eap$compatLink != null && !eap$compatLink.isConnected()) {
return true;
}
try {
IUpgradeInventory afUpgrades = eap$getAppliedFluxUpgrades();
if (afUpgrades != null && eap$hasChannelCard(afUpgrades)) {
// 槽中有频道卡保持tick以尽快完成连接
return true;
}
} catch (Throwable ignored) {}
// 否则可以休眠
return false;
}
// 未安装 AppliedFlux当存在频道卡但连接尚未建立时保持tick
if (this.eap$compatUpgrades != null && eap$hasChannelCard(this.eap$compatUpgrades)) {
if (eap$compatLink == null || !eap$compatLink.isConnected()) {
return true;
}
}
} catch (Throwable ignored) {}
return false;
}
// CompatUpgradeProvider 实现仅在未安装 appflux 时由我们提供升级槽
@Unique
private boolean eap$hasChannelCard(IUpgradeInventory inventory) {

View File

@ -32,11 +32,18 @@ public abstract class PatternProviderLogicTickerMixin {
}
}
@Inject(method = "tickingRequest", at = @At("TAIL"))
@Inject(method = "tickingRequest", at = @At("TAIL"), cancellable = true)
private void eap$tickTail(appeng.api.networking.IGridNode node, int ticksSinceLastCall,
CallbackInfoReturnable<appeng.api.networking.ticking.TickRateModulation> cir) {
// 仅在服务端设置慢速 tick
if (node != null && node.getLevel() != null && node.getLevel().isClientSide) {
return;
}
if (this$0 instanceof InterfaceWirelessLinkBridge bridge) {
bridge.eap$updateWirelessLink();
if (bridge.eap$shouldKeepTicking()) {
cir.setReturnValue(appeng.api.networking.ticking.TickRateModulation.SLOWER);
}
}
}
}