Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 17w43a, Minecraft 17w43b, Minecraft 18w06a, Minecraft 1.13-pre3, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13.1, 1.16.1, 20w51a
Despite sounding similar to MC-31100, this report is not a duplicate. MC-31100 covers redstone components which do not notice that they should be powered, this report here covers special cases in which redstone power supplying blocks do not update all required blocks.
Redstone power supplying blocks do not update all affected blocks when placed using commands. Mainly the do not update blocks which are currently receiving or should receive power through a block.
This affects commands like /setblock as well as falling block entities.
- Build a setup as shown in Setup.png
- Stand on the lapis block and use a command to place a lever
→ The redstone wire which should be powered through the block was not updated
MCP 9.40-pre1 names
In order to resolve the issue for placing a new block, the method net.minecraft.block.Block.onBlockAdded(World, BlockPos, IBlockState) needs to be overridden in the classes of power supplying blocks (lever, button and similar):
This method is however not called by net.minecraft.world.chunk.Chunk.setBlockState(BlockPos, IBlockState), when the block type it is placing is the same that was there previously.
One possibility would obviously be to remove the check, but that might have side effects elsewhere that I am not aware of. Some code would become redundant at the very least.
Another, probably more clean way of fixing it would be to add an additional method to Block, like onStateChange that gets called in this case. With this soloution some of the code of net.minecraft.block.BlockLever.onBlockActivated(World, BlockPos, IBlockState, EntityPlayer, EnumHand, EnumFacing, float, float, float) would become redundant as it is already changing the state in there and the new onStateChange method would take care of that anyways.