jade添加无线收发器频道使用数显示
This commit is contained in:
parent
e232fc4e4f
commit
7c0bf38f06
|
|
@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
loom.platform = forge
|
||||
|
||||
# Mod properties
|
||||
mod_version = 1.4.3
|
||||
mod_version = 1.4.4-BETA
|
||||
maven_group = com.extendedae_plus
|
||||
archives_name = extendedae_plus
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,23 @@ public enum WirelessTransceiverJadePluginComponents implements IBlockComponentPr
|
|||
tooltip.add(Component.literal((usable ? "设备在线" : "设备离线")));
|
||||
}
|
||||
}
|
||||
},
|
||||
CHANNELS("wt_channels") {
|
||||
@Override
|
||||
protected void add(BlockAccessor accessor, ITooltip tooltip, IPluginConfig config, CompoundTag data) {
|
||||
if (data.contains("usedChannels") && data.contains("maxChannels")) {
|
||||
int usedChannels = data.getInt("usedChannels");
|
||||
int maxChannels = data.getInt("maxChannels");
|
||||
// 参考AE2的显示方式
|
||||
if (maxChannels <= 0) {
|
||||
// 无限频道或未设置
|
||||
tooltip.add(Component.translatable("extendedae_plus.tooltip.channels", usedChannels));
|
||||
} else {
|
||||
// 显示 "已使用/最大"
|
||||
tooltip.add(Component.translatable("extendedae_plus.tooltip.channels_of", usedChannels, maxChannels));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final ResourceLocation uid;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,28 @@ public enum WirelessTransceiverProvider implements IServerDataProvider<BlockAcce
|
|||
}
|
||||
}
|
||||
data.putBoolean("networkUsable", networkUsable);
|
||||
|
||||
// 添加频道使用信息(参考AE2的 IUsedChannelProvider 实现)
|
||||
int usedChannels = 0;
|
||||
int maxChannels = 0;
|
||||
if (node != null && node.isActive()) {
|
||||
// 遍历该节点的所有连接,取使用频道数的最大值
|
||||
for (var connection : node.getConnections()) {
|
||||
usedChannels = Math.max(connection.getUsedChannels(), usedChannels);
|
||||
}
|
||||
// 获取节点的最大频道容量(致密线缆为32)
|
||||
if (node instanceof appeng.me.GridNode gridNode) {
|
||||
var channelMode = gridNode.getGrid().getPathingService().getChannelMode();
|
||||
if (channelMode == appeng.api.networking.pathing.ChannelMode.INFINITE) {
|
||||
maxChannels = -1; // 无限频道
|
||||
} else {
|
||||
maxChannels = gridNode.getMaxChannels();
|
||||
}
|
||||
}
|
||||
}
|
||||
data.putInt("usedChannels", usedChannels);
|
||||
data.putInt("maxChannels", maxChannels);
|
||||
|
||||
// 如果是从模式,查询主节点位置与维度
|
||||
if (!blockEntity.isMasterMode()) {
|
||||
var level = blockEntity.getServerLevel();
|
||||
|
|
|
|||
|
|
@ -72,9 +72,12 @@
|
|||
"config.jade.plugin_extendedae_plus.wt_master_location": "Show Master Position",
|
||||
"config.jade.plugin_extendedae_plus.wt_locked": "Show Locked State",
|
||||
"config.jade.plugin_extendedae_plus.wt_network_usable": "Show Network Online State",
|
||||
"config.jade.plugin_extendedae_plus.wt_channels": "Show Channel Usage",
|
||||
"extendedae_plus.tooltip.frequency": "Frequency: %d",
|
||||
"extendedae_plus.tooltip.master_mode": "Mode: %s",
|
||||
"extendedae_plus.tooltip.locked": "Locked: %s",
|
||||
"extendedae_plus.tooltip.channels": "Channels: %d",
|
||||
"extendedae_plus.tooltip.channels_of": "Channels: %d / %d",
|
||||
|
||||
"config.screen.extendedae_plus": "ExtendedAE Plus Config",
|
||||
"config.extendedae_plus.option.pageMultiplier": "Pattern Provider Page Multiplier",
|
||||
|
|
|
|||
|
|
@ -73,9 +73,12 @@
|
|||
"config.jade.plugin_extendedae_plus.wt_master_location": "显示主节点位置",
|
||||
"config.jade.plugin_extendedae_plus.wt_locked": "显示锁定状态",
|
||||
"config.jade.plugin_extendedae_plus.wt_network_usable": "显示网络在线状态",
|
||||
"config.jade.plugin_extendedae_plus.wt_channels": "显示频道使用情况",
|
||||
"extendedae_plus.tooltip.frequency": "频率: %d",
|
||||
"extendedae_plus.tooltip.master_mode": "模式: %s",
|
||||
"extendedae_plus.tooltip.locked": "锁定状态: %s",
|
||||
"extendedae_plus.tooltip.channels": "频道: %d",
|
||||
"extendedae_plus.tooltip.channels_of": "频道: %d / %d",
|
||||
|
||||
"config.screen.extendedae_plus": "ExtendedAE Plus 配置",
|
||||
"config.extendedae_plus.option.pageMultiplier": "扩展样板供应器槽位倍率",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user