Let’s add trees and tree generation to minecraft all right in front of us back intellij once more and in this tutorial we’re going to be adding a custom trees and tree generation to minecraft now this will be done in 118.2 so make sure to watch the update video if you have not Done that so please be aware that this is going to be done in 182 and there are some significant changes between 118.1 world generation and 1182 world generation most of the stuff that has changed is very much just syntax so how do we write the registration and stuff Like that but there are still you know a few changes there that are well they’re not easily translatable i would just want you to keep that in mind whatever the case may be let’s go into our modblocks class and let’s create the first things that we need and those are Gonna be a sapling as well as the leaves so for the leaves i’m just going to duplicate the planks here and i’m going to say this is going to be the ebony leaves and then of course right here as well ebony leaves and this will of course not Be just a normal block this will be a leaves block there you go and it’s going to just copy from the oak leaves the flammability is going to be 60 and the fire spread is going to be 30 actually so this is the normal leaf values here for that And then we’re also going to make a another block and that’s going to be our sapling i’m just going to copy the stripped ebony wood here and that’s going to be the ebony underscore sapling and then same of course here ebony underscore sampling now this is Going to be a new sapling block now the sapling block interestingly enough as this first parameter takes in a abstract tree grower we’re gonna have to add that in just a moment first of all we’re gonna finish this by adding the oak underscore sampling here there you go And then the rest is gonna be fine i think that that’s gonna be fine we’re gonna keep this error here just so that we you know remember that hey we still have to add this that’s very important but to finish the blocks right here we’re just going to go into the tutorial Mode class and we’re just going to duplicate both of these we’re going to say this is going to be the leaves and this is going to be the sampling and both of them get the cut out render layer that’s also very important here that this is done and then we should be Fine right now let’s add the json files starting with the block states json files of course now they are not really that interesting they are pretty much normal json files as you can see for the ebony leaves and the ebony sapling is also just a normal block states json File i’ve already added the translation here i mean this is pretty much at this point you know the translation should be something that is so ingrained and so easy to understand that it shouldn’t even be like a question anymore what am i supposed to do with the translation The block model json files are also both quite an interesting overall the sampling as you can see has a cross texture so that’s a little bit different but when it comes to the leaves right here you can see they’re just the normal block model texture like for any other Block really and then same with the appling and the leaves for the item i mean that’s like pretty much exactly the same thing the only thing here is that in the ebony sampling you can see that we’re actually pointing to a block texture this is just because the texture That is displayed in a cross pattern as the block is the same texture that is displayed in the inventory as the actual item so that that’s why we pointed to the block texture that we’ve just added here because why would we you know need to have a second one that’s exactly the Same texture no need so we’re just going to point it to a block texture here that is all of the json files done and now we can see how to make this abstract tree grower so for this what we’re going to do in the tutorial mode package we’re Going to right click new package called world and then inside of there we’re going to make a new package called feature and then instead of there we’re going to make a new package old tree and then right in here we’re going to make a new java class it’s going to be the Ebony tree grower now the ebony tree grower is not actually that complicated it simply extends from the abstract tree grower abstract tree grower right there and i’m going to hover over this implement methods and it’s going to be the get configured feature method right here There you go you know the names here are actually not that important because we’re not even going to use those so what i’m going to do is i’m going to purposefully make it so that i have an error in here because otherwise i might just forget what to um to add in here And if you know for the people who’ve already made some stuff in 118.1 you can see that basically the only thing added here is this holder right here so this is just a new interface that was basically added instead of you know returning the configured feature on its Own this is now inside of the holder so that’s all that there is to it at this moment um but yeah and then in the mod blocks class we’re just gonna say new ebony tree grower right here and then that’s it that’s literally the blocks Are now done and this we’re going to be figuring out in just a moment because now in the feature package what we’re going to need is a new class and that’s going to be the mod configured features right and now i will be copying over Some of this stuff now all of this is of course available to you in the description below get our pause for an individual just as well so no worries there and i’m also of course going to explain what the frick is going on here because the first thing i’m going to Copy over is the configured feature or rather the holder of the configured feature that is going to spawn the tree so this is it and you can see it is pretty freaking crazy all things considered but actually when you think about it it’s not that crazy so what do We have well we have a you know tree feature and this needs a tree configuration and this is the you know the builder here this is how we build it and so how what is happening well what happens is that the first thing that we Need to pass in is a simple block state provider of the block state that makes up the actual trunk of the tree so this is going to be the logs of course now you could in theory add any block here and that would then turn into the trunk Of the tree we then have a trunk placer you can see the strung placer we’re going to make a new straight trunk placer so this is just going to place this the trunk normally like straight up now you can see if we go into this class Middle mouse one click on it and i click on the trunk place here press ctrl h you can see there are different types of trunk placers and in theory yes you could also make your own i highly recommend that this is something that we’re not going to go into detail at all Here but if you really want to make your own just go through the you know different ones right here try and understand what they’re doing it’s pretty much just a bunch of math in 3d so where the you know with this place trunk method where are those logs placed That’s literally all that there is to it it shouldn’t actually be too crazy but whatever the case may be we’re using the straight trunk placer here and then we have another simple block provider for the leaves this time and then we have the foliage blazer this is the way that The leaves are placed so if we go into this and take a look at the foliage placer hierarchy here you can see once again different types of foliage placers so it’s pretty similar to the trunk placer here and the two layers feature size once again is one of those things in world Generation that i’m not 100 certain of what the actual uh thing is here is i believe that there’s you know there’s some sort of limit that this sets basically that two layers can’t be too close next to each other something like that but whatever the case may be This is the actual configured feature that is going to spawn the tree this is really important this needs to be now returned right here so we notice a mod configure features that ebony tree there you go and this is also very important that this configured feature right here Actually spawns the tree from the sapling as well but this does not spawn the tree in the world that’s going to be a little bit of a different well that’s a little bit of a different beast there’s a few more things that we actually need to add in order for this To spawn in the world but that is the general idea now there’s one interesting thing i wanted to mention if you want your sapling and your tree to grow on other things than dirt please be aware this is what you need to do so when you Have a sapling what you need to do is you will need to need to make a new sapling block and you need to override this method right here may place on method from the bush block it’s very important so this then will allow you to place your sapling on a different block after That has been done you now also need to add in the in this right here you need to add after the before the build i believe there should be a dirt method yeah exactly this dirt method just needs another block state provider so you can just add a simple block state provider And here you just add in whatever block you want other than dirt where this tree should grow on and then that’s pretty much all that you need to do so that’s a thing i wanted to mention as well because there are quite a few people who actually wanted to see this But for the time being this is pretty much going to be what we have here right now how do we spawn this in the world well once again i can only highly recommend taking a look at the vanilla stuff for this and how do we do this Well let’s middle mouse point click on the tree right here and you can see then middle mouse per click on it again and you would see where this has been used right this is used in the tree features class so if i go into this and i middle Mouse point click on this feature package i should actually be able to see yeah so here are the features packages and here are the placement packages so pretty much everything in terms of world generation is pretty much in here in these two packages those are the most interesting Things here in in this moment and i can just highly recommend take a look at it you’re if you’re like hey how does this work how does this work right how do i can how can i add nether features look at the nether features right it’s like Oh how how does how do caves work we’ll take a look at it so there of course some things here are of course not that easy to just you know brush over and be like oh that’s really easy no they’re still kind of difficult to understand or i wouldn’t say difficult to understand But there’s still some java knowledge especially that you’re going to need especially when we you know continue along with this right into more and more advanced you know topics there’s just no way around understanding what at least most of this means right right so just keep that in mind but Whatever the case may be so we can see this is using the tree feature unless takes for example then we have a holder of a configure feature tree configuration interesting this is something that’s very similar to this one right here right hola configure feature tree configuration yes it’s Exactly the same thing so let’s just see where this has been used so middle mouse button click on this again and you can see this is using the tree placements of class and this is in the dark oak checked right here where they’re calling placement utils.register and then you Can see we’re basically calling some stuff here now we can basically in theory copy this over right and then you know take it here now this is of course not quite what we want we actually want the ebony checked so this is going to be ebony underscore checked and then this Is of course also ebony check very important and then this instead of having the tree feature we’re going to say ebony tree and then this can be instead of the dark oak sampling it can just be our sapling so modblocks.ebonystaplink.get there you go and interestingly enough With that we’ve now you know made the place feature for this particular tree as you can see very easily done we’re just gonna copy it over replace everything with our stuff and that’s pretty much it so you can see that most of this stuff is pretty much just taken From vanilla changed around a little bit and that would pretty much be it now what are we doing here right where is this going where where are we going with this so the thing is that we now have this dark choke dark oak checked and you Can see this is now used in line 62 but this is another con figured feature here and then where is this used well this is used right here and this is another place feature so basically the journey goes like this we’re going to make a configured feature then a place feature Then a configured feature and then a place feature but before in 118.1 i had it so that this place feature that we’ve had here was actually sort of in line into this configured feature that is at the moment not possible anymore or at least i’ve not found it to be possible And also it’s not the worst thing in the world so i’m actually going to copy over the configured feature that i’ve already prepared right here you can see oh my lord that’s like there you go then now it works and this is pretty much the same thing as is right Here in the vegetation features so you can see line 62. you can see that this is a new random feature configuration with a list of and then the awaited list and that’s pretty much it i think that the um something like the tree tigers right here this one is a little bit Nicer to read because that’s not too complicated we have pine checked and we have spruce checked here so that also works and that is pretty much the same thing just that the ebony checked is always going to be that which is placed and then we basically from this one Right so now this is the configure feature here now we need a new place feature and this place feature is actually going to go into a different class so we’re going to actually create this in the feature package as well so we’re going to make a new class and this is Going to be the mod placed features and then this i will also copy over however it will look pretty much exactly like this you can see right this takes the vegetation features so this is when it’s going to take our ebony spawn feature and then it’s pretty much going to add Exactly the same thing count placement of we’re not going to use this exactly we’re going to use the count extra tree placement right here but we’re going to see this after i’ve pasted it in so we’re going to see there you go and then this is going to be configured features Ebony spawn there you go and then you see this is the tree placement of count extra once again one of those the trees forest take this you can also choose to take you know something like on average every seven i believe this is seven chunks i’m not mistaken and then in square spread So there’s a lot of different ways that you can use this i highly recommend just playing around with this and if you for example know hey i actually want my trees to spawn exactly like this or like the savannah or just copy it over try out a bunch of Stuff change the numbers as well so that’s also something that’s very interesting but the count extra i can actually explain what this does so this is the base number of trees that should spawn i believe every chunk round about there and then this is the number of This is the and this is the chance that this many trees spawn extra so this is why it’s count extra so this is the count and this is the extra and this is a chance this would be 10 should be fairly self-explanatory this is 50 And then this is one uh 100 so that’s pretty much all there is to it and then this is how many trees would spawn so if you wanted your tree to be really really freaking rare you could do a zero here and then one percent that one more tree Spawns so that would make it really really rare i highly recommend when testing it out that you uh bump the numbers up by at least a factor of five if not a factor of ten just to make sure that you actually find it because if you want to make something like that’s Really really freaking um you know rare then sometimes it’s hard to actually find it at the end but yeah that’s pretty much the place feature here as well and now we need to generate it so in our world package right click new package called gen and then inside of There we’re gonna make a new java class called the mod regeneration now here once again i will actually copy over the method here but it’s not that complicated and of course also all available to you in the description below github password individual just as well the only thing that’s happening Here is that we’re basically checking we’re using this biome loading event so this is loaded for every biome that is basically being loaded and then this just makes sure hey just give me the type of biome that we’re currently loading and then i’m just checking hey if the type that we’re currently loading Is of planes then we spawn the actual ebony tree that’s all that we’re doing so this is filtering for the plane spine that’s pretty much all there is to it now this also includes this should include the sunflower planes and all of the other plane biomes as well but yeah That’s this is pretty much it and then this is literally how you add it so you just need to add it in the vegetal decoration stage that’s very important that this is the correct stage then here we’re just adding the base feature on to the into the actual list that’s that’s All that we need to do it here and that that will already add it to the actual biome in this case now we still need to call this and this is going to be done in the world package a new class and this is going to be called the mod world Events and this is going to look like this i’m actually going to copy over the method one i’m going to copy over the method once again and then we also need to add the add mod dot event bus subscriber mod id equals tutorial mod dot mod id There you go and then this is done and now it should be working totally fine so this is actually surprisingly enough all that we really need to do to add the tree now you saw that you know there’s actually quite a few different things That we need to add like i said you know configured feature place feature configure feature place feature so there’s a lot of stuff here but once again i cannot stress this enough you have everything available here in the vanilla code so you can take a look at Pretty much how everything spawns in the vanilla code this is your the the best resource on how how does this work right how does it how do those trees work how do the flowers work how can i make underwater flowers spawn it’s all there You can all take a look at it i just cannot stress this enough as for the trees themselves to you know give like the tiniest summary one more time this configured feature right here is needed to make the trees spawn from the sapling and then everything else you know after That is needed so that the trees spawn in the world so this checked one basically checks hey can a specific block survive here which would be the sapling so this is really cool actually this ebony checked you know place feature basically checks hey if a sapling can survive here in this on this Place then we can actually spawn the tree here this is really cool which basically makes this you know just a little bit easier if you don’t have this for example then your tree would just randomly spawn in in the air for example because yeah i mean whatever it doesn’t Matter it could just be it could just spawn anywhere so that’s really interesting to also keep in mind and then yeah we basically go through the ebony spawn and then place this right here this is the way that this is then placed and then here we spawn it Simply with the generated trees in the planes by so for completion sake now after all of this has been added let’s see if it works don’t forget to create a new world for this because of course we’ve messed with the world generation i highly recommend always making a new World when testing it’s just a smart idea so let’s see all right we found ourselves in minecraft and there you go that’s this these are actually already our trees you can see ebony logs now they are spawning in the savannah the savannah is apparently also part of the plains biome Type so that’s totally fine of course right we can actually also see you know how they spawn it’s you know pretty it’s quite a lot actually that spawn so that’s totally fine of course right but once again we can for example see here this would be where are we now we’re in The river biome which is not type planes so let’s just actually go and let’s see let’s actually go to another biome just so that you can see that actually you know they don’t just fall in any anywhere now let’s go for example a forest yeah why not that’s definitely Not a plane’s biome or of type planes let’s say and then here we go so this is just on the border right here funnily enough our tree and then in the inside of the actual forest you can see nothing spawning here so this is you know just Just to confirm that wait why are they spawning in the savanna the savannah is also type of the of a plane’s biome that’s why they’re spawning in the savannah as well but there you go the custom tree working and let’s actually also see the ebony sampling here working Let’s go right here there you go and then let’s actually set this down and this should also work really fine there you go works as well so absolutely great and then one more thing i wanted to mention you know if your leaves are decaying right here that’s that’s something that sometimes happens you Have to add your log to the log stack we’ve done this in the custom wood tutorial so i highly recommend checking this out one more time if there are some issues with that otherwise that’s really cool and it’s i mean it’s amazing to see your custom trees in minecraft right but That would be it for this tutorial right here i hope you found this useful and you’ll learn something new if you did i would very much appreciate a like and don’t forget to subscribe for more tutorials just like this one i also want to thank all of my lovely patreon Supporters for supporting me and this channel it is very much appreciated and i’ll see you in the next tutorial so yeah Video Information
This video, titled ‘Minecraft Modding 1.18.2 with Forge | TREE AND TREE GENERATION’, was uploaded by Modding by Kaupenjoe on 2022-03-24 14:59:51. It has garnered 5835 views and 131 likes. The duration of the video is 00:20:23 or 1223 seconds.
In this Minecraft Modding Tutorial, we are are adding custom tree and tree generation to Minecraft 1.18.2 using Forge.
== ASSETS & DOWNLOAD LINKS == GitHub: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.18.1/tree/32-treeAndTreeGen Gist: https://url.kaupenjoe.net/yt247/gist Tree Textures Zipped: https://url.kaupenjoe.net/yt247/textures
== TIMESTAMPS == 0:00 Intro 0:46 Creating the Leaves and the Sapling 1:58 Adding the Render Layer and the JSON Files 3:36 Adding the Custom Tree Grower Class 4:59 Creating the ModConfiguredFeatures Class 7:52 Non-Dirt Saplings / Trees 8:48 How to generate the Custom Tree in the World 16:40 Appeal to look at the Vanilla Code Base for Reference! 17:06 Summary on the Things we’ve done 18:08 Demonstration 20:00 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 *
== 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
== AMAZON AFFILIATE LINKS == Amazon Referral [US]: https://url.kaupenjoe.net/amazonref/us * Amazon Referral [UK]: https://url.kaupenjoe.net/amazonref/uk * Amazon Referral [DE]: https://url.kaupenjoe.net/amazonref/de *
== 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