Let’s add a custom food to Minecraft Minecraft modding courses with close to 100 topics ranging from Custom tools and armor to custom block entities all the way to custom mobs Linked In the description below oh oh right we finished us back in each other once more and in this tutorial we’re Going to be adding a custom food to Minecraft and it is going to be a tomato and it is going to be absolutely freaking fantastic to add a custom food item to Minecraft in the item package we will need to make a new Java class and we’ll call this the mod food components As this is where we will Define every one of the properties that this food possesses and this is going to be a public static final food component I want to call this the ATO Mato tomato tomato and we will make this a new food component that Builder right here it Already suggests this to us and we can then say okay how much hunger does this have you can even say is this always edible is this a meat is this a snack and we can even add a status effect which we will see in just a moment but First of all adding the hunger here let’s call this a three hunger and the saturation modifier is going to be 0.25 I think that’s fair and then we can add a build right here or if you want to be adventurous you can also add a status Effect right here so you can see we can make a new status effect instance of status effects Dot and then we can add a status effect a tomato what would that give you how about this gives you a little bit of luck over here I think that’s pretty Good and you can also add the length in this case the duration is going to be in ticks so this would be 10 seconds and then the second parameter in the status effect method is going to be the chance so let’s call it a 25 chance here that You get the luck effect when you eat the tomato poor vanilla values of all sorts of vanilla food you middle Mouse might click on the food component middle Mouse by click again and you go into the food components class which has every single vanilla food available to you to take a Look at both in terms of the hunger and the saturation modifier it provides but also the status effects so for example a chicken this is a raw chicken when you eat it it has a 30 chance of giving you the hunger effect even though sometimes It feels like it’s a little bit more the code doesn’t lie so highly recommend it to take a look at this particular class over here and then we can proceed in the mod items class because of course we still need to make the Tomato item for This we’ll just copy over the raw Ruby and we will rename this to to motto and then hear the same thing tomato and this is just a new item the only thing that changes is the fabric item settings on those we call the food method passing in mod food components that tomato and There we go with that we got our custom food item we can now add it to the creative mode tab I also added the translation and the item model Json file as they are completely normal and nothing spectacular for them and then we can copy over the texture in this case Which is of course going to be available to you for download as well and that’s everything we need to do so let’s jump into the game and eat some Tomatoes alrighty finds us back in Minecraft as you can see the tomato has been successfully added and let’s eat some of it And there we go it fills up 1.5 legs of hunger over here that’s going to be very interesting indeed and we can eat another one and there we go and we even got the luck effect there we go we got the luck of the draw and now we’re even Luckier absolutely amazing and that is a custom food item added to Minecraft and it of course restores 1.5 lakhs of hunger because half a leg of hunger is represented by one over here in this case that should hopefully explain that as well so that’s gonna be for this Tutorial right here next time we’ll add a custom fuel item to the game hope to see you there so yeah Video Information
This video, titled ‘Fabric Modding Tutorial – Minecraft 1.20: Food Item | #8’, was uploaded by Modding by Kaupenjoe on 2023-07-27 15:00:01. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
In this Minecraft Modding Tutorial for Fabric, we are adding a custom Food Item and it’s freaking amazing, even Gordon Ramsay …