mojira.dev
MC-64394

Comparators prefer containers through blocks, except when block power level is 15

if you place a comparator in front of a block with a container behind it, the comparator will output how full the container is, even if the block betwen is powered. For some reason if the block gets power 15 the comparator will also output 15 and not how full the container is.

Code analysis: https://bugs.mojang.com/browse/MC-64394?focusedCommentId=292104&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-292104

Linked issues

Attachments

Comments 9

the bug still exists
I also changed the pictures maybe is it more clear now what I mean

I was about to file an issue for MCPE for not having this behavior. Glad to know it's in fact a MCPC bug.

Confirmed for

  • 1.9

Please link to this comment in the description of the report.

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.

The reason why this happens is that the protected int func_176397_f(World worldIn, BlockPos p_176397_2_, IBlockState p_176397_3_) method of the net.minecraft.block.BlockRedstoneComparator class only tests if there is a container next to the full block if the signal strength is less than 15.

protected int func_176397_f(World worldIn, BlockPos p_176397_2_, IBlockState p_176397_3_)
{
    int var4 = super.func_176397_f(worldIn, p_176397_2_, p_176397_3_);
    EnumFacing var5 = (EnumFacing)p_176397_3_.getValue(AGE);
    BlockPos var6 = p_176397_2_.offset(var5);
    Block var7 = worldIn.getBlockState(var6).getBlock();

    if (var7.hasComparatorInputOverride())
    {
        var4 = var7.getComparatorInputOverride(worldIn, var6);
    }
    // Replaced this
    //else if (var4 < 15 && var7.isNormalCube())
    else if (var7.isNormalCube())
    {
        var6 = var6.offset(var5);
        var7 = worldIn.getBlockState(var6).getBlock();

        if (var7.hasComparatorInputOverride())
        {
            var4 = var7.getComparatorInputOverride(worldIn, var6);
        }
        else if (var7.getMaterial() == Material.air)
        {
            EntityItemFrame var8 = this.func_176461_a(worldIn, var5, var6);

            if (var8 != null)
            {
                var4 = var8.func_174866_q();
            }
        }
    }

    return var4;
}
Fenhl (Max Dominik Weber)

Affects 1.9.

I vote that this not be considered a bug, but a feature (Works As Intended). This gives us more ways to change the value of a comparator besides the signal strength of the side inputs and the items in the container behind it.

I'm using it to quickly change values in a binary-to-analog/hexadecimal encoder. For example, a container which usually provides signal strength 7 can be switched to signal strength 15 by powering the block, adding 8 to the output. The block can be powered in a smaller space than modifying the comparator from the side, and much more easily than trying to change the items in the container.

Sorry for being off topic, but that reminds me of https://xkcd.com/1172/

[Mod] redstonehelper

To be very clear: This is not a discussion forum.

Fenhl (Max Dominik Weber)

Affects 1.9.2.

IS

Erik Broes

Confirmed

Minecraft 14w30c, Minecraft 1.8.1, Minecraft 1.8.2-pre1, Minecraft 15w42a, Minecraft 1.9, Minecraft 1.9.1, Minecraft 1.9.2

Retrieved