-
Bug
-
Resolution: Unresolved
-
None
-
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, 1.17.1, 23w14a, 24w33a
-
Confirmed
-
(Unassigned)
Preliminary remark
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.
The bug
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.
How to reproduce
- Build a setup as shown in Setup.png
- Stand on the lapis block and use a command to place a lever
/setblock ~ ~ ~ lever[face=floor,powered=true]
→ The redstone wire which should be powered through the block was not updated
Code analysis
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):
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if(state.getValue(POWERED)) worldIn.notifyNeighborsOfStateChange(pos.offset(state.getValue(FACING).getFacing().getOpposite()), this, false); }
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.
- is duplicated by
-
MC-48804 Wrong redstone state, when lever is added with command block
- Resolved
-
MC-125022 /setblock replacing buttons does not update redstone
- Resolved
-
MC-191784 Requireds-Redstone-Chain Commandblock doesn´t Update
- Resolved
-
MC-232814 With command blocks, placing powered blocks doesn't update strongly powered blocks
- Resolved
- relates to
-
MC-31100 /setblock and /fill do not update the placed block(s) consistently
- Reopened