Eclipse Core Client
Cobblemon Eclipse 网络的客户端配套模组,以及对任何 Cobblemon 服务器均可使用的完整战斗 HUD 重做。
战斗 HUD
- 战斗信息窗口:取代了 Cobblemon 原生的战斗图块:显示名称/等级、HP、属性图标、速度读数、队伍球标签(空闲/濒死/异常/活跃状态),以及点击切换的强化面板。提供六种主题:Eclipse Dark、Ruby Red、Forest Green、Rose Pink、Pearl White、Solar Yellow。在双打和团队副本中,窗口会切换为紧凑的折叠框架。
- 重绘的战斗菜单:攻击/背包/切换/逃跑/投降图块、招式图块、切换入场和目标选择器,以及返回/特性/切换按钮均与 HUD 主题匹配。一个开关可恢复为 Cobblemon 原生外观。
- 战斗日志:可移动和调整大小,按事件类型着色(伤害、治疗、暴击、濒死、切换、状态、场地/团队副本事件),支持悬停检查行,标题栏带有主题选择器,可为整个战斗界面重新着色。当你选择招式目标或切换宝可梦时,它会自动退让。
- 侧方队伍列表:可拖动的双列网格,带有闪光/光辉图标和悬停信息。
- 团队副本首领框:专用的首领窗口,包含超大肖像、内置护盾条,以及护盾阶段之间的首领速度范围。
- 招式工具提示包含次要效果、伤害范围、效果/场地持续时间追踪、可悬停的易变状态图标、浮动伤害数字等。
所有内容均可通过 ModMenu + Cloth Config 在游戏内配置。
视觉重做适用于任何 Cobblemon 服务器。在 Cobblemon Eclipse 网络中,服务端 eclipse-core 模组额外驱动实时数据:速度读数、伤害范围、已揭示的招式/物品/特性,以及敌方队伍列表。
多人团队副本
- 多人团队副本支持:1-4 名玩家合作挑战单个强大首领(与服务端 eclipse-raids-4v1 模组配合使用)
- 目标系统覆盖:在非标准战斗格式中进行正确的目标选择
- 战斗阵营组织:盟友和敌人正确显示在对应的侧边
- 团队副本 HUD 与音乐:助威 UI、团队副本 HUD、循环播放的团队副本音乐,可通过
/raidmusic 命令切换
其他包含内容
- 双打/三打特性修复:防止在同一回合内多次使用相同的战斗特性(超级进化、太晶化、Z招式、超极巨化)
- 外观与名字标签渲染:帽子、披风、粒子效果以及从 Eclipse 服务器同步的自定义头顶名字标签
- Bobby 区块内存修复:区块驱逐和内存压力监控,确保长时间运行 Bobby 时不会泄漏 RAM
依赖要求
- Minecraft 1.21.1
- Fabric Loader 0.16.5+
- Fabric API
- Fabric Language Kotlin
- Cobblemon 1.7.3+
安装方法
- 下载并将其放入客户端的
mods 文件夹中。
- 此模组仅限客户端。它通过自定义数据包与 Eclipse 服务端模组通信,并在其他服务器上保持静默。
面向模组开发者
有兴趣为 Cobblemon 创建自己的团队副本或多战斗模组吗?以下是你需要了解的内容:
核心挑战
Cobblemon 的战斗系统设计用于 1v1 和 2v2 格式。要创建团队副本(4v1、3v1 等),你需要解决以下几个问题:
- 战斗创建 - 你如何在一侧拥有 4 名玩家的情况下启动战斗?
- 目标选择 - 当相邻规则禁止时,玩家如何针对单一首领进行攻击?
- 阵营显示 - 当客户端期望标准格式时,你如何正确显示盟友?
- Showdown 兼容性 - 你如何让 Showdown 接受非标准的队伍配置?
服务端:启动多人战斗
查看 Cobblemon 的 BattleBuilder 和 BattleRegistry。关键类包括:
BattleBuilder - 使用参与者 (actors) 和格式创建战斗
BattleActor - 代表参与者(玩家或 NPC)
BattleFormat - 定义战斗规则(单打、双打等)
PokemonBattle - 活跃的战斗实例
对于团队副本,你需要在一侧拥有多个 BattleActor 实例。研究 Cobblemon 如何处理双打——这是多人的基础。
Showdown 层
Cobblemon 使用 Pokemon Showdown 进行战斗逻辑。战斗通过以下方式创建:
BattleRegistry.startBattle(format, side1Actors, side2Actors)
Showdown 接收的队数据作为“打包字符串”(pack strings)——即宝可梦的紧凑表示。该格式记录在 Showdown 的源代码中。关键洞察:Showdown 的 fPokemon 格式包括物种、等级、招式、特性等。
对于团队副本首领,请考虑:
- 你如何赋予宝可梦更高的有效生命值?
- 你如何允许一只宝可梦承受来自多个攻击者的打击?
- 当 Showdown 计算对“缩放”目标的伤害时会发生什么?
客户端:目标选择问题
在标准双打中,宝可梦只能攻击相邻的槽位。在 4v1 团队副本中,所有玩家都需要攻击单一的首领。
客户端使用 ActiveClientBattlePokemon.getAdjacent() 来确定有效目标。此方法检查位置并根据战斗格式返回有效目标。
Eclipse Core Client 通过以下方式解决此问题:
- 拦截目标请求
- 覆盖团队副本格式中的相邻计算
- 通过自定义数据包通信团队副本配置
数据包通信
Fabric 网络允许服务器和客户端之间发送自定义数据包:
// 服务端:注册并发送
PayloadTypeRegistry.playS2C().register(...)
ServerPlayNetworking.send(player, payload)
// 客户端:注册接收器
ClientPlayNetworking.registerGlobalReceiver(...)
你的数据包应告知客户端:
- 这是一个团队副本战斗吗?
- 有多少玩家参与?
- 首领在哪一侧?
客户端需要在战斗 UI 渲染之前获取这些信息,以正确组织阵营。
Showdown 修改(高级)
Cobblemon 将 Showdown 提取至 ./showdown/。sim/ 中的 JavaScript 文件控制战斗机制:
battle.js - 主战斗循环和回合处理
pokemon.js - 宝可梦状态、HP 和 PP 管理
side.js - 阵营管理和槽位处理
battle-actions.js - 招式执行和伤害计算
对于团本机制,你可能需要修改以下方面的逻辑:
- 对首领造成的伤害计算方式
- PP 的追踪(首领是否拥有无限 PP?)
- 多目标招式的结算
- 首领针对多个目标采取行动的逻辑
将其 Mixin 到 GraalShowdownUnbundler.attemptUnbundle() 中,以便在提取后修补文件。
Mixin 目标参考
客户端(用于修复目标选择和显示):
ActiveClientBattlePokemon - 目标选择和相邻判定
BattleMoveSelection - 招式选择 UI
ClientBattle - 阵营组织
服务端(用于创建战斗):
BattleBuilder - 战斗初始化
BattleActor - 实体行为
NPCBattleActor - NPC 特定逻辑
快速开始
- 创建一个启动双打对战的基础服务器模组
- 向其中一方添加第三名玩家 - 观察哪些功能会出错
- 研究错误日志以理解限制条件
- 逐层实施修复(Showdown → 服务端 → 客户端)
从“双打可用”到“4v1 团本可用”的过程将让你彻底掌握 Cobblemon 的战斗系统。
Eclipse Packet Protocol
希望你的服务器模组能与 Eclipse Core Client 配合工作?请实现以下数据包:
数据包 1:客户端握手(客户端 → 服务端)
通道: eclipse_raids:client_handshake
当安装了 Eclipse Core Client 的玩家加入你的服务器时,他们会发送此数据包。
| 字段 |
类型 |
描述 |
| protocolVersion |
Int |
客户端协议版本(当前为 2) |
Kotlin 编解码器:
buf.writeInt(protocolVersion)
// 读取: buf.readInt()
利用此数据包追踪哪些玩家已安装客户端模组。阻止未安装该模组的玩家参与团本。
数据包 2:握手确认(服务端 → 客户端)
通道: eclipse_raids:handshake_ack
将此数据包发送回去以确认客户端已被识别。
| 字段 |
类型 |
描述 |
| raidsEnabled |
Boolean |
该服务器上是否启用了团本 |
| message |
String |
状态消息(显示在客户端日志中) |
Kotlin 编解码器:
buf.writeBoolean(raidsEnabled)
buf.writeString(message)
数据包 3:团本阵营配置(服务端 → 客户端)
通道: eclipse_raids:raid_side_config
这是关键的数据包。 在启动团本战斗后发送此数据包,告知客户端哪些实体是盟友,哪些是敌人。
| 字段 |
类型 |
描述 |
| battleId |
UUID |
来自 PokemonBattle.battleId 的战斗 UUID |
| allyShowdownIds |
List<String> |
玩家方的 Showdown ID(例如 ["p1", "p3", "p5", "p7"]) |
| enemyShowdownIds |
List<String> |
首领方的 Showdown ID(例如 ["p2"]) |
Kotlin 编解码器:
// 写入
buf.writeUuid(battleId)
buf.writeInt(allyShowdownIds.size)
allyShowdownIds.forEach { buf.writeString(it) }
buf.writeInt(enemyShowdownIds.size)
enemyShowdownIds.forEach { buf.writeString(it) }
// 读取
val battleId = buf.readUuid()
val allyCount = buf.readInt()
val allyIds = (0 until allyCount).map { buf.readString() }
val enemyCount = buf.readInt()
val enemyIds = (0 until enemyCount).map { buf.readString() }
Showdown ID 命名约定
Showdown 根据战斗位置分配 ID:
- p1, p3, p5, p7 - 奇数代表一方(用于玩家)
- p2, p4, p6, p8 - 偶数代表另一方(用于首领)
在 4v1 团战中:
- 玩家 1 → p1
- 玩家 2 → p3
- 玩家 3 → p5
- 玩家 4 → p7
- 首领 → p2
何时发送 RaidSideConfig
时机至关重要。 请在以下时间点发送数据包:
- 在
BattleRegistry.startBattle() 返回之后
- 在 玩家打开战斗 UI 之前(他们大约有 1-2 秒的时间)
建议:立即发送,然后在 3 秒(60 tick)后再次发送作为安全网,以防客户端尚未准备好。
// 战斗开始后立即发送
for (player in players) {
ServerPlayNetworking.send(player, RaidSideConfigPayload(battle.battleId, allyIds, enemyIds))
}
// 安全网 - 3 秒后重新发送
Scheduler.schedule(60) {
for (player in players) {
ServerPlayNetworking.send(player, RaidSideConfigPayload(battle.battleId, allyIds, enemyIds))
}
}
客户端的处理逻辑
当 Eclipse Core Client 收到 RaidSideConfigPayload 时:
- 查找与
battleId 匹配的活跃 ClientBattle
- 收集双方所有的
ClientBattleActor
- 重新组织它们:盟友 →
side1,敌人 → side2
- 设置
isInRaidBattle = true(启用目标选择覆盖)
这可以修复以下问题:
- 宝可梦出现在错误的视觉侧
- 玩家无法选择首领(相邻判定覆盖生效)
Payload 类(Fabric 1.21.1)
// 在你的模组初始化器中注册
PayloadTypeRegistry.playC2S().register(ClientHandshakePayload.ID, ClientHandshakePayload.CODEC)
PayloadTypeRegistry.playS2C().register(HandshakeAckPayload.ID, HandshakeAckPayload.CODEC)
PayloadTypeRegistry.playS2C().register(RaidSideConfigPayload.ID, RaidSideConfigPayload.CODEC)
// 处理传入的握手请求
ServerPlayNetworking.registerGlobalReceiver(ClientHandshakePayload.ID) { payload, context ->
val player = context.player()
// 追踪该玩家已拥有客户端模组
// 发送确认回复
}
没有此客户端模组的情况
如果玩家没有安装 Eclipse Core Client:
- 正常的 1v1 和 2v2 对战可以正常工作
- 团本对战将出现目标选择故障(玩家无法选择首领)
- 宝可梦可能在视觉上出现在错误的阵营侧
通过检查握手追踪结果,阻止未安装客户端模组的玩家参与团本。
兼容性
本模组旨在与实现 Eclipse 数据包协议的服务器端突袭模组配合使用。若无兼容的服务器端模组,它将作为双打/三打对战的一种被动小改进功能。
支持
本模组按原样提供,用于与兼容的 Eclipse 服务器模组搭配使用。
Cobblemon Eclipse 由我们的团队设计、指导、平衡和运营。所有功能及其行为均由我们创作和决定,随后在该指导下借助 AI 辅助构建,并在发布前于我们的在线网络中进行测试。根据 Modrinth 的 AI 政策,本项目已启用“包含 AI 生成内容”披露(代码)。
Eclipse Core Client
The client-side companion mod for the Cobblemon Eclipse network, and a full battle HUD overhaul that works on any Cobblemon server.
Battle HUD
- Battle info windows replace Cobblemon's stock battle tiles: name/level, HP, type icons, a speed readout, a party ball tab (idle / fainted / statused / active states), and a click-to-toggle stat-boost panel. Six themes: Eclipse Dark, Ruby Red, Forest Green, Rose Pink, Pearl White, Solar Yellow. In doubles and for raid allies the windows switch to a compact condensed frame.
- Reskinned battle menu: Fight/Bag/Switch/Run/Forfeit tiles, move tiles, switch-in and target pickers, and the back/gimmick/shift buttons all match the HUD theme. One toggle reverts to the stock Cobblemon look.
- Battle log: movable and resizable, color-coded by event type (damage, heals, crits, faints, switches, statuses, field/raid events), with hover-inspectable rows and a theme picker on the header that recolors the whole battle UI. It steps aside while you pick a move target or a switch-in.
- Side party rosters: draggable 2-wide grids with shiny/radiant icons and hover info.
- Raid boss frame: a dedicated boss window with an oversized portrait, a built-in shield gauge, and the boss's speed range between shield phases.
- Move tooltips with secondary effects, damage ranges, effect/field duration tracking, hoverable volatile-status icons, floating damage numbers, and more.
Everything is configurable in-game via ModMenu + Cloth Config.
The visual overhaul works on any Cobblemon server. On the Cobblemon Eclipse network, the server-side eclipse-core mod additionally drives live data: speed readouts, damage ranges, revealed moves/items/abilities, and the foe party roster.
Multi-Player Raids
- Multi-Player Raid Support: 1-4 player cooperative battles against a single powerful boss (pairs with the server-side eclipse-raids-4v1 mod)
- Targeting System Override: proper target selection in non-standard battle formats
- Battle Side Organization: allies and enemies shown on the correct side
- Raid HUD & music: cheer UI, raid HUD, looping raid music with a
/raidmusic toggle
Also included
- Doubles/Triples Gimmick Fix: prevents using the same battle gimmick (Mega Evolution, Terastallization, Z-Moves, Dynamax) multiple times in a single turn
- Cosmetics & nametag rendering: hats, capes, particle effects, and custom overhead nametags synced from the Eclipse server
- Bobby chunk-memory fixes: chunk eviction and memory-pressure monitoring so long sessions with Bobby don't leak RAM
Requirements
- Minecraft 1.21.1
- Fabric Loader 0.16.5+
- Fabric API
- Fabric Language Kotlin
- Cobblemon 1.7.3+
Installation
- Download and place in your client's
mods folder.
- This mod is client-side only. It talks to the Eclipse server mods via custom packets and stays quiet on other servers.
For Mod Developers
Interested in creating your own raid or multi-battle mod for Cobblemon? Here's what you need to know:
The Core Challenge
Cobblemon's battle system is designed for 1v1 and 2v2 formats. To create raids (4v1, 3v1, etc.), you need to solve several problems:
- Battle Creation - How do you start a battle with 4 players on one side?
- Targeting - How do players target the single boss when adjacency rules say they can't?
- Side Display - How do you show allies correctly when the client expects standard formats?
- Showdown Compatibility - How do you make Showdown accept non-standard team configurations?
Server-Side: Starting Multi-Player Battles
Look at Cobblemon's BattleBuilder and BattleRegistry. Key classes:
BattleBuilder - Creates battles with actors and format
BattleActor - Represents a participant (player or NPC)
BattleFormat - Defines the battle rules (singles, doubles, etc.)
PokemonBattle - The active battle instance
For raids, you'll need multiple BattleActor instances on one side. Study how Cobblemon handles doubles - it's the foundation for multi-player.
The Showdown Layer
Cobblemon uses Pokemon Showdown for battle logic. Battles are created via:
BattleRegistry.startBattle(format, side1Actors, side2Actors)
Showdown receives team data as "pack strings" - compact representations of Pokemon. The format is documented in Showdown's source. Key insight: Showdown's fPokemon format includes species, level, moves, ability, etc.
For raid bosses, consider:
- How would you give a Pokemon more effective HP?
- How would you let one Pokemon take hits from multiple attackers?
- What happens when Showdown calculates damage against a "scaled" target?
Client-Side: The Targeting Problem
In standard doubles, Pokemon can only target adjacent slots. In a 4v1 raid, ALL players need to target the single boss.
The client uses ActiveClientBattlePokemon.getAdjacent() to determine valid targets. This method checks positions and returns valid targets based on battle format.
Eclipse Core Client solves this by:
- Intercepting target requests
- Overriding adjacency calculations for raid formats
- Communicating raid configuration via custom packets
Packet Communication
Fabric networking allows custom packets between server and client:
// Server-side: Register and send
PayloadTypeRegistry.playS2C().register(...)
ServerPlayNetworking.send(player, payload)
// Client-side: Register receiver
ClientPlayNetworking.registerGlobalReceiver(...)
Your packet should tell the client:
- Is this a raid battle?
- How many players are participating?
- Which side is the boss on?
The client needs this info BEFORE the battle UI renders to correctly organize sides.
Showdown Modifications (Advanced)
Cobblemon extracts Showdown to ./showdown/. The JavaScript files in sim/ control battle mechanics:
battle.js - Main battle loop and turn handling
pokemon.js - Pokemon state, HP, PP management
side.js - Side management and slot handling
battle-actions.js - Move execution and damage
For raid mechanics, you might need to modify how:
- Damage is calculated against the boss
- PP is tracked (infinite PP for bosses?)
- Multi-target moves resolve
- The boss takes actions against multiple targets
Mixin into GraalShowdownUnbundler.attemptUnbundle() to patch files after extraction.
Mixin Targets Reference
Client-side (for targeting/display fixes):
ActiveClientBattlePokemon - Target selection and adjacency
BattleMoveSelection - Move selection UI
ClientBattle - Side organization
Server-side (for battle creation):
BattleBuilder - Battle initialization
BattleActor - Actor behavior
NPCBattleActor - NPC-specific logic
Getting Started
- Create a basic server mod that starts a doubles battle
- Add a third player to one side - observe what breaks
- Study the errors to understand the constraints
- Implement fixes one layer at a time (Showdown → Server → Client)
The journey from "doubles work" to "4v1 raids work" will teach you everything about Cobblemon's battle system.
Eclipse Packet Protocol
Want your server mod to work with Eclipse Core Client? Implement these packets:
Packet 1: Client Handshake (Client → Server)
Channel: eclipse_raids:client_handshake
When a player with Eclipse Core Client joins your server, they send this packet.
| Field |
Type |
Description |
| protocolVersion |
Int |
Client protocol version (currently 2) |
Kotlin Codec:
buf.writeInt(protocolVersion)
// Read: buf.readInt()
Use this to track which players have the client mod installed. Block raid participation for players without it.
Packet 2: Handshake Acknowledgment (Server → Client)
Channel: eclipse_raids:handshake_ack
Send this back to confirm the client is recognized.
| Field |
Type |
Description |
| raidsEnabled |
Boolean |
Whether raids are enabled on this server |
| message |
String |
Status message (shown in client logs) |
Kotlin Codec:
buf.writeBoolean(raidsEnabled)
buf.writeString(message)
Packet 3: Raid Side Configuration (Server → Client)
Channel: eclipse_raids:raid_side_config
This is the critical packet. Send this after starting a raid battle to tell the client which actors are allies vs enemies.
| Field |
Type |
Description |
| battleId |
UUID |
The battle's UUID from PokemonBattle.battleId |
| allyShowdownIds |
List<String> |
Showdown IDs for player side (e.g., ["p1", "p3", "p5", "p7"]) |
| enemyShowdownIds |
List<String> |
Showdown IDs for boss side (e.g., ["p2"]) |
Kotlin Codec:
// Write
buf.writeUuid(battleId)
buf.writeInt(allyShowdownIds.size)
allyShowdownIds.forEach { buf.writeString(it) }
buf.writeInt(enemyShowdownIds.size)
enemyShowdownIds.forEach { buf.writeString(it) }
// Read
val battleId = buf.readUuid()
val allyCount = buf.readInt()
val allyIds = (0 until allyCount).map { buf.readString() }
val enemyCount = buf.readInt()
val enemyIds = (0 until enemyCount).map { buf.readString() }
Showdown ID Convention
Showdown assigns IDs based on battle position:
- p1, p3, p5, p7 - Odd numbers for one side (use for players)
- p2, p4, p6, p8 - Even numbers for opposite side (use for boss)
In a 4v1 raid:
- Player 1 → p1
- Player 2 → p3
- Player 3 → p5
- Player 4 → p7
- Boss → p2
When to Send RaidSideConfig
Timing is critical. Send the packet:
- After
BattleRegistry.startBattle() returns
- Before the player opens the battle UI (they have ~1-2 seconds)
Recommended: Send immediately, then send again after 3 seconds (60 ticks) as a safety net in case the client wasn't ready.
// Immediately after battle starts
for (player in players) {
ServerPlayNetworking.send(player, RaidSideConfigPayload(battle.battleId, allyIds, enemyIds))
}
// Safety net - resend after 3 seconds
Scheduler.schedule(60) {
for (player in players) {
ServerPlayNetworking.send(player, RaidSideConfigPayload(battle.battleId, allyIds, enemyIds))
}
}
What the Client Does
When Eclipse Core Client receives RaidSideConfigPayload:
- Finds the active
ClientBattle matching battleId
- Collects all
ClientBattleActor from both sides
- Reorganizes them: allies →
side1, enemies → side2
- Sets
isInRaidBattle = true (enables targeting override)
This fixes:
- Pokemon appearing on wrong visual side
- Players unable to target the boss (adjacency override kicks in)
Payload Classes (Fabric 1.21.1)
// Register in your mod initializer
PayloadTypeRegistry.playC2S().register(ClientHandshakePayload.ID, ClientHandshakePayload.CODEC)
PayloadTypeRegistry.playS2C().register(HandshakeAckPayload.ID, HandshakeAckPayload.CODEC)
PayloadTypeRegistry.playS2C().register(RaidSideConfigPayload.ID, RaidSideConfigPayload.CODEC)
// Handle incoming handshakes
ServerPlayNetworking.registerGlobalReceiver(ClientHandshakePayload.ID) { payload, context ->
val player = context.player()
// Track that this player has the client mod
// Send acknowledgment back
}
Without This Client Mod
If a player doesn't have Eclipse Core Client:
- Normal 1v1 and 2v2 battles work fine
- Raid battles will have broken targeting (players can't select the boss)
- Pokemon may appear on wrong sides visually
Block raid participation for players without the client mod by checking your handshake tracking.
Compatibility
This mod is designed to work with server-side raid mods that implement the Eclipse packet protocol. Without a compatible server mod, it functions as a passive gimmick fix for doubles/triples battles.
Support
This mod is provided as-is for use with compatible Eclipse server mods.
Cobblemon Eclipse is designed, directed, balanced, and operated by our team. Every feature and its behavior is authored and decided by us, then built with AI assistance under that direction and tested on our live network before release. Per Modrinth's AI policy, this project has the "Contains AI-generated content" disclosure enabled (code).
评论 0
登录后参与评分
还没有评论,来抢沙发吧