Hello guys and welcome back to another minecraft mod tutorial in says episode we’re going to be doing food and crops so let’s get started first things first we’re going to go into item in it and create a new section called food it’s going to be a public static final item Which I’m going to call a bowl of rice or rice bulb and it’s going to equal a new item custom food we are going to create the class item custom food and put it into hard objects got items dot food this is going to extend I some food And implement I has model as normal we are then going to create the constructor with a string name in amount this is how much and how many food things it restores so each of one each value equates to half of a food in slot so 20 will restore will restore from nothing To full and then one more variable called billion is wolf food this is saying if you’re African a wolf will eat it so let’s go into super author amount and is well food make sure you import item food then set on localize name to name set registry name to name set creative tab To may not have mod author toriel and then item in it dot items dot add this then register models again main adopt proxy dot register item renderer this zero inventory and that is the item food class done if we hover over item custom food and item it and add the arguments The name is going to be rice bowl the amount this restores are going to be eight which will be for hunger bars and it is not wolf food and that’s food done in our creative tab we have this thing called bowl of rice I’m going to go into Survival mode give myself hunger so I can lower my hunger and now if I eat this as you see goes up for hunger bars now will for the crops first thing we need a seed which I’m going to have as rice so public static final item called Rice equals new item rice each seed has to have its own class with rice then its hunger again so as I’m going to have my rights be a food item as well as an a seed that you can eat so create class item rice put it in dot objects dot items dot food Services can you send us some food again implement I have muddled and also I’ve hunter Bell controls you have to input ice and food then go into item custom food and copy everything from here into item rice click change constructor and that’s all the food stuff done then We’re going to need to add the unimportant methods that I plant or gives us called get plant type and get plant get plant type once the type of plant it is so return in on plant type dot crop and then get plant once the actual earn block which we’re going to Create a bit so return block in it dot rice plant get a default state and finally be one more function which is the on item use this is what happens when you right click onto a block so item static stack equals player dot gets held item in hand which is a function Here so again the held item which is obviously going to be this item then I block state state is welding dot get block state at the current position the block by clicking on then if the way it’s facing is enol facing top and player adopt can play it Edit pause dot offset facing facing and stack then and again state doctor gets block doctor can sustain plant the state welding pause facing this sorry even facing to up and the final one and and welding dot is air block positive up so what is it saying if it’s the block is Fitting up the player can do something to that block the block can have a plan placed on it so if it’s a grass or a dirt block or a crop block and above that block there is an air block then you can place the plant so we place the Plant world in dot set block state pause the hot block in it dot rice plant don’t get default state stack shrink one so we offers have one less seed when we place it down return enum action result dot success and outside of that all this else return Genome action result dot fail and that is all the seed class done you have to go and repeat all of those steps but the seeds work just like a normal item so you do exact anything we just did for food so now obviously we need to create The actual block that we were referring to inside of there so if you’re going to block in it and create a new block public static final block rice plant equals new block Christ plant with the name as the parameters rice planet then create the class put it Into two objects the blocks and eight tens block crops we’re going to need the constructor with a string name say local eyes name to name and set registry range name as well then obviously added to the Block in it item in it new ice and block of this and Set the reddish name to get register name make sure to miss out the creative tab for this one as we don’t need a creative tab as it’s only something we can place done using the seeds then unlock activate it this is when the block is Right clips if world in dot is remote it will it when it isn’t remote if this dot is max age this is max age function comes from block crops after is something called a property integer called age which with an eight different vote values from zero to seven of how Old the prop is then world in spawn entity a new entity item world in pulse blog x postal get Y postal get said and then a new item stack of item in it dot rights and there’s how many quantity you want to drop out up to then world in Dot setblock state pause this doctor with age zero so it’s back to the original and return true and then if that’s all you know that never happens return false then we’re going to get get seed is item in it dr. rice gets crop this is what number What drops is also item a endure rice don’t read to return I tomato rice sorry then it gets a bounding box as the bounding box is different depending I’m just looking this in as it’s really really really long but basically it is an array of bounding boxes access the Line BB which I call rice which has eight different bounding boxes that are all the same except from the height value keeps increasing from not one two five nine to five not by 375 this is for the age when it’s growing the height value increases then get in get bounding Box you return your the name of your bounding box array rice then open up writing of our hits then two brackets put integer then outside of one bracket state dot gets value this dot get age property and then outside of all those buckets dot into value and that would give you The correct bounding box for the age and that is the plant done obviously for the blog states create a new block state called rice plant and then there’s going to be different AG equals 0 h equals 1 h equals 2 and then rice planters they’ve Arrived camp one might plant 2 and so on then in lang we just need tile doctor rice plant dot name equals rice plant in block models there are seven different block models will eight different blah blah sorry for each stage so it’s important but it’s parenting off Of block crop and then when it says textures it has to say crop here not normal it has to be crop and then this will be T M blocks rice plant 0 and for the item model you will need one just called right plant which parents off of Parents off of the item rice so the actual see their parents off that so parent TM item rice and then obviously need eight different textures which are at different stages of the growth and then once they end and we create on the game then we hold the ground and place The right rice down as you can see here we have stage one if we bonemeal it it increases increases again and when you right-click on the air max age it drops to rice and we can get lots of rice and that is the crop done so if you have Liked this video please look like button down below and subscribe for more videos I’m almost at 1000 subscribers so thank you so much for that I’ll making a special video for it we can take up the play the thing down below thanks for watching man has been hairy and goodbye Video Information
This video, titled ‘Food and Crops – Minecraft Modding Tutorial 1.12.2 – Episode 22’, was uploaded by Harry Talks on 2018-03-14 22:39:03. It has garnered 9354 views and 179 likes. The duration of the video is 00:15:01 or 901 seconds.
Welcome to the Food and Crops tutorial where I create a rice plant, rice and a bowl of rice.
Links GitHub: https://github.com/HarryTechRevs/MinecraftModding/tree/HarryTechRevs-1.12.2-Tutorials Discord: https://discordapp.com/invite/xwg8zQJ Playlist: https://www.youtube.com/playlist?list=PLiDUvCGH5WEUEV9nc0Ll2pzUFmSFc21uR Subscribe: http://tiny.cc/sub2harrytech Twitter: https://twitter.com/harrystechrevs