From fb8db3693b1185a7ad0d0369ee0b543e6deea3a3 Mon Sep 17 00:00:00 2001 From: C-H716 <1536152356@qq.com> Date: Wed, 17 Sep 2025 15:14:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=97=A0=E7=BA=BF?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E5=85=83=E4=BB=B6=E7=9A=84=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E7=A7=8D=E7=B1=BB=E6=95=B0=E9=87=8F=E6=98=BE=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/InfinityBigIntegerCellInventory.java | 3 +++ .../ae/items/InfinityBigIntegerCellItem.java | 14 +++++++++++++- .../assets/extendedae_plus/lang/en_us.json | 3 ++- .../assets/extendedae_plus/lang/zh_cn.json | 5 +++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/extendedae_plus/ae/api/storage/InfinityBigIntegerCellInventory.java b/src/main/java/com/extendedae_plus/ae/api/storage/InfinityBigIntegerCellInventory.java index 19273c4..8642326 100644 --- a/src/main/java/com/extendedae_plus/ae/api/storage/InfinityBigIntegerCellInventory.java +++ b/src/main/java/com/extendedae_plus/ae/api/storage/InfinityBigIntegerCellInventory.java @@ -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; } diff --git a/src/main/java/com/extendedae_plus/ae/items/InfinityBigIntegerCellItem.java b/src/main/java/com/extendedae_plus/ae/items/InfinityBigIntegerCellItem.java index 7cfb313..dde5b96 100644 --- a/src/main/java/com/extendedae_plus/ae/items/InfinityBigIntegerCellItem.java +++ b/src/main/java/com/extendedae_plus/ae/items/InfinityBigIntegerCellItem.java @@ -36,7 +36,8 @@ public class InfinityBigIntegerCellItem extends Item { @Nullable Level world, @NotNull List 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; diff --git a/src/main/resources/assets/extendedae_plus/lang/en_us.json b/src/main/resources/assets/extendedae_plus/lang/en_us.json index 8ae2ff7..1245bae 100644 --- a/src/main/resources/assets/extendedae_plus/lang/en_us.json +++ b/src/main/resources/assets/extendedae_plus/lang/en_us.json @@ -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", diff --git a/src/main/resources/assets/extendedae_plus/lang/zh_cn.json b/src/main/resources/assets/extendedae_plus/lang/zh_cn.json index b5f663b..7f94f24 100644 --- a/src/main/resources/assets/extendedae_plus/lang/zh_cn.json +++ b/src/main/resources/assets/extendedae_plus/lang/zh_cn.json @@ -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 倍",