mojira.dev
MC-74703

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

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 @unknown 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

Comments 4

Seems related to the fact that redstone smoke floats upwards and sideways, like normal smoke, but never downwards.

@unknown: The bug is that redstone particles don't spawn at all on the bottom side of redstone ore, not that they are spawning into the block itself.

In the newly attached screenshots, I made a 4x6x2 redstone ore formation, activated all of them by clicking on them, entered spectator mode and went into the block. All of the sides had particles except for the bottom side, which is completely devoid of particles.

How is this 'Works as intended'? Reasoning please?

Still an issue in 1.8.7, please see above for why it doesn't seem intended.

Sonicwave

(Unassigned)

Confirmed

particle, redstone, redstone_ore

Minecraft 1.8.1, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 1.12.2, Minecraft 17w47a

Minecraft 17w47b

Retrieved