VanillaDev/Vanilla — pull request #311 by stewbasic (2012-09-08 05:04:19+00:00)
Title: Generate random enchantment level and add random enchantments

(addressing http://issues.spout.org/browse/VANILLA-111)
*Added EnchantmentUtil.getRandomEnchantmentLevel to generate random
enchantment level
*Added EnchantmentUtil.addRandomEnchantments to add random enchantments
to an ItemStack
*Logic for both basically copied from Minecraft 1.3.2 source
*Fixed bug in Enchantments.values(), which was assuming the enchantment
ids were consecutive
*Fixed bug in EnchantmentUtil.addEnchantment etc, which weren't putting
the NBT data in the correct format
(http://www.minecraftwiki.net/wiki/Player.dat_Format#Item_structure)
*Fixed bug in ToolEnchantment.canEnchant (returned true on bows and
swords)
*Added tests EnchantmentTest and EnchantmentUtilTest
*Changed "enchantment level" to "power level" in places to distinguish
between the power level of an enchantment (I, II, III, IV, V) and
the enchantment level displayed in the enchantment interface (1 to
30)
Signed-off-by: stewbasic