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

Redstone Ore does not produce particles on bottom side if not at y=0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.8.1, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 1.12.2, Minecraft 17w47a
    • Fix Version/s: Minecraft 17w47b
    • Environment:

      Windows 8
      Particles: "All"
      Fast Graphics
      Render Distance 4

    • Confirmation Status:
      Confirmed

      Description

      The bug

      When activated (by clicking or walking on top of it), redstone ore not placed at y=0 produces particles on all sides except for its underside. If placed at y=0, particles will appear on the underside of the block as expected.

      Code analysis

      Code analysis by [Mod] Pokechu22 can be found in this Reddit comment.

      Here's the code in BlockRedstoneOre:

      private void spawnParticles(World worldIn, BlockPos pos) {
          Random random = worldIn.rand;
          double d0 = 0.0625D;
      
          for (int i = 0; i < 6; ++i) {
              double d1 = (double)((float)pos.getX() + random.nextFloat());
              double d2 = (double)((float)pos.getY() + random.nextFloat());
              double d3 = (double)((float)pos.getZ() + random.nextFloat());
      
              if (i == 0 && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
                  d2 = (double)pos.getY() + 0.0625D + 1.0D;
              }
      
              if (i == 1 && !worldIn.getBlockState(pos.down()).isOpaqueCube()) {
                  d2 = (double)pos.getY() - 0.0625D;
              }
      
              if (i == 2 && !worldIn.getBlockState(pos.south()).isOpaqueCube()) {
                  d3 = (double)pos.getZ() + 0.0625D + 1.0D;
              }
      
              if (i == 3 && !worldIn.getBlockState(pos.north()).isOpaqueCube()) {
                  d3 = (double)pos.getZ() - 0.0625D;
              }
      
              if (i == 4 && !worldIn.getBlockState(pos.east()).isOpaqueCube()) {
                  d1 = (double)pos.getX() + 0.0625D + 1.0D;
              }
      
              if (i == 5 && !worldIn.getBlockState(pos.west()).isOpaqueCube()) {
                  d1 = (double)pos.getX() - 0.0625D;
              }
      
              if (d1 < (double)pos.getX() || d1 > (double)(pos.getX() + 1) || d2 < 0.0D || d2 > (double)(pos.getY() + 1) || d3 < (double)pos.getZ() || d3 > (double)(pos.getZ() + 1)) {
                  worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, 0.0D, 0.0D, 0.0D);
              }
          }
      }
      

      It checks 6 sides, including down, and then checks to make sure it's not rendering inside of the block. But for checking on y, it does d2 < 0.0D || d2 > (double)(pos.getY() + 1) instead of d2 < (double)pos.getY() || d2 > (double)(pos.getY() + 1) — that looks like a mistake to me.

        Attachments

        1. 2014-11-24_21.56.05.png
          2014-11-24_21.56.05.png
          63 kB
        2. 2014-11-24_21.56.11.png
          2014-11-24_21.56.11.png
          66 kB
        3. 2014-11-24_21.56.15.png
          2014-11-24_21.56.15.png
          38 kB
        4. 2014-11-25_15.58.20.png
          2014-11-25_15.58.20.png
          335 kB
        5. 2014-11-25_15.59.15.png
          2014-11-25_15.59.15.png
          312 kB
        6. 2014-11-25_15.59.22.png
          2014-11-25_15.59.22.png
          350 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Sonicwave [Helper] Sonicwave
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: