So I'm using the ItemCraftedEvent for something sortof non-conventional; random chance stuff and it's been working as planned until I noticed an issue. If I just click and drag items out of the craft slot, one in a random number ends up being enchanted. If I shift click the item out of the slot, they are never enchanted even though my logging says it runs through the code block.
My event is subscribed properly etc.
public class CraftingEventHandler {
@SubscribeEvent
public void craftingTableEvent(PlayerEvent.ItemCraftedEvent event){
Random rand = new Random();
int chance = rand.nextInt(10);
if(chance > 7){
event.crafting.addEnchantment(Enchantment.getEnchantmentByLocation("efficiency"), 2);
Element.log.log(Level.INFO, "Added Enchantment");
}
}
}
Any ideas what I may be doing wrong? (also, it's been a *long* time since I've tinkered with any of this, sorry if it's something stupid)