mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
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:
1 parent
73863e8219
commit
9b86b34187
9 files changed
+199
-26
No files matched your search
+28
@@ -51,6 +51,34 @@ public class ModdedEntitySpawnerParityTest {
|
||||
assertFalse(clear);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fractionalFluidVolumeIncludesHorizontalEdgesAndCenteredHeight() {
|
||||
Set<BlockPos> checked = new HashSet<>();
|
||||
|
||||
assertTrue(ModdedEntitySpawner.isFluidAreaClearForSpawn(-1, 78, -1, 1.3F, 0.8F, position -> {
|
||||
checked.add(position);
|
||||
return true;
|
||||
}));
|
||||
|
||||
assertEquals(18, checked.size());
|
||||
assertTrue(checked.contains(new BlockPos(-2, 79, -2)));
|
||||
assertTrue(checked.contains(new BlockPos(0, 78, 0)));
|
||||
assertFalse(ModdedEntitySpawner.isFluidAreaClearForSpawn(-1, 78, -1, 1.3F, 0.8F,
|
||||
position -> !position.equals(new BlockPos(-2, 79, -2))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exactUpperBoundaryDoesNotRequireFluidOutsideTheBody() {
|
||||
Set<BlockPos> checked = new HashSet<>();
|
||||
|
||||
assertTrue(ModdedEntitySpawner.isFluidAreaClearForSpawn(0, 78, 0, 1F, 0.5F, position -> {
|
||||
checked.add(position);
|
||||
return true;
|
||||
}));
|
||||
|
||||
assertEquals(Set.of(new BlockPos(0, 78, 0)), checked);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spawnSafetyRequiresTheTargetChunkAndAllEightNeighbors() {
|
||||
Set<Long> loaded = new HashSet<>();
|
||||
|
||||
Reference in new issue
Block a user