mojira.dev
MC-98922

Fishing hook / bobber cannot kill itself after 1200 ticks and bounces on land

The bug

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 public void onUpdate() method of the net.minecraft.entity.projectile.EntityFishHook class is supposed to kill the fishing hook after being for 1200 ticks inside a block. The problem is that the value for the inTile field is never set. This is also the reason why the hook is bouncing on land.

/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (this.fishPosRotationIncrements > 0)
    {
        //...
    }
    else
    {
        //...

        if (this.inGround)
        {
            // The problem is that inTile is never set
            if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile)
            {
                ++this.ticksInGround;

                if (this.ticksInGround == 1200)
                {
                    this.setDead();
                }

                return;
            }

            this.inGround = false;
            this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
            this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
            this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
            this.ticksInGround = 0;
            this.ticksInAir = 0;
        }
        else
        {
            ++this.ticksInAir;
        }
        
        //...
    }
}

Related issues

Comments

marcono1234

Looks like it is not fixed for 16w43a, see also MC-109277

marcono1234

migrated

Unconfirmed

fishing_bobber, inGround, inTile

Minecraft 1.9, Minecraft 16w15b, Minecraft 16w43a

Minecraft 16w44a

Retrieved