So, I want to make an enchant that makes a player have jump boost. I'm using this code, but the effect applies as soon as a player enters the game. How do I fix this?
public class HighStepEnchantment extends Enchantment {
public HighStepEnchantment(Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotType[] slots) {
super(rarityIn, typeIn, slots);
}
@Override
public int getMaxLevel() {
return 1;
}
@Override
public int getMinLevel() {
return 1;
}
@Override
protected boolean canApplyTogether(Enchantment ench) {
return !ench.equals(Enchantments.FROST_WALKER);
}
@Mod.EventBusSubscriber(modid = MysteriousArtifacts.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public static class HighStepEquipped{
@SubscribeEvent
public static void action(TickEvent.PlayerTickEvent event) {
PlayerEntity playerIn = event.player;
playerIn.addPotionEffect(new EffectInstance(Effects.JUMP_BOOST, 20, 2));
}
}
}