Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-120790

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

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 17w47a
    • Minecraft 1.12.2
    • None
    • Confirmed

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            FVbico Dhranios
            Votes:
            7 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              CHK: