Chop chop and let’s add custom trees and tree generation to Minecraft oh yeah we find ourselves back in each other once more and in this tutorial we’re going to be adding oh not only custom trees but also custom tree generation to our mod and this is gonna Be well quite a little bit of a longer tutorial but bear with me it is going to be pretty good so we’re going to first of all start by adding the logs the woods the strip variants the planks the sapling and all of that so all of the Blocks and for that we actually need a custom block so in our custom package we’re going to right click new Java class and this is going to be the mod flammable rotated pillar block now if this is insanity to you then I agree with you but this is actually what we’re going to Need this is going to extend the rotated pillar block class this one right here let’s hover over this create Constructor matching super and in here we need to override four different methods first of all the is flammable method then we need the get flammability method we need to Also overwrite the get fire spread method and then last but not least get fire spread speed that is it yeah there you go and then also the get tool modified State method so what do those do well obviously the is flammable method just says well is this you know Particular block flammable or not and of course it is the get flammability is going to be five and the get fire spread speed here is also going to be five now where did those come from well this is basically the general values for other logs right so this is of course a log Right the rotated pillar block right here going to be just like an oak log or a wood or a stripped log basically and you can actually look this up press shift twice and look for the fire block and if we go into this and at the very Bottom here somewhere right here in the bootstrap method you can see we set the flammability of certain things and this is exactly the values that we have so you can see planks actually have 5 and 20 we’re going to figure out the planks in a moment same with the with Logs here you can see there are five and five and that’s why I put the five and five in here and that’s gonna be fine and then when it comes to the get tool modified State method there’s a few ways that you can do this basically one thing you’re always going to check For is whether or not if context dot get item in hand dot get item is instance of an ax item that’s usually always what you’re gonna have to do here and then you can go about this in a lot of different ways now I’m just going to Make this a little bit more I would say hard coded but that’s going to be fine if you only add like two or three different log variants then that’s going to be okay if you add more than that I suggest possibly making a map here instead of just doing it like this so What we have is we’re going to have a state that is mod blocks so if we are going to use a block and that’s going to be the red underscore Maple underscore log dot get which of course at the moment doesn’t exist yet but that’s okay we’re just going to finish the if Statements and then we’re going to continue with this in a moment and this is going to be the wood mod blocks of course there you go right once again it doesn’t exist yet because of course we haven’t added it yet but whatever we’re gonna go back to this because we now Have an error here and that’s exactly right sometimes you do want a deliberate error while you’re programming something so you don’t forget to go back and then you know then it’s all sort of crazy and you forget that so let’s go into the mod blocks class and actually register all Of our blocks here so this is going to be a very interesting thing so let’s just take the let’s just take the sure let’s take the blueberry crop over here I think that that’s nope that’s not good either so let’s just do the jumpy block Then there you go and then let’s get one of them and then we’re gonna copy that as well now all of the code as always of course is available to you in the description below get a password individual gist as well this is the mod flammable rotated pillar block and it’s Going to not do a of but it’s going to copy the block behavior of block start Oak log there you go we don’t need the strength over here in theory we also don’t need this because I believe that the oak lock has this already but we’re going to be fine We’re going to keep it like this for the time being and now we can duplicate this four times actually quite a few more times let’s actually do something like this so now we can actually copy this a few times so we have four different ones of this and Then the log this is going to be the planks this is going to be the leaves and then this is going to be the sapling I believe those should be everything that we need so let’s continue here red maple wood and of course make sure to change the name here otherwise you will Get an error and we’ll also change oak.wood so it is very easy to make a mistake here you know it can just happen right like it’s because it is always the same thing if you have many many many many different types of wood that you might want to add then Um what I suggest you do is you you basically have to like take a look at another way of doing it because otherwise this is going to be Madness as you can clearly see right if you have to do this for every type of wood and let’s Not even start with all of the other blocks that you would then add right like all of the planks and all of the stairs and fences and all that it is madness right so at that point you should probably try and see if you can find some other way Of doing it regardless of that though we’re now only adding one you know one part of wood or one type of wood and also only one uh different 3 over here so this is now going to be a block over here and this is going to be A leaves block very important that we change this around then also this is going to be the stripped Oak log yes this is going to be taken from the stripped Oak stripped oak wood now I don’t think that this is necessarily important I just like to have this you know Separated properly I think it does make sense this is going to be the planks over here namely the old planks and this is going to be oak leaves there you go that is perfect now let’s first of all jump back into the mod rotated pillar block and there we go Now we have this and now we need to return the new state so what is even going on with the get tool modified State method well basically this is called when you right click this particular block and then it’s going to check hey do we have a certain item Mainly are we right clicking with an X item if we do then we want to turn the red maple log into the following State and that is mod blocks that stripped Maple log dot get that default state that and this is extremely important set value of axis State DOT get value access basically if a block like points up right as a normal like tree that grows does right then that’s totally fine you right click it and that would be the default State however if the block is on its side and you right click then if we only return The default block State here then it would all of a sudden like turn me up like the right way up and that is kind of weird this is why we actually need to return the proper value of the axis block property here as well and that Would be fine now let’s just copy the return variable here and let’s just change this to the wood right here and that would be pretty much it now yes you would need to add those two if statements for every type of a log and script variant you have this is what I’m Saying the best way to do this like long term is probably to just make a map in this class right just make a static map and just add the different blocks and the different strip blocks there and then use it right here shouldn’t be anything too crazy of Course some Java knowledge is required but that at this point is probably going to be a normal thing going forward now the next thing the planks and the leaves right now would not burn this is because a normal block doesn’t burn so what we’re going to do is we’re going to make An anonymous class right here so we’re just going to after the closing parenthesis of the block Constructor we’re just going to put in the curly brackets here and then we can override the is flammable method and we’re going to overwrite the get flammability method and we’ll also overwrite the Z get Fighter spread speed method and we’re just going to well basically put in what we need so this is true this is going to be five and this is going to be 20 for the planks and then what we’re just going to get is take both of the curly Brackets here and we’re just going to do the same thing for the leaves now those are actually different those actually have a flammability of 30 and a spread a spread speed of 60 and there we go now our leaves and our planks should also you know burn totally fine that was That’s that’s pretty good now that we’ve added this we can also now go on to the sapling here so we can see this is the sapling and there’s of course the red maple sapling this will take in a or this will be a new sapling block which actually is going to need another Parameter here so what we’re going to do is I’m just going to put in a comma here and do nothing in here so I want the error here because we’re going to add the other thing right here in a moment that’s going to be the oak sapling and we can also actually delete The requires all here that’s going to be fine and there we go and then we’re going to add this in a moment because this actually is already part of world gen a little bit so spawning a tree already has some moral gen in it but before we go into the world gen I Actually want to copy over all of the different Json files and all that craziness for the block State and all of that now this is going to be a little bit crazy but no worries at all now all of those are of course as always available to you in the description Below get up a password individual gists as well you can see there we go so those are these ones right for all of our blocks the leaves of the logs planks sapling the wood and the two strip variants we’ve added all of that and also the language of course let’s get The translation in here as well there we go at this point this should not be anything crazy nothing that you haven’t seen before so there you go and then the models the block models are pretty insane we’re gonna look into the block States Json files in just a moment one More time but the block model files are pretty insane so let’s just get those over all right so these are the block model files you can see 11 of them it is pretty freaking crazy like you can see there’s a lot of them and um overall they’re not complicated when you think About it like the leaves of course just point to the leaves texture that’s nothing crazy here actually I believe here we do want to add the cutout as well so we want to add the render underscore type uh cut out I’m Gonna Leave This is how you should do it there You go that’s also quite important and we also do want to add this to the sapling as well I believe that this is also not added there you go so we should add both of those and that will be fine as well that’s pretty good right and Then for the rest of them I mean pretty much they’re just you know they just have the cube column over here and they always just point to certain textures nothing too crazy same thing really goes with the block States Json files the logs are a little more complicated but Nothing that we haven’t seen before so they just have the access block State Property here with X Y and Z as their three values and they’d then just point to different textures a little bit as well or different models I guess as well as rotated around a little bit so Nothing insane nothing crazy nothing that you shouldn’t understand at this point pretty much and then the item model files let’s get those over as well otherwise we won’t have any items in our inventory which is of course not quite what we are what we are hoping for so Let’s just get those over as well and those are also just the same idea right they just point to back to the block model file and I believe all of them do except for the sapling that one just points to the actual texture in the block folder because while the texture That is displayed in a sapling in this cross fashion is actually the same texture that is displayed in the inventory that is why we literally only have one texture for it so nothing crazy there let’s get the textures as well they’re all block textures and those are Of course also all available to you let’s just get them the stripped variants and the normal variance should be seven of them and there we go so now the blue blocks textures are now the textures have been added the Json files have been added and we can proceed with The first step of the world generation basically which is spawning the tree from the sapling itself so in our world package inside of the feature package we’re going to make a new package called 3 and instead of there we’re going to make a new Java Class and this is going to be the red maple tree grower yes just making sure that we write 3 correctly there you go and this will extends the extends the tree grow abstract tree grower this is exactly right we’re going to hover over this implement the get configured feature Method right here and that will be that now we’re actually going to make a deliberate error once again because we do need to first of all add the configured feature and then we can either basically return it here so in the mod configured features class the First thing we want to do is we want to well add the red red maple as a new field right here so this is going to be a public static final registry object registry object of type configured feature configured feature question mark question mark and this is going to be The red underscore Maple now I will be copying over the entire thing here because it is pretty insane however no worries we’re gonna go through line by line so this is gonna look quite like this so this is the entire thing so we’re gonna have a red maple equal to of Course configure feature register right that we’ve seen this before right we’re just registering this particular registry object and this is called red maple fair enough then a supplier of a new configured feature of type 3 and then we need a tree configuration Builder over here and that is the thing that is quite Interesting the first parameter here is a simple block save provider of the log this is going to be the block that is going to be displayed as your well trunk basically right this is going to be the trunk and then the straight trunk Placer Is the type of what the type or or how this particular block is being placed down if we middle Mouse one click on this you can see there’s a trunk Placer class and if I click on it and press Ctrl H there’s different types of trunk Blazers now you can make your own as well but it is quite complicated which is something that we’re not going to do here but it is possible in theory with some sufficient Java knowledge and some sufficient modding knowledge you should be definitely able to do this and then The next one is the simple Block Set provider for the leaves so this is going to be the leaves now you could in theory add any Block in here you want yes you could make a gold tree with diamond leaves it would work in theory Um I mean be my guests right try it out test out stuff that is always a great idea then we have the blob foliage Placer so this is the same idea as the trunk place or even millimus one click on this the foliage Placer class you can see different types of foliage places Basically a different way of placing down the leaves in this case just taking the blob one with two zero and four as its parameters highly suggest just trying out the different uh the different numbers here you know try different numbers and then see what happens the two layers feature size is Still a thing that is a little bit of a mystery to me I believe if I recall correctly this sort of determines how much how many trees can like spawn next to each other and like those things basically although I’m still not 100 sure because World gen as always and as I’ve mentioned plenty of times before is quite the complicated Beast to manage whatever the case may be this is the configure feature that we now need to return right here so this is the configured actually mod configured features that red maple and I believe that this would be fine nope we actually Do want to do get a holder.get that should be okay and then that will be fine now in the mod blocks class we can now say a new red maple tree grower and now actually all of our errors should be gone and everything should in theory already work at least for while placing Down the sapling and then having the tree spawn so for the time being what we’re going to do is we’re going to go into the game for the first time see if our sapling actually grows and then we’ll continue and actually also then spawn our tree inside of the world via Custom tree generation but first of all let’s look at the sapling all right we found this in Minecraft again and there we go we can see the well different blocks all have been added including the sapling so let’s take the sapling over here let’s get some bone meal and in Theory if we set it down and we both it should grow at some point there we go now the leaves will Decay over here that is actually completely expected it because we’re going to fix that in a moment as well but overall that is pretty awesome indeed now the the actual Sapling itself should also grow with time so if we just do the following if we just change the game rule do tick no do a random random tick speed and we’re just gonna increase this to a ridiculous degree there you go it also grows automatically And then also all of the leaves Decay up pretty fast as well so there you go and that is pretty awesome so the sampling works now let’s go on to the World Generation right first of all to fix the decaying leaves you have to go to the Data folder to Minecraft and add another block over here or a block tag rather and that is going to be the logs tag logs.json let’s just get the way that a tag file looks and here we’re just going to add all four different types of logs So it’s gonna look kind of like this there we go the log the wood the stripped variants and then now the leaves will not Decay anymore now we’ll continue with the world generation so for our custom World gen we’re going to need a lot of things and that is work we Have one configured feature right here right now and we’re gonna be able to convert this to to speak into a place feature that place feature is going to be made into another configured feature and that configured feature is then going to be made into a last place Feature which is then going to be referenced once again in a custom where is it right here biomodifier and that will then spawn so first of all we then now need the new place feature and that is the checked one now I will be copying This over but no worries at all all of this is available to you in the description below GitHub a password individual just as well as always and you can see it actually isn’t that complicated is of course a registry object of placed feature it is called red maple checked and we’re registering A new place feature right here called red maple checked all right making a new place feature referencing the red maple mod the configured feature red maple this is the one that actually spawns the tree and we’re making it so that it can only spawn where the red maple sapling Will Survive now this is actually extremely important because otherwise your block will or your tree will just spawn anywhere including in side of the like inside of other trees so you might have like two or three trees stacked on top of each other because uh you know it doesn’t check for the sapling Survivability and that is why this place feature is actually quite important and now we’re gonna take the place feature that we’ve just made right here and we’re going to well convert it so to speak into another configured feature that is the red maple spawn and you can See once again a configured feature this time of random feature configuration and this has a weighted Place feature list here and what this basically does is well fifty percent of the time where he’s choosing the red maple checked and another 50 of the time we’re also choosing the red maple checked I’m Unsure why I have to do this but I do have to do this otherwise it doesn’t work so it’s very strange so once again if anyone has an idea on how to basically skip this step please do feel free to leave me a comment down below otherwise you just have to take this Step and there you go and now on to the last placed feature luckily which is the red maple placed and we’re gonna see see it actually is not that crazy this is the gold so you can once again see his redmi replaced here and there’s a place Feature it uses the red maple spawn that we’ve just made this one right here and then it has a tree placement and this is extremely important of count extra and this number in particular is very important so what the these numbers mean is that it spawns three three different Trees and then it has a ten percent chance of spawning two more trees now what’s important is this chance right here is very particular and with very particular I mean that when you have this chance it has to be one divided by it sorry one divided by the chance so This would be ten percent has to be a an integer right so you can put in 0.1 that works you can put in point two that also works so you can put in 0.25 because that’s that that also works what you cannot put in for example is something Like four or five because that is not going to be an integer and then you will get an an error I don’t know why this is made so weirdly because if we look into the count extra this is basically what happens here right so this this whole thing basically does exactly that it’s It checks whether or not the when you divide by this particular float that you get an integer out of it so please make sure to get an inch out of it otherwise you will get an error it looks kind of like what does it look like it will say Chance data cannot be represented as a list weight if you get this it means that your chance right here is wrong I this is very strange to me but it is what it is whatever the case may be though we now have the placed feature so we can go into the tutorial mode So data folder tutorial mode Forge biomodifiers if you’ve already added this via the origin that would be great and then let’s just copy over one of them that’s going to be the add this is the add red maple and what we’re going to do is we’re Going to add this to how about we add this in the planes biome I think that does make sense right so we’re going to use the forge tag is underscore planes and then the feature we’re going to use is the red underscore Maple underscore placed of course referencing the name Right here and with that I mean this one right here you can also just copy it making sure that this is correct and then this is also important this is now digital underscore decoration there we go and that would pretty much be everything that we need to do now of Course yeah I don’t know like quite a few steps of course but regardless of that that should be pretty much all that we need so let’s go into the game make a new world and see if it works as I’ve said be sure to make a new world right Here so let’s just create this of course you’re gonna get the warning again and then let’s see if we can find our custom trees inside of the plane’s biome very interesting stuff all right Francis back in Minecraft and I mean there we go the trees are already spawning here this is Probably a plane’s biome of course right there you go it is a planes biome and our trees are spawning and you can see well the numbers basically shake out to be exactly this I highly recommend as always just playing around with the numbers a little bit taking a look at The vanilla classes for the trees and then you’re gonna find some other ways of spawning them as well but yeah there you go this is pretty much how to add a tree and custom tree generation to Minecraft right and that concludes this tutorial right here I hope you found This useful and you learned something new and I’ll see you all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19.2 Forge Modding Tutorial | TREE & WORLD GEN | #32’, was uploaded by Modding by Kaupenjoe on 2022-09-27 13:59:56. It has garnered 6514 views and 118 likes. The duration of the video is 00:23:38 or 1418 seconds.
In this Minecraft Modding Tutorial, we are adding custom trees and custom tree generation to Minecraft 1.19.2 in Forge.
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/tree/32-treeAndGen Gist: https://url.kaupenjoe.net/yt435/gist Assets Zipped: https://url.kaupenjoe.net/yt435/assets
== 25% OFF FOR GAMING SERVERS == ▶️ https://www.bisecthosting.com/Kaupenjoe
== 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