Hey guys mr. crayfish and welcome back to my mudding tutorials in this tutorial today I’m going to be teaching you how to add food into the game so a couple of people have been asking me how do I add food and I thought I would do food Before I go onto tools and stuff like that because tools are a little bit harder but they’re not extremely hard but foods a lot more easier to start off with so we’re going to be adding food into the game today so let’s get straight into it actually I’ve actually Removed all the code from the previous two tutorials because I don’t really need it you guys can keep it in for your mod and basically I’m just showing you how to add in food I’m not creating a mod as such but in the few or further in The toriel’s we we will be creating a mod and showing you how to distribute it afterwards so what we’re going to do is create a new line under here just put this under your item variables that we created from last tutorial doesn’t really matter so I’m going to type Public static item and then we’re going to type in um item and then the name of your food see item cheese we’re going to create cheese or something like that and then you’re going to click on the first import here it should have net dot minecraft item and inside the pre Initialization method here what we want to do is type in item cheese or the name of your food and you want type equals new item now I’m not just item we’re going to type in item food then to brackets on the end and a semicolon highlight over item food and you want to Import the first one here and then you’ll see that it’s still got a red line under it what we’ve got to do is click on writers – there’s two of these here let’s have let’s take a look at the item food class to be honest so pressed I know we can’t I think first control press control and then click on item food and you see that highlights over it click it and take us to the food class here let’s have a look what these two variables do all right so this first one here is the Heal amount this first the second parameter here is the saturation so if you guys know in Minecraft or the saturation certain foods will keep your hunger bar up for longer that’s how we can modify that and then this third billing is Wolf’s favorite meat and this Allows you to actually feed the food to your pet wolf or pet dog essentially so we want to do inside the brackets here is you want to decide how much your food is going to heal so how the calculations work is it’s basically X whatever X is What X is your variable that you put in x 0.5 and that will give you answer so the max number you can do in there is 20 because 20 times 0.5 equals 10 hearts and you’ve only got 10 hearts on minecraft if you put in 5 you will only Get 2.5 hearts so that’s better it’s basically just half of whatever you put in there so I think we’re going to make this a superfood and I’m just going to put 20 in there for fun then the next variable put a comma after that number there is the saturation so I think we’re Going to make this quite a P but what you want to do is type in 1.0 F or you can do a lower number that’s I’m not sure how high this can actually go up to haven’t really tested around with it but you can do variables like 0.5 F if you Want and the saturation will last half the time as this item she’s here you can do 0.2 which is very low and you almost have to eat another piece of food straight afterwards I’m just going to do one point ouf and then the neck the last Variable is if this food can be eaten by a wolf so I’m going to make it so it can be so go ahead and type in true if you don’t want it to be eaten by a wolf put in false then again we’ve just got to register the items a game registry dot Register item put in item cheese and then for the second bit here put in item cheese again and then get on local eyes name dot substring five so I’ll just let you guys have a look at that now we’ve actually got to set the unloader loads Name up here as well so you set after the brackets set I’m local Ayres name and I’m just going to call this item cheese now if we go ahead and we load up the game and if you get this message or something like that don’t worry oh just For me because I actually removed the items from the game it’s going to give me this error because they can’t find those items are blocks in the save again just click yes it doesn’t really matter that message which only apply if you’ve actually distributed the mod already and It’s released to the public in someone and created a proper serious world that they actually using to play in that would worry because you would need to get those items in your mod again so what we’re going to do is we’re going to type food slash again food slash give Tab one space your mod ID and then press tab and then we see what we’ve got item cheese and now we’ve got a delicious food we’re just going to go into game mode s and we’re actually going to lose some of our hunger so let’s start running around everywhere All right I think we’ve depleted it enough it’s almost at zero now so we’re simply going to eat the item now so do it like any normal item right click it and notice that we start eating a our hunger bar went back up to full and we’ve practically got max saturation Which is crazy so that’s how you create food items I’m just going to go back into the code and I don’t suggest that you set the values to this this is absolutely IP I suggest that you set the values to a lot lower C for the twenty Here set it to something under twenty like ten or five just play around with the values until you get saying that you like with this 1.0 F this is the saturation so 1.0 is max saturation I’m not sure if you can put it higher than that possibly can see if you want a Really high saturation food put this up really high usually they’re below 1.0 FC I think beef is actually 0.8 F and if you guys knew beef is the most saturated food in the game obviously 1.0 is a lot more is a lot higher what is higher than 0.8 so it’s actually going to give you a longer saturation now we’re not completely done with this tutorial what we’re actually going to do is make it so you can actually cook this food in the oven to create a new food now I’m actually going to change these values Down I’m going to change this one to eight I’m going to change the saturation to 0.5 and then I’m going to make it so this is false and I’m going to create a new piece of food so we’re just going to do the same public static item let’s go Either item grilled cheese so this is going to be cooked in the furnace guys and then again initialize the item so item grilled cheese equals new item food then just put in your values so I’m going to do the same as Y I’m actually I’m just going to double them 16 1.0 F And then make this true so I’ll wolf can eat it set the unload class name whoops what’s this absolute is just giving me random crap set unlike Allies name and then we’re going to put that as item grilled cheese and then just end it off with a Semicolon I’ll give you a second to look at that and then register the item say game registry dot register item so put an item grilled-cheese if you’ve got a clips you can simply just press down on the arrows and then press Enter when you highlighted over item grilled-cheese There then we just have to enter it again here because it doesn’t come up item grilled cheese and Andy get and localize name dot substring five now give you a second to look at that again now to make this item cheese smelt into item grilled cheese what we’ve got to do Is type in game registry dot register register what is it register I know no name a bad it’s not register its dot add smelting so you want to put the second variable the second option here click on that and then put in item cheese for the first One and then for the output what is the output taking it’s an item stack so for the output bit here what you want to do is type new item stack and then put in item grilled cheese into those brackets there highlight over itemstack import it and then the XP amount what value does That take a flute so I think we might put in 5.0 F now you probably have to play around with this valley a little bit here so you could do the one you give to ten you do a hundred I don’t really know I’m just going to do five For the flake there it might be a little bit too overpowered but we’ll see how it goes so put that in there we load up the game make sure you save it as well why are you going I keep forgetting to tell you guys that save it as you go and We’re going to go back into game mode see get out a furnace get out some CO and then place that down put the coal inside and then we’ll get our item so I give you should know how to do this now so give yourself the item So I’m going to give myself item cheese go inside the furnace here put item cheese in and then you’ll see that it is now cooking and it will give us our item grilled cheese now we’ve still got to add the names to them as well I just Thought I would go over this real quickly get our item grilled cheese now and this we should be out or we can’t eat it because we’re in creative so yeah that’s how you add smelting or cooking to the furnace and you can do that with Ores as well and that we’re going to get that get into that as well once we start looking at ores and i/o we still got to do ores and generation that’s something I haven’t done in a while so that’s going to be new for me now we’re going To add the names to the items so simply go into the en-us Lang file or whatever you’ve some guy said in the comments that he could that you could um that he wanted to make a Spanish one so if you’re doing like a Spanish one or Something like that what you can do is type instead of en underscore you OS for your file you type ES underscore M X dot Lang and that stands for s panel Mexico or something like that so under your item oh wait this we don’t really need this anymore Because that was our old blocks so in your en-us Lang flow type in item dot the name of your item so you all the unlike lows names like item cheese copy that put that in and dot name equals I’m just going to call it cheese and then do the Same for the other one so item and then other ones item grilled cheese copy/paste dot name equals grilled cheese now just one tip as well I figured to mention this make sure there’s no spaces in between this equal bit here so they don’t have a space There I don’t have a space there it needs to be exactly after it now press the Save button up here to save the length file and then we’ll run the game and then after this works we’ll start adding some textures to it and here we go it now says for our grilled cheese That we’ve got grilled cheese we’ll quickly just go get the other one so give the forge that name cheese so this one’s named cheese and it’s net once named grilled cheese because it was cooked in the furnace now we’re just going to add some textures to them so You should know how to do this if you’ve followed previous tutorials so I’m just going to create some and we’re gonna save them into the items this over here this texture this items folder that we’ve got over here and then we’re going to set the name so create the texture And then put it into this items bit and then we’ll come back so I’ve created two textures now I’ve created item cheese which is here atom cheese and then we’ve got their item grilled cheese so that’s just a little bit darker wasn’t going to do anything too crazy and what we’re Going to do now is we’re going to set the texture name so at the end of set unlike last name just do set texture name and then this is item cheese so I want to put in tutorial mud item cheese and then for the grilled cheese the same Thing just grilled cheese so set text your name oops what did that do set come on set texture name TM item grilled cheese and if we go ahead press save and we run the game now and you’ll see that we’ve got cheese and then we’ve got grilled cheese so there we go guys That’s how you add food into Minecraft and before we end up in this episode just a brief overview and then that will finish it off so create your variables up here just simply your item public static item then your name and then semicolon at the end initialize them by instead of item for Item food and then we’ve got to enter three parameters the first one is the heal amount see how many hunger bars that will actually heal up so it’s basically half of the number here so eight will heal up four bars and then the next one is the saturation see a Higher saturation is 1.0 F a low saturation is probably zero point two beef is zero point eight so if you take it to note that beef is the highest session you should be able to create something that’s quite even and then false or this next value is a boolean’s So false means that a dog can’t eat it if it’s true that means a dog can eat it then just make sure it’s you set your unlike last name and then set the texture name and then register it down here simply first variable then get on localize name and substring up by five Then we just add it to the smelting say for your item cheese and then make the output to a new item stack item grilled cheese and then put 0.5 F on the end and there we go guys or you don’t have to put 5.0 F that’s whatever you want the XP amount to give you when you smelt it and yeah that’s basically how you add food in and add it to the smelting list so hopefully enjoyed this tutorial today in the next episode I think we’re going to work on tools so this is going to be Cool people like to add tools into the game so make sure you stick around for that episode and I will see you then but Video Information
This video, titled ‘Minecraft 1.7: Modding Tutorial – Episode 6 – Food!’, was uploaded by MrCrayfish on 2014-07-16 16:30:01. It has garnered 30446 views and 596 likes. The duration of the video is 00:17:14 or 1034 seconds.
Hit that like button if you are keen for the next episode!
Paint.NET: http://www.getpaint.net/
Basic Java Tutorials: https://buckysroom.org/videos.php?cat=31&video=17969
Hey guys, today we start a highly requested series and this is modding tutorials. In this episode today, I teach you how to code in food to the game. If you are enjoying this series, please remember to hit the like button, comment and subscribe!
★ Cray’s Social Media Links ★ ● Facebook: https://www.facebook.com/MrCrayfish ● Twitter: https://twitter.com/MrCraayfish ● Instagram: http://instagram.com/mrcraayfish ● MinecraftForums: http://www.minecraftforum.net/user/596140-mr-crayfish/ ● PlanetMinecraft: http://www.planetminecraft.com/member/mr_crayfish/
★ Sponsors ★ Looking for an affordable but good performing Minecraft server? Check out PickleHosting and use the code “CRAYFISH” to get 20% off your first month! https://billing.picklehosting.com/aff.php?aff=421
Want a Gaming PC but not sure what parts to select or not confident in building it? Try PheonixPCs. They offer pre-built Gaming PCs so you dont have to worry about setting it up. Use the code “CRAYFISH” to get free shipping! http://www.phoenixpcs.com.au/