The bug
When walking on a light block (defined by the game as a light block being below an iron golem while it walks), iron golems produce particles of the light block, despite the fact that no such particles should be made here as the texture is only meant to be visible for mapmakers.
Related issues
relates to
Attachments
Comments

Can confirm.

Related to MC-1133
Can confirm in 21w14a.
Can confirm in 21w15a.
Can confirm in 21w16a.
Can confirm in 21w17a.

Can confirm in 1.17 pre-release 3
Can confirm in 1.17.
Can confirm in 1.17.1.
I can confirm this behavior in 1.18. Here's a code analysis of this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.entity.animal.IronGolem.java
public class IronGolem extends AbstractGolem implements NeutralMob {
...
public void aiStep() {
super.aiStep();
...
if (this.getDeltaMovement().horizontalDistanceSqr() > (double)2.5000003E-7F && this.random.nextInt(5) == 0) {
int i = Mth.floor(this.getX());
int j = Mth.floor(this.getY() - (double)0.2F);
int k = Mth.floor(this.getZ());
BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k));
if (!blockstate.isAir()) {
this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockstate), this.getX() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double)this.random.nextFloat() - 0.5D) * (double)this.getBbWidth(), 4.0D * ((double)this.random.nextFloat() - 0.5D), 0.5D, ((double)this.random.nextFloat() - 0.5D) * 4.0D);
}
}
...
If we look at the above class, we can see that there is only one necessary check that is carried out before allowing an iron golem to produce walking particles. This check is to see if the block below them is air, and if it is, walking particles won't be produced, but if it isn't, walking particles based on the block that the iron golem is standing on will be produced. The game doesn't check the RenderShape
of the block that the iron golem standing on before allowing it to produce walking particles, therefore resulting in this problem occurring.
Fix:
Simply changing some lines of code to check the RenderShape
of the block that the iron golem is standing on before allowing it to produce walking particles, will resolve this problem.
Current Code:
...
BlockState blockstate = this.level.getBlockState(new BlockPos(i, j, k));
if (!blockstate.isAir()) {
...
Fixed Code:
...
BlockPos blockpos = new BlockPos(i, j, k);
BlockState blockstate = this.level.getBlockState(blockpos);
if (blockstate.getRenderShape() != RenderShape.INVISIBLE) {
...
Can confirm in 1.18.1.
Can confirm in 1.18.2 and 22w14a.
Can confirm in 1.19.
Can confirm in 1.19.2.
Following on from my code analysis, I've double-checked my proposed fix and I can confidently confirm that it's fully functioning and works as expected, so I've attached two screenshots to this report, one of which shows the current code and the other that shows the fixed code. I feel this information may be quite insightful hence my reasoning for providing it. 🙂
[media][media]
This does not seem to happen anymore as of 1.20-rc1. Can we find the exact fix version (possibly pre-release 3 as per MC-262505)?
This issue was present in 1.20 Pre-release 2, but no longer occurs in versions above or equal to 1.20 Pre-release 3. This issue was fixed in 1.20 Pre-release 3.

I may need to re-test this with carpets on top of light blocks first.
Closing as Fixed in 1.20pr3 per @unknown's comment.