mojira.dev
MC-168596

Chunks outside of render distance are not unloaded if "execute if block" runs on it every tick

Create a new superflat world with cheats. Put down a repeating, always active command block with the command:

execute if block 10000 3 10000 minecraft:grass_block run say yo

It will not say "yo", of course, because the block at 10000, 4, 10000 isn't loaded. So then teleport yourself there, and of course, it will start spamming the chat with "yo". Kill yourself to go back to world spawn. By typing things in chat, you can tell that it continues to spam "yo" to chat, even though you are a long ways away from 10000, 4, 10000. You can also run the command yourself and see that said chunk is indeed still loaded, it's not a command block caching issue or anything.

So disable the command block, then run the command yourself. By which you can see that a short moment after the command block stops running, the chunk unloads. So the "if block" command is actually keeping the chunk loaded somehow.

As for importance, there are workarounds for this issue, but for people that aren't aware of it, it can cause major performance problems for data packs by causing them to keep a lot of unnecessary chunks and entities loaded.

 

Linked issues

Attachments

Comments 9

When you reproduce this issue, please run the following command:

/debug report

After this, please attach the report created in your debug/ folder under the .minecraft folder.

Please note, you will have to have cheats enabled to run this command (can be achieved by using the Open to LAN function).

Debug report attached. Not sure how much can be gleaned from the debug report, but I am in singleplayer, located at [613, 202, 316] with a render distance of 8, and the entity named "Ikse the Faithful" is still loaded, despite being located at [5, 172, 184]. Spawn point is at [-884, -726], so definitely nothing to do with spawn chunks. No forceloaded chunks either.

Still an issue in 1.16.1

Figured out the root cause of the issue; Updated title and description with reproduction steps.

Can confirm in 1.17.1.

This behavior occurs with /clone, /data (get|merge|modify|remove) block, /execute (if|unless) (block|blocks|predicate), /fill and /setblock, provided the chunk was loaded initially.

@unknown, for future reference, every time you edit a comment, an email notification is sent out to those watching a report. I would recommend you make all your edits at once.

Hm sorry about that, didn't know it worked that way. (Also I keep updated on watched issues through Jira filters so I forgot email notifs were a thing.)

Can confirm in 1.20.2 and 1.20.3 pre-release 2

I attached an image showing two different armor stands. One is in a chunk where the following command is being run every tick:

{{execute if block ~ ~ ~ air}}

The other one is outside that chunk. The armor stand on top of the command block is always loaded, but the other armor stand is not.

Avantir_Yihn

(Unassigned)

Community Consensus

Commands

1.15.1, 1.16.1, 1.16.2, 1.17.1, 1.19, 1.20.2, 1.20.3 Pre-Release 2

Retrieved