bable631 Posted November 26, 2024 Posted November 26, 2024 So, I am following the 1.21 forge tutorials by Kaupenjoe on youtube, and I have run into a problem. In tutorial #8, which is the one about adding foods, he creates a food with effects by using .effect() on the FoodProperties, and he also shows a few other methods, .fast() and .usingConvertsTo(). None of the mentioned methods actually exist when I try to use them. They just aren't there. .saturationModifier, .nutrition(), .alwaysEdible(), and .build() are the only relevant methods that actually exist. What is going on here? Did something change between 1.21 and 1.21.3? I can't find any documentation anywhere. Quote
Biviss Posted November 30, 2024 Posted November 30, 2024 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. Quote
Recommended Posts
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.