From ca87f6704cce988b3fc51d184df9e0f66873e036 Mon Sep 17 00:00:00 2001 From: xtex Date: Thu, 27 Jul 2023 16:42:15 +0800 Subject: [PATCH] fix: projection people spawn on ocean surface --- .../quaedam/projection/swarm/SwarmProjectionEffect.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt index bf095ae..2f98cf3 100644 --- a/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt +++ b/common/src/main/kotlin/quaedam/projection/swarm/SwarmProjectionEffect.kt @@ -45,7 +45,11 @@ data class SwarmProjectionEffect( level.random.nextInt(area.minZ(), area.maxZ()), ) spawnPos = spawnPos.atY(level.getHeight(Heightmap.Types.WORLD_SURFACE, spawnPos.x, spawnPos.z)) - if (level.getBlockState(spawnPos.below()).isAir) + val belowState = level.getBlockState(spawnPos.below()) + if (belowState.isAir || !belowState.fluidState.isEmpty || !belowState.canOcclude()) + return + val state = level.getBlockState(spawnPos) + if (state.canOcclude() || !state.fluidState.isEmpty) return ProjectedPersonEntity.entity.get().spawn(level, spawnPos, MobSpawnType.TRIGGERED) }