Jump to content

Biviss

Members
  • Posts

    1
  • Joined

  • Last visited

Biviss's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi! I just started learning forge yesterday and ran into the same issue. I couldn’t find any documentation about these changes, but I found a way to add effects to food like this: public class ChakChakItem extends Item { private static final FoodComponent FOOD_COMPONENT = new FoodComponent.Builder() .nutrition(16) .saturationModifier(0.4f) .build(); private static final ConsumableComponent CONSUMABLE_COMPONENT = ConsumableComponents.food() .consumeEffect(new ApplyEffectsConsumeEffect( new StatusEffectInstance(StatusEffects.SPEED, 15 * 20, 1), 1.0f)) .build(); public ChakChakItem() { super(new Item.Settings() .food(FOOD_COMPONENT, CONSUMABLE_COMPONENT) .registryKey(RegistryKey.of( RegistryKeys.ITEM, Identifier.of(ChakChakMod.MOD_ID, "chak_chak") ))); } } If the code isn’t perfect, I apologize. Hopefully, others here can help us find a better solution.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.