Let’s draw some crops and add a custom crop to minecraft oh right we found ourselves back intelligent once more and in this tutorial we’re going to be adding a custom crop block to the game a crop block is actually a great example of the use of another block state property so i Highly suggest watching the tutorial that came before this as a refresher on block state properties because we’re going to need them in this tutorial so in our custom package we’re going to right click new java class called the eggplant crop block so we’re going to make an eggplant crop here and this will Extends the crop block class in this case not the block class we’re going to hover over this create constructor matching super and in theory we are done now we’re not quite done because if we actually middle mouse click on the crop block class you can see that the age Over here is an integer property so it’s just going to count integers and it’s going to go from zero all the way to seven so if we click on this you can see it goes minimum zero all the way to seven our crop actually only goes from Zero to six instead of seven so we just have to well do a few other things here so what we need to do is we need to make a public static final end property this one right here called age equal to in property dot of passing in the name h Min 0 and max 6 there you go now after we’ve done this we want to overwrite three methods the get max h method where we want to return six so this one needs to return exactly what we have in here we also want to overwrite the getageproperty method and then return The age of this class that’s also incredibly important and then last but not least which is also important we want to overwrite the append properties method callingbuilder.add passing in the age once again that’s almost all we need we actually need a fourth method we need the seed method so there’s a method that Is for the seeds so you can see get seeds item and that is going to get an item convertible now what i’ll do is i’ll make a purposeful arrow over here because we’ve not yet added the seats item we’re going to do that in a moment But if i have this error here then i’m going to be reminded that we have to add this let’s first of all actually register the block in our mod blocks class we’re just going to copy over the lamp over here and that’s going to be the eggplant Underscore crop and then same for the name eggplant underscore crop and this is going to be a new eggplant crop block now this is very important we actually want completely different fabric block settings here so we’re going to say fabric block settings dot copy this one Right here and then we’re going to say block start wheat there you go and then we actually don’t want to register a block we actually want to register a block without a block item so what we want to do is we want to copy the register block method here and we’re Just going to call this the register block without item then not call the register block item here get rid of the tab parameter and then call the register without block item get rid of the item group here as well and then we should be fine because in this case the actual Block itself doesn’t have an item associated with it the item is going to be the seeds themselves so that is the general idea here so for this we now need to go to the item package in the mod items class and let’s copy over the eight bowl this is going to be the Eggplant underscore seeds and then same here eggplant underscore seeds now this is going to be a alias block item and the first parameter here is actually going to be mod blocks dot eggplant crop so the first parameter for this block item is has to be the actual Block that it refers to and then here we’re just going to make the max count normal so that is going to be fine uh we’re going to copy over the eight ball once again for the eggplant itself so this is going to be the thing that we’re Going to harvest so eggplant and this is just going to be a normal item however the eggplant of course is going to be eatable so we’re going to call food over here with a new food component.builder very important that and then we can specify a few things for example we can Make a status effect when this is eaten we can make this always edible meat something like that but we only want to call hunger with a four let’s say and then the saturation modifier is going to be a four as well and then very important at the end here we want to Call a data build so this builder has to be built and then this should be fine now all of the code as always is going to be available to you in the description below github repository individual just as well so no worries at all so now we’ve added the two items we Can now return back to our eggplant crop block and say mod items dot eggplant seeds and return those as the seed item and that should be pretty much all that we need to do here there’s one more thing we want to do in the client over here so we’re finally using the client We want to call the blockrenderlayermap.instance.put block Modblocks.eggplancrop and then the second parameter is the renderlayer.getcutout right this one here and this basically makes it so that our eggplant has that the texture is actually see-through so that is very important because they are see-through in our texture and if we don’t set the render layer properly then it’s not Going to work right then we get to the crazy things and that is going to be the json files so let’s actually start with the translation first because that’s going to be a little bit easier here so we have two things that is going to be The eggplant itself so this is just the eggplant this is the actual item that we’re going to be able to eat then we also have the eggplant underscore seeds there you go and this is going to be the eggplant seeds now we can still add the Eggplant crop over here this is going to be eggplant underscore crop and then this is just going to be eggplant drop now this actually should not be visible at the moment in our project however if you for example add something that adds a hover over effect when you hover over Different blocks then this is going to be shown so that is why you probably still wanted to add this and now copying over some json files once again those are all available to you in the description below starting with the eggplant crop over here so you can see we just have different variants Depending on the age of the actual block that is all that there is to it and then we’re just pointing to different block models while at the first glance looks quite complicated when you actually think about it isn’t anything that crazy this does mean that we have seven Different block model json files and yes those are still all available to you now once again those are really really simple in terms of their contents if you actually take a look you can see we actually have a different parent over here block slash crop very important and Then the textures actually point to the crop here texture that it points to is just eggplant underscore stage zero or the stage zero and what will sages one be well it will just be stage one so very much it just counts up nothing too crazy over here but yes this also means By the way that we have seven different textures here this is also the case but no worries at all let’s actually get those and then when it comes to the item model files we only have one for the eggplant itself and the eggplant seed but those are normal item model files You can see they just point to the item texture which we’re also going to copy over and then we have pretty much all that we need except for one other thing which is very interesting indeed so there we go the texture is here as well and now the question is well okay but Now my crop grows all of that is great but how do i get you know certain things to drop from it well we need of course a loot table for this now i will copy this loot table over i highly suggest taking a look at this as well this is of course Also available and this is a little more complicated but you can always go to the external libraries all the way down to this one right here minecraft project merge and so on and so forth to the data folder minecraft loot tables blocks and search for the wheat loot table and take A look at this it is almost exactly the same you can see we’re looking for a certain condition and that is that the age is max h in the terms for wheat it has to be seven for our crop here it actually only has to be six so that is Where you need to change this you then need to change the block over here that is the correct block here come the seeds here is the actual well thing you harvest and then down here we have some more seeds that drop and that is pretty Much all there is to it i highly suggest going through this slowly methodically taking a look at this this really isn’t that crazy it looks pretty crazy but when you really think about it you only need to change a couple of things in these files and then you should be Totally fine after having added all of this let’s go into the game and see if it works all right finds us in a minecraft as you can see the seeds and the eggplant has been added so let’s just try to put them into the ground and There we go we can plant them and we can even make them grow with all meals so there you go they’re fully grown now and if i destroy them there we go now be sure to destroy them not in creative mode but in survival mode otherwise it’s Actually not going to work so we can actually take a look at this as well you can see that it’s not going to drop anything so keep that in mind and then let’s also see if we just you know take a little bit of damage over here and Let’s also make sure we aren’t easy then we can actually eat the eggplant as well and that should pretty much be all that we need there we go and then let’s eat it and there we go restored some hunger and everyone is happy about it so everything working completely as you expected to And that is how easy it can be to add custom crops to minecraft and this concludes this tutorial right here i hope you found this useful and you’ll learn something new i’ll see you all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19 Fabric Modding Tutorial | CUSTOM CROPS | #9’, was uploaded by Modding by Kaupenjoe on 2022-07-06 13:59:48. It has garnered 5807 views and 127 likes. The duration of the video is 00:09:01 or 541 seconds.
In this Minecraft Modding Tutorial, we are adding custom crop blocks to Minecraft 1.19 using Fabric.
== MINECRAFT COURSES == ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 *
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19/tree/9-crops Gist: https://url.kaupenjoe.net/yt352/gist Assets: https://url.kaupenjoe.net/yt352/assets
== TIMESTAMPS == 0:00 Intro 0:25 Making the Custom Crop Block Class 2:01 Registering the Custom Crop Block 2:57 Adding the Custom Seeds Item 3:36 Adding a custom Food Item 4:11 Returning the Seed Item in the Block Class 4:21 Setting the RenderLayer for the Block 4:50 Adding the JSON Files 6:52 Looking at the Crop Loot Table 8:01 Demonstration 8:52 Outro
== TAKE A LOOK AT MY COURSES WITH COUPON CODES == ▶️ NEW Forge Modding with Minecraft 1.20.X: https://url.kaupenjoe.net/CourseForge120X ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 * ▶️ Complete and Roblox Lua Game Development: https://url.kaupenjoe.net/RobloxCoupon *
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== SOCIALS == Discord: https://discord.com/invite/yqxykanpWf Personal Twitter: https://twitter.com/Kaupenjoe
Instagram: https://url.kaupenjoe.net/tutorials/instagram Facebook: https://url.kaupenjoe.net/tutorials/facebook Twitter: https://url.kaupenjoe.net/tutorials/twitter TikTok: https://url.kaupenjoe.net/tutorials/tiktok Written Tutorials: https://url.kaupenjoe.net/tutorials/blog
== LICENSE == Source Code is distributed under the MIT License. Additional Licenses for other assets can be seen below or in the accompanying CREDITS.txt on download.
== ADDITIONAL CREDITS == Outro Musik by Kevin MacLeod: “That’s a Wrap” Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0
== AFFILIATE DISCLAIMER == * Some of the links and other products that appear in the video description are from companies which I will earn an affiliate commission or referral bonus from or are my own products. This means that if you click on one of the product links, I’ll receive a small commission or additional kickback without any additional cost for you. This helps support the channel and allows me to continue to make videos. Thank you for the support!
== HASHTAGS == #Minecraft #MinecraftModding #MinecraftTutorial #Kaupenjoe