mojira.dev
MC-120790

Redstone lamps and wire update whether they are lit or not when setblocked, but no other blocks do

The bug

When you setblock a lit redstone block without an power source powering it, it will turn off, unlike all other blocks. Lit furnaces, repeaters, comparators, wire, etc. all remain lit, but lamps turn off.

Steps to reproduce:

  1. Make sure you stand near nothing that could power the block in your feet.

  2. Use

    setblock ~ ~ ~ minecraft:lit_redstone_lamp

Code analysis

The reason this happens is because of a check when a lit redstone lamp is setblock-ed:

public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.REDSTONE_LAMP.getDefaultState(), 2);
        }
        else if (!this.isOn && worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.LIT_REDSTONE_LAMP.getDefaultState(), 2);
        }
    }
}

However, this check does not exist for:

  • pistons (extended)

  • dispensers, droppers (triggered)

  • comparators, doors, fence gates (powered)

  • furnace, repeater (lit block variant)

  • redstone torches (unlit block variant)

Related issues

Comments

No comments.

migrated

(Unassigned)

Confirmed

Minecraft 1.12.2

Minecraft 17w47a

Retrieved