Program: 187564
Project: 187564
Buggy source:
/** 
 * Is called when player rightclicks this MyPet return: true: there was a reaction on rightclick false: no reaction on rightclick
 */
public boolean a(EntityHuman entityhuman){
  if (super.a(entityhuman)) {
    return true;
  }
  ItemStack itemStack=entityhuman.inventory.getItemInHand();
  if (entityhuman == getOwner() && itemStack != null) {
    if (itemStack.id == Item.SHEARS.id) {
      for (      EquipmentSlot slot : EquipmentSlot.values()) {
        ItemStack itemInSlot=((MyPigZombie)myPet).getEquipment(slot);
        if (itemInSlot != null) {
          EntityItem entityitem=this.a(itemInSlot.cloneItemStack(),1.0F);
          entityitem.motY+=(double)(this.random.nextFloat() * 0.05F);
          entityitem.motX+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
          entityitem.motZ+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
          setPetEquipment(slot.getSlotId(),null);
        }
      }
      return true;
    }
 else     if (checkForEquipment(itemStack) && getOwner().isSneaking()) {
      EquipmentSlot slot=EquipmentSlot.getSlotById(b(itemStack));
      ItemStack itemInSlot=((MyPigZombie)myPet).getEquipment(slot);
      if (itemInSlot != null && !entityhuman.abilities.canInstantlyBuild) {
        EntityItem entityitem=this.a(itemInSlot.cloneItemStack(),1.0F);
        entityitem.motY+=(double)(this.random.nextFloat() * 0.05F);
        entityitem.motX+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
        entityitem.motZ+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
      }
      setPetEquipment(b(itemStack),itemStack.cloneItemStack());
      if (!entityhuman.abilities.canInstantlyBuild) {
        --itemStack.count;
      }
      if (itemStack.count <= 0) {
        entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex,null);
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Is called when player rightclicks this MyPet return: true: there was a reaction on rightclick false: no reaction on rightclick
 */
public boolean a(EntityHuman entityhuman){
  if (super.a(entityhuman)) {
    return true;
  }
  ItemStack itemStack=entityhuman.inventory.getItemInHand();
  if (entityhuman == getOwner() && itemStack != null) {
    if (itemStack.id == Item.SHEARS.id) {
      for (      EquipmentSlot slot : EquipmentSlot.values()) {
        ItemStack itemInSlot=((MyPigZombie)myPet).getEquipment(slot);
        if (itemInSlot != null) {
          EntityItem entityitem=this.a(itemInSlot.cloneItemStack(),1.0F);
          entityitem.motY+=(double)(this.random.nextFloat() * 0.05F);
          entityitem.motX+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
          entityitem.motZ+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
          setPetEquipment(slot.getSlotId(),null);
        }
      }
      return true;
    }
 else     if (checkForEquipment(itemStack) && getOwner().isSneaking()) {
      EquipmentSlot slot=EquipmentSlot.getSlotById(b(itemStack));
      ItemStack itemInSlot=((MyPigZombie)myPet).getEquipment(slot);
      if (itemInSlot != null && !entityhuman.abilities.canInstantlyBuild) {
        EntityItem entityitem=this.a(itemInSlot.cloneItemStack(),1.0F);
        entityitem.motY+=(double)(this.random.nextFloat() * 0.05F);
        entityitem.motX+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
        entityitem.motZ+=(double)((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
      }
      ItemStack itemStackClone=itemStack.cloneItemStack();
      itemStackClone.count=1;
      setPetEquipment(b(itemStack),itemStackClone);
      if (!entityhuman.abilities.canInstantlyBuild) {
        --itemStack.count;
      }
      if (itemStack.count <= 0) {
        entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex,null);
      }
      return true;
    }
  }
  return false;
}