Spawn water and lava entities only inside matching fluid

Fluid entities were placed above the sea and checked against the block below and for air, so they could not spawn where they live. They now take a Y inside the fluid, are always surface-checked (marker spawns too), and both hosts test the block itself and require the fluid across the entity's volume.

Upstream: e33e6a632
This commit is contained in:
piexel committed 2026-11-10 01:10:16 +01:00
1 parent 73863e8219
commit 9b86b34187
9 files changed
+199 -26

No files matched your search

@@ -93,7 +93,8 @@ public interface EntitySpawns {
/**
* One entity to spawn at a block. The host spawns it only if the block's light level lies in the range (when the
* range is restricted) and, when {@code checkSurface}, the block below suits the entity's {@code surface} and the
* space the entity needs is free.
* space the entity needs is free. An entity of a fluid surface is always checked, and needs the block it spawns in
* and the space it fills to be that fluid.
*
* @param at world X and Z, Y the height above the dimension's bottom
* @param entity what to spawn
@@ -126,6 +127,11 @@ public interface EntitySpawns {
/** Solid ground or water. */
OVERWORLD,
/** Within lava. */
LAVA
LAVA;
/** Whether the entity lives in the fluid, so the block it spawns in must be that fluid. */
public boolean isFluid() {
return this == WATER || this == LAVA;
}
}
}