Posted May 2, 20205 yr Basicly like mushroom stew. When it's used (eaten) to give the bowl back. I saw online to use "return new ItemStack(Items.BOWL);" but it says "Unreachable code". Here is the hole thing: package com.martiblq.stew_mod.objects.items; import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.world.World; public class BabyYodaStew extends Item { public BabyYodaStew(Properties properties) { super(properties); } @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { return super.onItemUseFinish(stack, worldIn, entityLiving); return new ItemStack(Items.BOWL); } }
May 2, 20205 yr You're already returning super#onItemUseFinish, you cannot return twice. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
May 2, 20205 yr Author so it returns the bowl but now it doesn't feed you. here is item init Spoiler event.getRegistry().register(new BabyYodaStew(new Item.Properties().group(stew_modItemGroup.instance).food(new Food.Builder().hunger(20).saturation(20f).build())).setRegistryName("baby_yoda_stew")); and here is the class Spoiler package com.martiblq.stew_mod.objects.items; import net.minecraft.entity.LivingEntity; import net.minecraft.item.Food; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.world.World; public class BabyYodaStew extends Item { public BabyYodaStew(Properties properties) { super(properties); } @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { return super.onItemUseFinish(new ItemStack(Items.BOWL), worldIn, entityLiving); } }
May 2, 20205 yr You're misusing onItemUseFinish, the ItemStack is whatever item they're currently eating. By putting a stack of bowls in there, you're telling the game that the player is eating (or more accurately "using") a bowl. Look at how SoupItem does it. Edited May 2, 20205 yr by imacatlolol I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
May 2, 20205 yr Use your IDE's search function. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
May 2, 20205 yr Author Can you show me what is wrong with the onItemUseFinished?Can you show me how it must be?
May 2, 20205 yr That's not how it works here. We are averse to copy-paste code I will make fun of you if you are not able to look into the (vanilla-) code.
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.