#Making custom Item Class
7 messages · Page 1 of 1 (latest)
For potions: https://docs.fabricmc.net/develop/items/potions
For food, something like this, replace the ... with the values you want for your food:
public static final Item MY_FOOD = new Item(Identifier.of(MOD_ID, "my_food), new Item.Settings.food(new FoodComponent(...)));
public static final DrinkItem BOTTLE = (DrinkItem) register(new DrinkItem(new Item.Settings().food(DRINK_LIQUID)),"bottle");
got this working but i have more issues
public class DrinkItem extends Item {
public DrinkItem(Settings settings) {
super(settings);
}
public int getMaxUseTime(ItemStack stack, LivingEntity user) {
return 32;
}
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}
i ahve this custom item class im using
but since ive got it replenishing hunger via the item.settings().food component it has a little eating sound at the end which i dont want
is there a way i can fill hunger inside of the item class itself as oppose to using settings().food components?