The bug
Please look at the screenshots first to understand 🙂
When you place three rails like I did and you place at the bifurcation a redstone torch it will not update the rail, BUT when you place it under the rail it works
Code analysis
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is very likely a wrong IBlockState
being returned by the method net.minecraft.world.chunk.Chunk.setBlockState(BlockPos, IBlockState)
. The IBlockState
it returns is the one from the block that was replaced. This means the rail is receives a neighbour update with air as source which does not update the rail.
public IBlockState setBlockState(BlockPos pos, IBlockState state)
{
int i = pos.getX() & 15;
int j = pos.getY();
int k = pos.getZ() & 15;
int l = k << 4 | i;
if (j >= this.precipitationHeightMap[l] - 1)
{
this.precipitationHeightMap[l] = -999;
}
int i1 = this.heightMap[l];
IBlockState iblockstate = this.getBlockState(pos);
if (iblockstate == state)
{
return null;
}
else
{
//...
if (extendedblockstorage.get(i, j & 15, k).getBlock() != block)
{
return null;
}
else
{
//...
this.isModified = true;
// Replaced this; now returns the new state
//return iblockstate;
return state;
}
}
}
If this method is supposed to returns the old state, then methods like net.minecraft.block.BlockRedstoneTorch.onBlockAdded(World, BlockPos, IBlockState)
are not working correctly because they pass themself which means at the end the new state is passed.
Besides that the method net.minecraft.block.BlockRail.onNeighborChangedInternal(World, BlockPos, IBlockState, Block)
will still not work correctly. It should test if the new placed block state provides power and if the rail was powered before (it looks like this is currently not tracked).
Related issues
is duplicated by
Attachments
Comments


Confirmed.

Still not fixed as of 1.5.2pre.
To clarify, if you place a torch adjacent to a t-rail, the t-rail actually can change direction when said torch is controlled by some signal. Placing and removing the torch, however, does not affect t-rail direction even when the circuit that provides that signal exists. In such case t-rail also disregards a zero-tick pulse created on torch placement when the circuit is on.

Confirmed for 14w18b.

Confirmed for 15w33c

Still in 1.9.1-pre3

Still in 16w21a

Still in 1.12

@unknown, 1.12 is outdated, and a newer version (1.12.1) was already marked as affected
Can confirm for 17w43a/b
Fixed in recent snapshots (tested in 17w50a)

This bug has re-appeared in 1.14.4

@@unknown, you are right, thank you very much. I have cloned the report as MC-167257 since this report is so old and the bug has been fixed a rather long time ago.
Do you want to become the reporter of the new report and keep it up to date?

This is happening in 1.15.2.
@unknown See MC-167257.