Here is code that will refund glass bottles from EXP bottles and emeralds / emerald blocks.

Two parts to this commit.  If you use an emerald or emerald block, this will generate
the equivalent # of empty bottles to the amount of xp generated.

If you right-click on an enchanting table with EXP_BOTTLES, it will give
the player the XP inside of the bottle, as well as replacing the exp
bottles with empty glass_bottles.