Create: Deep Seas - Lava Fix
一个针对 Minecraft 1.21.1 的小型 NeoForge 模组,用于修复 Create: Deep Seas
(CDS) 中的一个 bug:当潜水艇浸没在熔岩中时,尽管 CDS 正确地排空了内部所有的熔岩,但身处密闭潜水艇内的玩家仍会受到火焰/熔岩伤害。
> 作者: Diyksfol
> 许可协议: MIT
> 注意: 本模组的开发借助了 AI 助手;我的主要角色是测试者和指导者。完整源代码已提供 此处,任何人——包括 Create: Deep Seas 的作者——都可以研究、复用或整合它。
修复内容
在 Create: Deep Seas 中,密封的潜水艇可以排出其内部的所有流体(包括熔岩),让你像在开放空气中一样在其中移动。然而,游戏的伤害代码仍然会对站在该“排空”空间内的玩家施加火焰/熔岩伤害,因为伤害检查未考虑到潜水艇处于密封状态。
此模组检测玩家是否位于(或正在爬出)密封舱室内,并在该情况下抑制火焰/熔岩伤害以及屏幕上的火焰叠加效果。
具体修复项
- 身处密封且浸没于熔岩中的潜水艇内时的火焰/熔岩伤害。
- 身处熔岩表面的舱门/门口(进出时)受到的伤害。
- 在潜水艇内就座(Create 座椅)、攀爬梯子或身处门口时受到的伤害。
- 船体被破坏后重新密封导致的无尽火焰刻(fire ticks)。
- 身处潜水艇内时持续的火焰叠加效果(屏幕底部的火焰)。
未修复内容及其原因
以下行为属于 Create: Deep Seas 的内部机制。从外部模组修复它们需要覆盖 CDS 的核心系统,并可能导致密封潜水艇机制本身失效,因此有意不予处理:
- 潜水艇内仍可见熔岩表面纹理。 CDS 在视觉上隐藏了水的表面,但未隐藏熔岩。这是 CDS 渲染方面的问题。
- 当潜水艇内部低于熔岩/水位时,活板门无法作为可攀爬的“梯子”。 CDS 隐藏了流体,而原版活板门攀爬机制依赖于流体的存在,因此攀爬功能被禁用。CDS 中在水中也会产生相同的效果。
- 玩家在潜水艇内放置的火会产生类似流体的效果。 站在火中会施加缓慢效果,且在熔岩上会燃烧。这是 CDS 的交互机制。
- 直接在潜水艇内倾倒熔岩或水不会造成伤害/窒息。 这是 CDS 的一项故意特性(内部被视为密封状态),而非 bug。
- 潜水艇内的生物和动物仍会受到火焰/熔岩伤害。 此修复仅保护玩家。其他实体不在保护范围内——请勿将动物或被动生物保留在浸没于熔岩的潜水艇内。
- 压力系统在熔岩下不起作用。
如果 Create: Deep Seas 的作者希望解决上述任何问题,欢迎使用此代码作为起点。
安装方法(玩家)
- 为 Minecraft 1.21.1 安装 NeoForge。
- 安装 Create: Deep Seas
及其依赖项(Create、Sable 等)。
- 将
submarinefix-1.0.1.jar 放入你的 mods/ 文件夹。
- 启动游戏。完成。
即使没有安装 Create: Deep Seas,此模组也可以安全安装——在这种情况下它什么都不做。
从源码构建(开发者)
此仓库包含未编译的源代码。若要自行构建 jar 文件:
前置条件
- JDK 21
- Create: Deep Seas jar 文件和捆绑的 Sable Companion jar(用作仅编译引用——它们不在此处重新分发)。
步骤
-
克隆此仓库:
-
在项目根目录创建一个 libs/ 文件夹,并将两个 jar 放入其中:
create_submarine-2.1.6.jar —— 来自你的 Create: Deep Seas 下载。
sable-companion-common-1.21.1-1.5.0.jar —— 从 CDS jar 的
META-INF/jarjar/ 文件夹中提取(CDS 将其捆绑)。
你的 build.gradle 已通过 compileOnly files(...) 引用这些文件:
compileOnly files('libs/create_submarine-2.1.6.jar')
compileOnly files('libs/sable-companion-common-1.21.1-1.5.0.jar')
如果你的 CDS 版本不同,请相应更新 build.gradle 中的文件名。
-
构建:
./gradlew build
在 Windows 上:
.\gradlew.bat build
-
编译后的 jar 文件将位于 build/libs/ 中。
> 这些 jar 文件是第三方软件,有意不包含在此
> 仓库中。你必须从你自己的 Create: Deep Seas 安装中自行提供它们。
工作原理(技术概述)
该修复结合了多个层级:
LivingIncomingDamageEvent(服务器端,主要): 当玩家位于密封舱室内时,取消传入的
LAVA / IN_FIRE / ON_FIRE / HOT_FLOOR 伤害。
Entity#baseTick mixin(服务器端): 抑制 lavaHurt() 调用。
LocalPlayer#baseTick mixin(客户端): 抑制客户端侧的
lavaHurt(),从而不在本地产生火焰刻。
ScreenEffectRenderer#renderFire mixin(客户端): 在潜水艇内隐藏火焰叠加效果。
PlayerTickEvent.Post(服务器端): 每个刻清除任何残留的火焰刻。
检测逻辑
为了判断玩家是否“位于密封潜水艇内”,此模组:
- 通过
CompartmentTracker.getSubsSnapshot() 遍历已注册的潜艇。
- 拒绝那些世界空间 AABB(
getWorldAABB)不包含玩家的潜艇。
- 通过
subLevelAccess.logicalPose().transformPositionInverse(...) 将玩家的世界坐标转换为潜艇的局部空间坐标。
- 检查所得方块是否位于
CompartmentTracker.getCompartments(uuid) 中每个密封 Component 的 internal() 和 hull() 集合内。
- 检查双脚和眼睛的位置(以覆盖坐在座位上、攀爬梯子以及站在门口的玩家),并且——当玩家在可攀爬物体上时——额外进行垂直扫描,以覆盖延伸至船体上方的竖井式梯子。
此逻辑与 CDS 内部使用的逻辑一致,但避免了仅能在潜艇层级内部调用时才有效的 CDS 公共方法。
兼容性
- Minecraft: 1.21.1
- 加载器: NeoForge 21.1+
- 依赖项: Create: Deep Seas(可选依赖;若无此模组则功能失效)
如果你发现与其他模组的兼容性问题,请提交 Issue。
许可证
本代码基于 MIT License 发布。你可以自由地使用、复制、修改和重新分发本代码,包括用于其他项目或模组中,前提是保留原始署名。完整文本请参阅 LICENSE。
欢迎任何人重新使用本代码——包括 Create: Deep Seas 的作者,如果他们希望直接将修复内容整合进去的话。
Create: Deep Seas - Lava Fix
A small NeoForge mod for Minecraft 1.21.1 that fixes a bug in
Create: Deep Seas
(CDS) where players inside a hermetically sealed submarine still take fire/lava
damage while the submarine is submerged in lava, even though CDS correctly empties
the interior of lava.
> Author: Diyksfol
> License: MIT
> Note: This mod was developed with the help of an AI assistant; my own role was primarily that of a tester and director. The full source is provided here so anyone — including the Create: Deep Seas authors — may study, reuse, or integrate it.
What it fixes
In Create: Deep Seas, a sealed submarine can pump out all fluid (including lava)
from its interior, letting you move around inside as if in open air. However, the
game's damage code still applied fire/lava damage to players standing in that
"emptied" space, because the damage checks did not account for the sealed sub.
This mod detects when a player is inside (or climbing out of) a sealed compartment
and suppresses the fire/lava damage and the on-screen fire overlay in that case.
Specifically fixed
- Fire/lava damage while standing inside a sealed, lava-submerged submarine.
- Damage while standing in hatches/doorways at the lava surface (entry/exit).
- Damage while seated (Create seats), on ladders, or in doorways inside the sub.
- Endless fire ticks after the hull is breached and then re-sealed.
- The persistent fire overlay (flames at the bottom of the screen) while inside.
What it does NOT fix (and why)
These behaviours are internal to Create: Deep Seas. Fixing them from an external
mod would require overriding core CDS systems and risks breaking the sealed-sub
mechanic itself, so they are intentionally left alone:
- Lava surface texture is still visible inside the sub. CDS hides the water
surface visually but not lava. This is a CDS rendering matter.
- Trapdoors don't work as climbable "ladders" when below the lava/water level
inside the sub. CDS hides the fluid, and vanilla's trapdoor-climb mechanic
depends on a fluid being present, so the climb is disabled. Same effect occurs
with water in CDS.
- Fire placed by the player inside the sub causes a fluid-like effect. Standing
in that fire applies slowness and, over lava, burning. This is a CDS interaction.
- Lava or water poured directly inside the sub deals no damage / no drowning.
This is a deliberate CDS feature (the interior is treated as sealed), not a bug.
- Mobs and animals inside the submarine still take fire/lava damage. The fix only protects the player. Other entities are not covered — do not keep animals or passive mobs inside a lava-submerged submarine.
- The pressure system does not work under the lava.
If the Create: Deep Seas authors wish to address any of the above, they are welcome
to use this code as a starting point.
Installation (players)
- Install NeoForge for Minecraft 1.21.1.
- Install Create: Deep Seas
and its dependencies (Create, Sable, etc.).
- Drop
submarinefix-1.0.1.jar into your mods/ folder.
- Launch the game. That's it.
The mod is safe to install even without Create: Deep Seas — it simply does nothing
in that case.
Building from source (developers)
This repository contains the uncompiled source. To build the jar yourself:
Prerequisites
- JDK 21
- The Create: Deep Seas jar and the bundled Sable Companion jar (used as
compile-only references — they are not redistributed here).
Steps
-
Clone this repository:
-
Create a libs/ folder in the project root and place two jars in it:
create_submarine-2.1.6.jar — from your Create: Deep Seas download.
sable-companion-common-1.21.1-1.5.0.jar — extracted from the CDS jar's
META-INF/jarjar/ folder (CDS bundles it).
Your build.gradle already references these via compileOnly files(...):
compileOnly files('libs/create_submarine-2.1.6.jar')
compileOnly files('libs/sable-companion-common-1.21.1-1.5.0.jar')
If your CDS version differs, update the filenames in build.gradle accordingly.
-
Build:
./gradlew build
On Windows:
.\gradlew.bat build
-
The compiled jar will be in build/libs/.
> These jars are third-party and are intentionally not included in this
> repository. You must supply them yourself from your own Create: Deep Seas install.
How it works (technical overview)
The fix combines several layers:
LivingIncomingDamageEvent (server, primary): cancels incoming
LAVA / IN_FIRE / ON_FIRE / HOT_FLOOR damage when the player is inside a
sealed compartment.
Entity#baseTick mixin (server): suppresses the lavaHurt() call.
LocalPlayer#baseTick mixin (client): suppresses the client-side
lavaHurt() so no fire ticks are produced locally.
ScreenEffectRenderer#renderFire mixin (client): hides the fire overlay
while inside the sub.
PlayerTickEvent.Post (server): clears any residual fire ticks each tick.
Detection
To decide whether a player is "inside a sealed sub", the mod:
- Iterates registered submarines via
CompartmentTracker.getSubsSnapshot().
- Rejects subs whose world-space AABB (
getWorldAABB) doesn't contain the player.
- Transforms the player's world position into the sub's plot-local space via
subLevelAccess.logicalPose().transformPositionInverse(...).
- Checks the resulting block against each sealed
Component's internal() and
hull() sets from CompartmentTracker.getCompartments(uuid).
- Checks both feet and eye positions (so seated players, ladder-climbers and
players in doorways are covered), and — when the player is on a climbable —
additionally scans vertically to cover ladder shafts that extend above the hull.
This mirrors the internal logic CDS itself uses, but avoids the CDS public methods
that only work when called from inside a sub-level.
Compatibility
- Minecraft: 1.21.1
- Mod loader: NeoForge 21.1+
- Requires: Create: Deep Seas (optional dependency; mod no-ops without it)
If you find a compatibility issue with another mod, please open an issue.
License
Released under the MIT License. You are free to use, copy, modify, and
redistribute this code, including in other projects or mods, provided the original
attribution is retained. See LICENSE for the full text.
Anyone is welcome to reuse this code — including the authors of Create: Deep Seas,
should they wish to integrate the fix directly.
评论 0
登录后参与评分
还没有评论,来抢沙发吧