watch the gif
https://gfycat.com/ShyBareClingfish
this breaks all kinds of contraptions from simple to complex
Related issues
is duplicated by
relates to
Comments


This is a pretty major issue that would break countless contraptions that have observers in them. Confirmed the bug acts like this in my snapshot test world.

Affects 1.13-pre1
Can confirm for 1.13-pre2
Additional information: The observer does actually get moved in powered state in 1.12.2 as well. I tested that simply by adding System.out.println("Broken " + state);
to the end of net.minecraft.block.BlockObserver.breakBlock(World, BlockPos, IBlockState)
and System.out.println("Placed " + state);
to net.minecraft.block.BlockObserver.onBlockAdded(World, BlockPos, IBlockState)
.
Using the contraption from the gif in the report, that gives the following output:
[15:37:06] [Server thread/INFO]: [STDOUT]: Placed minecraft:observer[facing=down,powered=false]
[15:37:06] [Server thread/INFO]: [STDOUT]: Broken minecraft:observer[facing=down,powered=true]
[15:37:06] [Server thread/INFO]: [STDOUT]: Placed minecraft:observer[facing=down,powered=true]
The first one is just the player placing the observer. The 2nd is the piston replacing the observer with block 36 (piston arm) and the last one is turning block 36 back to the observer.
So clearly, the observer stays powered while it is being moved in 1.12.2.
However, if the block gets placed in powered state, net.minecraft.block.BlockObserver.onBlockAdded(World, BlockPos, IBlockState)
immidiately calls net.minecraft.block.BlockObserver.updateTick(World, BlockPos, IBlockState, Random)
which will then act like the observer has just been ticked by the game. This will cause it to immidiately switch back to the unpowered state
To verify this, you can use the 1.12.2 command /setblock <x> <y> <z> minecraft:observer powered=true
(You have to use this command on a block that is not an observer of a different state, otherwise onBlockAdded will not get called and the observer will simply stay powered) and have a redstone componet at the output of the observer. It will not get triggered.
So, I pressume due to the flattening and the rewrite of how block updates work, this changed and observers actually cause updates now when placed in powered state.

Practical experimentation disagrees with the above code analysis. More code analysis is needed.
@unknown My practical expermientation seems to indicate that what I proposed is true. Can you provide information about your experiments so that I may be able to explain what happens or can agree with your point of view?
Just saying something is wrong without saying why, is not helpful in any way.

The way you tested is flawed. A better way to test would be to use `/blockdata` on the block 36 tile entity to inspect its state. As for why, we don't know yet, more code analysis is needed. But if you would like to see my theory, check discord.

The observer block will now be moved in the off-state.

Thanks a lot Searge! <3

Fixing this might also fixed MC-128926

behaviour of observers changed with pre release 3 check the contraption i linked with the gif above in the newest prerelease....
If this is not fixed almost all redstone contraptions will break