mojira.dev
MC-4381

Water places behind Tall Grass

The bug

Get a bucket of water and place it on some tall grass. The water will be placed behind the tall grass as if the grass isn't even there.

Other blocks such as cobwebs are affected as well:

Demonstration Video

The reason/Code analysis

See this comment by @unknown

Linked issues

Attachments

Comments 10

Tails

Confirmed.

Itouch2

Still a concern in 1.7.5 and 1.8

marcono1234

Confirmed for

  • 16w20a

Ray

Can this be reopened because this behavior doesn't work consistently across other similar blocks.

[Mod] redstonehelper

Ticket is up for review.

yut951121
AjaxGb

This really should be reopened. I've had a look at the code, and the problem is very clear and easy to fix.

The following is based on 1.10.2 decompiled with MCP, with some edited variable names for clarity. Please link to this comment in the description.

When you right click with a bucket, full buckets will ignore liquids when raycasting, while empty buckets will not.

RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, bucketIsEmpty);
                                                                  ^
                                                             useLiquids

The bug happens because all blocks with no collision are treated as liquids by this function.

protected RayTraceResult rayTrace(World worldIn, EntityPlayer playerIn, boolean useLiquids)
{
    float f = playerIn.rotationPitch;
    ...code omitted...
    return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, !useLiquids, false);
                                                      ^            ^
                                              stopOnLiquid      ignoreBlockWithoutBoundingBox
}

A quick fix would be to add a second function that doesn't assume it should do this:

protected RayTraceResult rayTrace(World worldIn, EntityPlayer playerIn, boolean useLiquids)
{
    return rayTrace(worldIn, playerIn, useLiquids, !useLiquids);
}

protected RayTraceResult rayTrace(World worldIn, EntityPlayer playerIn, boolean useLiquids, boolean ignoreBlockWithoutBoundingBox)
{
    float f = playerIn.rotationPitch;
    ...code omitted...
    return worldIn.rayTraceBlocks(vec3d, vec3d1, useLiquids, ignoreBlockWithoutBoundingBox, false);
}

and then to use the new function when using buckets:

RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, bucketIsEmpty, false);

That way, all other raycasts would have the same functionality as before, and water/lava could be placed on signs and things. Alternatively, swap that false for a true, and buckets would consistently ignore those blocks.

Ray

fixed

marcono1234

Seems to be fixed indeed, but likely in a version prior to 1.15-pre6

Neliz_

I can confirm this has been fixed in 18w01a and attached two videos: one demonstrating a fixed version, the other demonstrating a bugged version.

ReduxMC

migrated

Confirmed

grass, water

Minecraft 1.4.4, Minecraft 1.4.5, Snapshot 12w49a, Snapshot 12w50a, Snapshot 12w50b, ..., Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 1.8, Minecraft 16w20a

Minecraft 18w01a

Retrieved