mojira.dev
MC-101001

Fishing rod cannot pull items

The bug

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

Based on the code of the method net.minecraft.entity.projectile.EntityFishHook.handleHookRetraction() it is very likely that fishing rods (or rather their hooks) can pull items.

public int handleHookRetraction()
{
    if (this.worldObj.isRemote)
    {
        return 0;
    }
    else
    {
        int i = 0;

        if (this.caughtEntity != null)
        {
            this.func_184527_k();
            this.worldObj.setEntityState(this, (byte)31);
            i = this.caughtEntity instanceof EntityItem ? 3 : 5;
        }
        else if (this.ticksCatchable > 0)
        {
            // Loot
            // ...
            i = 1;
        }

        if (this.inGround)
        {
            i = 2;
        }

        this.setDead();
        this.angler.fishEntity = null;
        return i;
    }
}

More precisely the part

i = this.caughtEntity instanceof EntityItem ? 3 : 5;

The local variable i represents the amount of durability the fishing rod loses. It is very unlikely that you type a complete line just by accident.

How this could be fixed

This could be fixed by having the method net.minecraft.entity.projectile.EntityFishHook.onUpdate() test if an entity intersecting with the bounding box is an instanceof EntityItem.

// Replaced this
//if (entity1.canBeCollidedWith() && (entity1 != this.angler || this.ticksInAir >= 5))
if ((entity1 instanceof EntityItem || entity1.canBeCollidedWith()) && (entity1 != this.angler || this.ticksInAir >= 5))

Comments 1

It seems, buggy... I like the fix, though! Cool! Also, the bug number (MC-101001) seems to be binary for 41... 🙂

marcono1234

Erik Broes

Unconfirmed

fishing, fishing_rod, item

Minecraft 16w15b

Minecraft 16w21a

Retrieved