I'm trying to make an item that levitates the player while they are using the item (right clicking), but these two methods don't seem to ever be called by the game in order to stop the levitating effect.
public ActionResult use(World world, PlayerEntity user, Hand hand)
{
if(user.hasStatusEffect(StatusEffects.LEVITATION)) return ActionResult.PASS;
user.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, -1));
return ActionResult.CONSUME;
}
@Override
public boolean onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks)
{
System.out.println("Stopped");
if(!user.hasStatusEffect(StatusEffects.LEVITATION)) return false;
user.removeStatusEffect(StatusEffects.LEVITATION);
return true;
}```