feat: extra swarm spawn check

This commit is contained in:
xtex 2023-07-04 16:28:42 +08:00
parent 906263cb2b
commit ed6776f9df
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -40,6 +40,10 @@ 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)
return
if (!level.getBlockState(spawnPos).isAir)
return
ProjectedPersonEntity.entity.get().spawn(level, spawnPos, MobSpawnType.TRIGGERED)
}
}