I am playing Minecraft Java 1.18.2 with very few mods, and already started building something large in creative mode, but it happens to be in an icy biome I would rather it not be in. I was hoping the functions command would be a possible solution to remove the ice/icy biome completely. I'm just not sure how to set up the command so it checks whether a block belongs in that biome, and then replaces that block with a stone block. That would mean all x, y, and z coordinates will have to be considered. If the function could be made so it continues to replace the icy biome blocks with stone blocks until a point where there are none touching it, that would be amazing!

I have already tried commands that replace blocks one by one with specific coordinates as well as manually change the blocks. I also read this page, but am having a little difficulty coming to a more specific solution.

1 Answer 1


While you cannot detect biomes specifically (in 1.18 that is, in 1.19.3 we got execute if biome), making a "flood fill" system that replaces all connected blocks of a certain type is very doable.

There are multiple ways to achieve this, all with advantages and disadvantages.

  1. Using entities as markers for where you've changed a block last.

    • (+) Allows for "asynchronous" execution, e.g. limiting how many blocks are replaced per tick to prevent lag
    • (+) can be done using commandblocks, no datapack / functions needed, but still possible to be used
    • (-) requires a lot of entities, which itself can cause lag
    • (+) if set up correctly can continue to work in unloaded chunks, once loaded.
  2. Using functions to keep execution context

    • (+/-) Runs everything in a single tick. This means it's instantaneous, but if there is a lot of blocks that one tick might take a while, so it would create one big lagspike. This might be preferable over the other solution.
    • (+) doesn't require any entities to be created
    • ((-)) Needs to be set up through a datapack. Which is not difficult, but a barrier for some, also because it needs to be added to the file system of the server.
    • (-) only works in loaded chunks
    • (-) might run into issues with the maximum command in a function limit. Luckily that's a gamerule and we can modify that and set it to a much higher number. It's also easy to spot, as the command would be called from chat and tell us how many functions it ran.

If you're able to use a datapack, you have the advantage of being able to create a block tag to make it easier to replace a set of blocks instead of defining every block individually.

Using a datapack and functions

I'll focus on this solution in this answer, as it's easier to make than the other one. If you'd like to know the entity solution, let me know and I can add it.

Related: How to create a datapack

I'll be using ff as the namespace (for flood fill) in this solution. This means that all these files need to be placed inside the world/datapacks/FloodFill/data/ff/ folder.

First, let's make the blocktag with all the blocks we want to replace. I'll add ice, packed_ice and snow to it.


  "values": [

Next we want to make the function file to run the replacement process. It will set its own block position to be stone, then check in all 6 cardinal directions whether the block there is one of the blocks defined in the block tag and if so, it will run itself again.


setblock ~ ~ ~ stone

execute positioned ~1 ~ ~ if block ~ ~ ~ #ff:replace run function ff:run
execute positioned ~-1 ~ ~ if block ~ ~ ~ #ff:replace run function ff:run
execute positioned ~ ~ ~1 if block ~ ~ ~ #ff:replace run function ff:run
execute positioned ~ ~ ~-1 if block ~ ~ ~ #ff:replace run function ff:run
execute positioned ~ ~1 ~ if block ~ ~ ~ #ff:replace run function ff:run
execute positioned ~ ~-1 ~ if block ~ ~ ~ #ff:replace run function ff:run

Now, to start the system all you need to do is run the function at any block that is adjacent to at least one of the defined blocks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .