diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/util/BoardSyncManager.java b/src/main/java/com/github/zly2006/carpetslsaddition/util/BoardSyncManager.java index eae74d0..cbba629 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/util/BoardSyncManager.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/util/BoardSyncManager.java @@ -31,11 +31,14 @@ public final class BoardSyncManager { /** 排行榜最多显示条目数。 */ public static final int TOP_N = 10; - /** 读取某玩家的挖掘总数(遍历所有方块的 BLOCK_MINED 累加)。 */ + /** 读取某玩家的挖掘总数(遍历该玩家的 stats,累加 BLOCK_MINED 类型条目)。 */ private static int totalMined(ServerStatsCounter counter) { int sum = 0; - for (Block block : BuiltInRegistries.BLOCK) { - sum += counter.getValue(Stats.BLOCK_MINED, block); + for (var entry : counter.stats.object2IntEntrySet()) { + Stat stat = entry.getKey(); + if (stat.getType() == Stats.BLOCK_MINED) { + sum += entry.getIntValue(); + } } return sum; } diff --git a/src/main/resources/slsa.accesswidener b/src/main/resources/slsa.accesswidener index 4e8cbad..348f032 100644 --- a/src/main/resources/slsa.accesswidener +++ b/src/main/resources/slsa.accesswidener @@ -1,6 +1,7 @@ -accessWidener v1 official - -accessible class net/minecraft/world/entity/monster/EnderMan$EndermanTakeBlockGoal -accessible method net/minecraft/world/entity/Entity unsetRemoved ()V -accessible field net/minecraft/world/entity/Entity entityData Lnet/minecraft/network/syncher/SynchedEntityData; -accessible field net/minecraft/world/entity/Avatar DATA_PLAYER_MODE_CUSTOMISATION Lnet/minecraft/network/syncher/EntityDataAccessor; \ No newline at end of file +accessWidener v1 official + +accessible class net/minecraft/world/entity/monster/EnderMan$EndermanTakeBlockGoal +accessible method net/minecraft/world/entity/Entity unsetRemoved ()V +accessible field net/minecraft/world/entity/Entity entityData Lnet/minecraft/network/syncher/SynchedEntityData; +accessible field net/minecraft/world/entity/Avatar DATA_PLAYER_MODE_CUSTOMISATION Lnet/minecraft/network/syncher/EntityDataAccessor; +accessible field net/minecraft/stats/StatsCounter stats Lit/unimi/dsi/fastutil/objects/Object2IntMap; \ No newline at end of file