[MC-2188] Item gets used when right clicking on a saddled pig Created: 04/Nov/12  Updated: 17/Aug/16  Resolved: 11/Aug/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.2, Minecraft 1.4.5, Minecraft 1.4.7, Minecraft 1.5, Minecraft 1.5.1, Snapshot 13w16a, Snapshot 13w16b, Minecraft 1.5.2, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w38a, Minecraft 13w38b, Minecraft 13w38c, Minecraft 1.7.4, Minecraft 14w03b, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 14w21b, Minecraft 1.7.10, Minecraft 14w33c, Minecraft 14w34a, Minecraft 14w34b, Minecraft 14w34c, Minecraft 14w34d, Minecraft 1.8-pre1, Minecraft 1.8-pre2, Minecraft 15w32b, Minecraft 15w42a, Minecraft 1.8.9, Minecraft 15w51b, Minecraft 16w02a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.2, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2, Minecraft 16w32a
Fix Version/s: Minecraft 16w32b

Type: Bug
Reporter: Orion Humphrey Assignee: [Mojang] Grum (Erik Broes)
Resolution: Fixed Votes: 12
Labels: item, pig, saddle
Environment:

Windows 7 32 bit, Java 7 Update 9


Issue Links:
Duplicate
is duplicated by MC-11695 Right-Click actions are still perform... Resolved
is duplicated by MC-69597 When riding pig, right-click action i... Resolved
Relates
relates to MC-14525 name tag item doesn't work on entitie... Resolved
relates to MC-19033 Pig with a saddle loses name and you ... Resolved
relates to MC-106302 Unable to name saddled pigs Resolved
CHK:
Confirmation Status: Confirmed

 Description   

When hold an item such as a splash potion or ender pearl, right clicking on a pig will use that item and make you get on the pig. Same thing for getting off.

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



 Comments   
Comment by Marcono1234 [ 11/Aug/16 ]

Confirmed fixed for 16w32b

Comment by null (Inactive) [ 23/Jun/16 ]

Confirmed for 1.10.2.

Comment by null (Inactive) [ 22/Jun/16 ]

Confirmed for 1.10.1.

Comment by null (Inactive) [ 08/Jun/16 ]

Confirmed for 1.10.

Comment by null (Inactive) [ 07/Jun/16 ]

Confirmed for 1.10-pre2.

Comment by null (Inactive) [ 03/Jun/16 ]

Confirmed for 1.10-pre1.

Comment by null (Inactive) [ 26/May/16 ]

Confirmed for 16w21b.

Comment by null (Inactive) [ 25/May/16 ]

Confirmed for 16w21a.

Comment by null (Inactive) [ 18/May/16 ]

Confirmed for 16w20a.

Comment by null (Inactive) [ 11/May/16 ]

Confirmed for 1.9.4.

Comment by Marcono1234 [ 08/May/16 ]

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The reason for this is that the method net.minecraft.entity.passive.EntityPig.func_184645_a(EntityPlayer, EnumHand, ItemStack) always returns for the client that it did not successfully interacted with the pig. Instead it should return that it successfully interacted with the pig but only start riding the pig server-side.

public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_)
{
    if (!super.func_184645_a(p_184645_1_, p_184645_2_, p_184645_3_))
    {
        // Replaced this
        //if (this.getSaddled() && !this.worldObj.isRemote && !this.isBeingRidden())
        //    {
        //        p_184645_1_.startRiding(this);
        //        return true;
        //    }
        if (this.getSaddled() && !this.isBeingRidden())
        {
            if (!this.worldObj.isRemote) {
                p_184645_1_.startRiding(this);
            }
            
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
Comment by null (Inactive) [ 06/May/16 ]

Confirmed for 1.9.3-pre3.

Comment by James (inactive) [ 15/Mar/16 ]

Confirmed for 1.9.1-pre3.

Comment by James (inactive) [ 13/Jan/16 ]

Confirmed for 16w02a.

Comment by James (inactive) [ 03/Jan/16 ]

Confirmed for 15w51b.

I've tested this with water/lava buckets, snowballs/eggs/ender pearls, and all boats.

Comment by Marcono1234 [ 16/Oct/15 ]

Confirmed for

  • 15w42a
Comment by uzon [ 07/Aug/15 ]

Confirmed in 15w32b.

Comment by S P [ 24/Aug/14 ]

Confirmed in 1.8-pre1

Comment by Marcono1234 [ 23/May/14 ]

Confirmed for 14w21b

Comment by Hartspoon [ 03/Mar/14 ]

Still a concern in 14w08a.

Comment by Tails [ 25/Nov/12 ]

Confirmed in 1.4.5.

Generated at Sun Jan 12 11:57:01 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.