Mojira Archive
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 [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.

Fixed

[Mod] Sonicwave

2014-11-25, 07:58 AM

2017-11-28, 09:05 PM

2017-11-28, 09:00 PM

2

3

Confirmed

particle, redstone, redstone_ore

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

Minecraft 17w47b