Skip to content

Handle surface lava in anti-xray - #14257

Open
OfficialTheosis wants to merge 1 commit into
PaperMC:mainfrom
OfficialTheosis:fix/anti-xray-surface-lava
Open

OfficialTheosis wants to merge 1 commit into
PaperMC:mainfrom
OfficialTheosis:fix/anti-xray-surface-lava

Conversation

@OfficialTheosis

@OfficialTheosis OfficialTheosis commented Sep 15, 2026

Copy link
Copy Markdown

Description

The Problem

The lava-obscures anti-xray setting currently makes it so that source lava is simply treated as an obscuring block. The problem with this is that surface lava does not completely visually cover blocks horizontally adjacent to or above it, meaning if the setting is enabled, these blocks can be obscured by the anti-xray even though they are visible to the player, resulting in obvious visual artefacts, particularly around the edges of lava lakes.

As a server owner, I want to be able to prevent players from being able to trivially locate hidden blocks such as ancient debris under large lava lakes in the nether by simply turning off lava fog and flying through them with an elytra and fire resistance. The lava-obscures setting provides a means to this, but the aforementioned visual artefacts it results in makes enabling it much less desirable.

New Behaviour

This PR makes it so that if lava-obscures is enabled:

  • Lava without lava directly above it is considered surface lava, meaning it obscures blocks directly underneath it, but not horizontally adjacent to or above it.
  • Lava with lava directly above it is treated as fully obscuring (same as current behaviour).
  • Source and flowing lava are not treated differently - these behaviours are applied to both of them.

Testing

I did what I believe to be a good amount of testing, and I wasn't able to find any broken behaviour or noticeable performance regressions (I'm happy to perform any additional testing as required). These are the results of my testing:

  • Anti-xray behaviour with the lava-obscures setting disabled is unaffected.
  • Blocks underneath surface lava are obscured.
  • Blocks horizontally adjacent to surface lava are not obscured.
  • Blocks underneath lava that has lava above it are obscured.
  • Blocks horizontally adjacent to lava that has lava above it are obscured.
  • Obscured blocks around lava correctly become un-obscured when the lava is removed.
  • Source and flowing lava were both tested, including shallow flowing lava, and behaved consistently according to the new surface lava rules.
  • Block obscuring was tested at all 4 chunk boundaries and corners - the behaviour seems correct and consistent.
  • Behaviour across vertical chunk-section boundaries was tested and appeared correct.
  • All 3 anti-xray engine modes were tested and the behaviour seems correct and consistent.

AI Assistance

  • AI was used to help me understand the anti-xray algorithm.
  • AI was used to discuss my proposed solution around lava handling and whether it could be integrated into the existing code without significant refactoring.
  • I personally implemented and reviewed the resulting changes.
  • I personally tested the changes and understand the behaviour being submitted.

@OfficialTheosis
OfficialTheosis requested a review from a team as a code owner September 15, 2026 13:54
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant