#Making custom Item Class

7 messages · Page 1 of 1 (latest)

fickle gyro
#

how would i make a custom item class
so that an item is drank
like a bucket of milk
or a potion
but feeds u

serene viper
fickle gyro
#
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?