Aerial Affinity

Aerial Affinity

94.9k Downloads

Enchantment cannot be applied to Colytra Bauble

jonqrandom opened this issue ยท 1 comments

commented

The enchantment can be applied to the regular Elytra just fine, and carries over when it's crafted into a bauble - but it can't be applied directly to the Elytra in bauble form. The bauble form can accept Unbreaking and Mending enchants directly. Not a big issue, but I thought it might be worth mentioning

commented

Somewhat related, is that it can be applied to books. I guess this was meant to allow enchanted books with it, but stored enchantments work differently from a book which has been enchanted.

Both issues could be fixed with something along the lines of

	@Override
	public boolean canApply(ItemStack stack) {
		return stack.getItem() instanceof ItemElytra ? true : super.canApply(stack);
	}

You might also consider allowing any bauble enchanted with it to work, since the restriction should be on enchantability rather than usage.

	@SubscribeEvent
	public static void breakSpeed(PlayerEvent.BreakSpeed e) {
		EntityPlayer p = e.getEntityPlayer();

		if (!p.onGround && (EnchantmentHelper.getMaxEnchantmentLevel(AERIAL_AFFINITY, p) > 0 || Util.getAerialAffinity(p))) {
			float oldSpeed = e.getOriginalSpeed();
			float newSpeed = e.getNewSpeed();

			if (oldSpeed < newSpeed * 5F)
				e.setNewSpeed(newSpeed * 5F);
		}
	}