mojira.dev
MC-18631

Some redstone components (block entities) do not update themselves when placed

Certain block entities, when newly placed next to a power source, won't activate until they receive a block update.

Steps To Reproduce:
1. Place a command block to where it will be powered as soon as it is placed.
2. Type a command into the command block, e.g.: "say test".
> Notice the command block won't output "test" although it's powered.
3. Cause a block update next to the command block.
> Notice the command block now outputs "test".

This also occurs with dispensers, droppers, and note blocks.

See also:
MC-51340, it also happens if you got certain block entities with NBT data (e.g. a command block with an inserted command) and place that manually next to a power source, as well as
MC-31100 if you setblock certain block entities with NBT data where they would get powered, as well as
MC-80901 as falling block.


Code analysis by @unknown in this comment.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media]
kumasasa

Please attach screenshots.

GrygrFlzr

Confirmed. Attached screenshots.

Austin

Sorry for not adding screenshots, i wasn't sure of a good way of showing it in a screenshot.

Ezekiel

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Austin

Updated

galaxy_2alex

Is this still a concern in the current Minecraft version 1.7.4 / Launcher version 1.3.8 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

marcono1234

Confirmed for 14w20b

marcono1234

Duplicated by:
MC-50612

kumasasa

MC-50612 duplicates the related ticket MC-31100

Legofan Minifig

Confirmed for 1.8-pre1.

marcono1234

Confirmed for

  • 1.8.3 only for redstone it is diagonally (probably because of the redstone update order), but you can also place a block directly next to it to cause the update

KingSupernova

Could the title be updated to something more accurate, like "Some redstone components do not update themselves when placed"? This bug also occurs with dispensers, droppers, and note blocks.

marcono1234

Confirmed for:

  • 1.8.6

Seems to be caused by wether the block is a TileEntity or not. Non-TileEntities like pistons, lamps... work. TileEntities like command blocks and dispensers don't

Relates to:

marcono1234

Duplicated by:

First of all this whole block placing updating blocks thing is really complicated and confusing with Minecraft. Because of that the provided fix might cause other problems but I hope I got that right and currently it does not cause other problems.

The method setBlockState(BlockPos p_177436_1_, IBlockState p_177436_2_) in the class /Client/src/net/minecraft/world/chunk/Chunk.java (MCP 1.8 names) which is called at some point after a block was placed or destroyed used to call only var15.updateContainingBlockInfo(); however I am unsure what this method actually does...
For TileEntities the onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) method must be called to update them. This method is called by the notifyBlockOfStateChange(BlockPos pos, final Block blockIn) method.
The reason why this did not affect basic redstone powered blocks is that they update themselves when the onBlockAdded(World worldIn, BlockPos pos, IBlockState state) is called (and this method is called).

public IBlockState setBlockState(BlockPos p_177436_1_, IBlockState p_177436_2_)
{
	//...
	
	if (var8 == p_177436_2_)
	{
		return null;
	}
	else
	{
		//...
		
		if (var11.getBlockByExtId(var3, var4 & 15, var5) != var9)
		{
			return null;
		}
		else
		{
			if (var9 instanceof ITileEntityProvider)
			{
				var15 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);

				if (var15 == null)
				{
					var15 = ((ITileEntityProvider)var9).createNewTileEntity(this.worldObj, var9.getMetaFromState(p_177436_2_));
					this.worldObj.setTileEntity(p_177436_1_, var15);
				}

				if (var15 != null)
				{
					// Added the following line
					worldObj.notifyBlockOfStateChange(var15.getPos(), var15.getBlockType());
					
					var15.updateContainingBlockInfo();
				}
			}
		}
	}
}
SunCat

Still in 1.9.4

bob

Can confirm for 1.11

Meri Diana

Confirmed for 1.12 pre-5.

But wouldn't it be advisable to resolve MC-31100, MC-51340 and MC-80901 as duplicate of this bugpost?
Unless there's a reason to not bundle them together.
I got test setups for each one of them like the OP's provided test setup, but it's more or less the same.

Meri Diana

Confirmed for 1.12 pre-7.

Meri Diana

Confirmed for 1.12 release.

(@unknown Thank you also here 🙂)

wobst.michael

Ticket is yours now, @unknown

user-f2760

Merging with MC-51340 as it's the same cause.

Austin

Meri Diana

(Unassigned)

Confirmed

block-entity, block-update, command_block, redstone

Snapshot 13w25c, Minecraft 1.6.2, Minecraft 14w20b, Minecraft 1.8-pre1, Minecraft 1.8.3, ..., Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b

Retrieved