Posted August 21, 20205 yr i'm trying to make a food which will heal you, but when i use the .effect, the intelliJ says that effect is deprecated, what should i do? super(new Item.Properties() .group(BetterItens.TAB) .food(new Food.Builder() .saturation(1.2f) .effect(new EffectInstance(Effects.REGENERATION, 200, 1), 1) .effect(new EffectInstance(Effects.HEALTH_BOOST, 300, 1), 0.2f) .build()
August 22, 20205 yr If you navigated to the source, you would've found a little comment saying 'Forge: Use supplier method instead'. So do as it says.
August 23, 20205 yr Adding to what ChampionAsh5357 said, You need to use the supplier method which looks like this: .effect(Supplier<EffectInstance> effectIn, float probability) You can take your deprecated code and modify it easily by adding a lambda and passing no parameters: .effect(() -> new EffectInstance(Effects.REGENERATION,200,1),1) .effect(() -> new EffectInstance(Effects.HEALTH_BOOST, 300, 1), 0.2f)
August 23, 20205 yr 14 minutes ago, Tricky_Trap said: adding a lambda and passing no parameters: a lambda taking no parameters* Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.