Minecraft – How to make water that can’t flow for adventure maps

minecraft-commandsminecraft-java-edition

I'm trying to build a race for the wool style map, and I've seen tons of other maps in versions all the way up to 1.16 that have underwater sections without walls to hold the water in. I know they aren't using barriers, because they can still fire arrows into the water, and they aren't using a fill command, because that isn't fast enough to stop the water. As well as that, it's entirely in vanilla, since I can download the map and play it and not have any problems on a vanilla profile. So how do they do it? I do have world edit at my disposal if the solution requires it.
enter image description here

Best Answer

Place structure void blocks around spaces you don't want the water flowing into.

To get a structure void, use this command:

give @s minecraft:structure_void 1

The structure void's hitbox is a small cube in the middle of the block that can be broken to turn the block into air. Water will never flow into its space while it is active.