feat: 添加无线存储元件的存储种类数量显示;修改名字

This commit is contained in:
C-H716 2025-09-17 15:14:10 +08:00
parent d316c5f039
commit fb8db3693b
4 changed files with 21 additions and 4 deletions

View File

@ -297,6 +297,9 @@ public class InfinityBigIntegerCellInventory implements StorageCell {
} else {
stack.getOrCreateTag().putString("total", totalStored.toString());
}
// 将当前已存储的不同物品种类数缓存到 NBT键名: "types"用于客户端 tooltip 显示
int typesCount = this.getCellStoredMap().size();
stack.getOrCreateTag().putInt("types", typesCount);
}
isPersisted = true;
}

View File

@ -36,7 +36,8 @@ public class InfinityBigIntegerCellItem extends Item {
@Nullable Level world,
@NotNull List<Component> tooltip,
@NotNull TooltipFlag context) {
tooltip.add(Component.translatable("tooltip.extendedae_plus.infinity_biginteger_cell.summon"));
tooltip.add(Component.translatable("tooltip.extendedae_plus.infinity_biginteger_cell.summon1"));
tooltip.add(Component.translatable("tooltip.extendedae_plus.infinity_biginteger_cell.summon2"));
Preconditions.checkArgument(stack.getItem() == this);
// 仅在 ItemStack 自身存在 UUID 时显示 UUID避免触发持久化或加载逻辑
@ -46,6 +47,17 @@ public class InfinityBigIntegerCellItem extends Item {
tooltip.add(
Component.literal("UUID: ").withStyle(ChatFormatting.GRAY).append(Component.literal(uuidStr).withStyle(ChatFormatting.YELLOW))
);
// 读取并显示已缓存的种类数量types表示当前存储了多少种不同的 AEKey
if (tag.contains("types")) {
try {
int types = tag.getInt("types");
tooltip.add(
Component.literal("Types: ").withStyle(ChatFormatting.GRAY).append(Component.literal(String.valueOf(types)).withStyle(ChatFormatting.GREEN))
);
} catch (Exception ignored) {
// ignore malformed value
}
}
// 读取并显示已缓存的 total支持 long string使用格式化函数展示友好单位
if (tag.contains("total")) {
BigInteger total = BigInteger.ZERO;

View File

@ -23,7 +23,8 @@
"item.extendedae_plus.entity_speed_card.x8": "Entity Acceleration Card (x8)",
"item.extendedae_plus.entity_speed_card.x16": "Entity Acceleration Card (x16)",
"item.extendedae_plus.infinity_biginteger_cell": "§cI§6n§ef§ai§bn§di§9t§fy §cS§6t§eo§ar§ba§dg§9e §fC§co§6m§ep§ao§bn§de§9n§ft",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon": "§7Through the sacrifice of nine rare materials, you summon Iava, who bestows upon the summoner an §cI§6n§ef§ai§bn§di§9t§fy §cS§6t§eo§ar§ba§dg§9e §fC§co§6m§ep§ao§bn§de§9n§ft§7 forged from the endless void.",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon1": "§7Through the sacrifice of nine rare materials, you summon Iava, who grants the summoner an §4all-consuming§csilence§6.",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon2": "§b——§4Within §ca §6small §espace§a, §bthere §dare §4a §cthousand §6realms",
"tooltip.extendedae_plus.entity_speed_card.multiplier": "Multiplier: %s",
"tooltip.extendedae_plus.entity_speed_card.max": "Max effective: %s x",

View File

@ -22,8 +22,9 @@
"item.extendedae_plus.entity_speed_card.x4": "实体加速卡 (x4)",
"item.extendedae_plus.entity_speed_card.x8": "实体加速卡 (x8)",
"item.extendedae_plus.entity_speed_card.x16": "实体加速卡 (x16)",
"item.extendedae_plus.infinity_biginteger_cell": "§c无§6限§e存§a储§b元§d件",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon": "§7以九种稀有材料为祭唤出 Iava其将一枚 §c无§6限§e存§a储§b元§d件 §7赐予召唤者源自无尽虚空。",
"item.extendedae_plus.infinity_biginteger_cell": "§4吞§c噬§6万§e物§a的§b寂§d静",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon1": "九重献祭, 终得虚空回响——觐见虚空之主Iava, 赐汝§4吞§c噬§6万§e籁§a的§b寂§d静",
"tooltip.extendedae_plus.infinity_biginteger_cell.summon2": "§b——§4方§c寸§6之§e间§a, §b自§d有§4千§c寰",
"tooltip.extendedae_plus.entity_speed_card.multiplier": "乘数: %s",
"tooltip.extendedae_plus.entity_speed_card.max": "最大生效: %s 倍",