Description
# Create: Deep Seas - Lava Fix
A small NeoForge mod for Minecraft **1.21.1** that fixes a bug in
[Create: Deep Seas](https://modrinth.com/mod/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](https://github.com/Diyksfol/create-deep-seas-lava-fix) 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:
1. **Lava surface texture is still visible inside the sub.** CDS hides the *water*
surface visually but not lava. This is a CDS rendering matter.
2. **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.
3. **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.
4. **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.
5. **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.
6. **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)
1. Install [NeoForge](https://neoforged.net/) for Minecraft 1.21.1.
2. Install [Create: Deep Seas](https://modrinth.com/mod/create-deep-seas)
and its dependencies (Create, Sable, etc.).
3. Drop `submarinefix-1.0.1.jar` into your `mods/` folder.
4. 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
1. Clone this repository: https://github.com/Diyksfol/create-deep-seas-lava-fix
2. 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(...)`:
```groovy
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.
3. Build:
```bash
./gradlew build
```
On Windows:
```bat
.\gradlew.bat build
```
4. 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:
1. Iterates registered submarines via `CompartmentTracker.getSubsSnapshot()`.
2. Rejects subs whose world-space AABB (`getWorldAABB`) doesn't contain the player.
3. Transforms the player's world position into the sub's plot-local space via
`subLevelAccess.logicalPose().transformPositionInverse(...)`.
4. Checks the resulting block against each sealed `Component`'s `internal()` and
`hull()` sets from `CompartmentTracker.getCompartments(uuid)`.
5. 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`](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.