Hey what’s going on guys turkey worthy here and welcome back to another minecraft modding tutorial for version 1.16 in this tutorial i’m going to be covering how we can go ahead and create a food so as it is just a normal item and we do need to go into our item in it And let’s go down to right here and create a new field so we will create a public static final registry object and this will be our food item so that’ll just be a normal item and obviously we can use our custom class for this if we wanted to have A food with a special class or we can also use a block item if we want an edible block item but i’m just going to have it be a normal item and i’m going to call this an example underscore food and that’ll be equal to items.register So so far is the same as a normal item and obviously example underscore food it’s a supplier of a new item and then it’s a new item dot properties so it’s still the same and we still set the group so that is tutorial Mod dot tutorial group Now this is where we add the food so in the um advanced items tutorial i briefly covered some of the properties that you can add for an item and luckily food is actually one of those which makes food extremely easy to do So we just need to put dot food and this takes in i think a new food dot builder And just import food and here you just do all the properties of the food so we can say what effects it gives us so for example we can say that um we need a supplier of a new effect instance i did briefly cover this in my advanced items uh video And in this effect instance um there’s a bunch of different overloads for it however i’m just gonna use i’m going to use effect int int and this will just first be the effect so that will be effects dots and there’s all these different effects of course um i’m going to give I’m just going to make it give you speed and then the second parameter is the duration so this is in ticks i’m going to give it you that’s not english i’m going to make it give you 200 i’m gonna i’m going to give it to the player for 200 ticks Um so that’s what 20 seconds And then this is the amplifier so um speed 2 for 20 seconds oh i’ll actually just say 100 seconds at 100 ticks that’s five seconds right five seconds yeah five seconds so 200 was actually 10 seconds i can’t math okay um and then this is just the probability Of you getting this effect so if you say 1.0 f there’s a 100 charge you will get that effect if you say 0.0f you’ll never get that effect so i’m going to actually just put it right in the middle and say 0.5 obviously you have to say f because it is A float um not f in the chat just f and then we can just add other properties after it so let’s say we go here and it doesn’t want to give me the other properties but there are more you’ll have to trust me with this um wait no i am too many out Okay there we go yeah um and then we can say it’s fast eat so for example um dried kelp i believe is very fast eat i’m actually going to set that property we can say obviously how much hunger it gives you so this is an integer and one One would be half a hunger bar two would be a full hunger bar so i’m going to say that it just gives you two yeah it’s not going to be a great food and then we can say if it’s a meat and if it’s a meat That means that dogs will be able to eat it um mine is not going to be a meat so i’m going to skip that one and then we have the saturation so how much saturation it will give you if you say i’m not entirely sure how saturation works but i think If you say 1.0 f that’s like one piece of saturation i’m not really sure um i’m not too sure you can check vanilla foods of course so i think that they actually have a specific class for it yeah they do so um cooks okay so 1.0 f Looks like it might actually be full saturation 1.2 i’m not sure this is a saturation is a little weird as you can see golden apples and carrots give you 1.2 i’m just going to make this give you um 0.1 f of saturation so not that great um or maybe maybe 0.2 And then we can say that um you could say that it’s always edible so that means you can even eat it in creative i’m actually gonna do that i mean why not right um and then we can just build it in my personal opinion every food should be edible and creative I mean why shouldn’t it um i’m actually just gonna add another effect here so you’ll see there’s actually two effects hit there’s one with a supplier and one without and you may think well the one without is is simpler i mean why why not use that one instead And the reason we do that is just to make sure that it’s not null because um effects are registered around the same time as items and it’s possible um that if a mod has like loads of effects or loads of items that the effect may actually be null so we always want To use a supplier to ensure that if it is um we’re not gonna have you know any issues with it um i’m just gonna just um really quickly gonna make this give you poison well no i’m gonna make it give you hung no poison poison fine um and that will just be for Like um uh i i’ll say 60 so what’s that that’s um three seconds so not that great probably probability i’ll say 0.05 so it’s a low probability um just as example and i mean that’s pretty much it for a food you can obviously move this to your own Class or your own actual field for it so i’m actually going to do that so what we can do is we can create a new cli and this is only if you have loads of foods if you don’t have loads of foods in your mod it’s not really worth doing this But you can say like you have a class called i’ll just call it food in it we’re not actually initializing foods we’re just creating fields for them um but yeah it doesn’t really matter and this can just be a public static final um what can we call this um this is Actually going to be i’ll just call it an example food like that i’m an idiot it’s a food there we go and that will allow us to just go into our item in it and say um food in it dot example food and that just makes that a lot shorter We want to keep our init classes basically kind of as clean as we want because if we have um initialization errors we want to be able to go through our init classes and just see okay this one’s fine this one isn’t so that that’s one that’s wrong we don’t Want to have to say oh is this part of this one or is that over here like you you want to be able to tell them apart basically um so separating out uh i think is always good it’s it’s a personal thing of course so yeah i mean that’s pretty much It we can now just go ahead and do the jason’s and the lang that’s the exact same as the normal items tutorial so i’m going to go ahead and do that and i’ll be back with you when i’ve loaded up the game okay so guys as you can see i’m now in The game and if i go in my creative tab we can see my food here so that is uh a cherry and if i do press ctrl h you can see this is just ctrl h f3 and h you can see it is just my example food And i named it cherry in the lang and uh yeah you can eat it in creative because we set that it’s always edible and we actually got speed from this so that’s um that’s nice i didn’t mean to drop those and we shouldn’t get that every single time though Let’s let’s try and test this we didn’t set it to 1.0 did we i seem to remember we only said it’s a 0.5 probability yeah there we go we just ate one and we didn’t get it um and if we eat it loads of times there you go we actually got poison There um so that’s that’s uh very unlucky lucky but unlucky in this circumstance anyways and obviously if we go into um game mode survival we can obviously eat it and it will give us hunger um i will just have to drain my hunger down a little bit for that There we go so now if i eat you can see we get one uh thingy we can’t see saturation um i don’t have the apple core mod thing that does that um so we can’t see that but yeah um that’s that’s pretty much it oh i didn’t mean to do that Um so i hope you guys did enjoy this tutorial if you did please do be sure to smash your face into that like button and subscribe if you really enjoyed please do be sure to share it and uh hit that bell as well if you want to be notified when I next upload so yeah i will see you guys in the next video good bye hey Video Information
This video, titled ‘Custom Food – Minecraft Forge 1.16.4 Modding Tutorial’, was uploaded by TurtyWurty on 2021-01-17 22:45:11. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
In this tutorial, I show how to create a custom food using the Forge API. || Important Information || My Discord Server: …