Let’s build strong and big trees and let’s cover tree generation oh now number one this is extremely important we will be talking about how to generate the trees inside of the world using World Generation the data generation tutorial that came before this is a prerequisite if you’ve not Gone through this you will have to go through this because you will need the model world generator class and then we can basically proceed after that a second caveat here is that this particular tutorial is split into multiple Parts I will actually add some time stamps for this inside of the video Because first of all we’re gonna create all of the blocks and all of the craziness there then we’re going to create the tree so that the tree spawns from the sapling and then last but not least we’re actually going to spawn the tree on World Generation so let’s start By creating the blocks so in the modblocks class we’re just going to go in here and we’re going to make a public static final block I’m going to call this the red underscore Maple underscore log and this is equal to register block once again of course red underscore Maple underscore log in this case the comma and then this is going to be a new pillar block very important this is basically the way that the logs look like and this is going to be a fabric block settings dot of no we’re actually going to do copy this time copy and We’re going to copy of block start oglog because why not and we’re going to just say strength 4.0 F and also we will require a tool this is going to go under mod item group dot citri there we go and that is beautiful and now we need this Four times and then we need this an additional two times and then we need this an additional one time okay and now it is up for well renaming this this is going to be wood make sure to always rename this inside of the name here as well otherwise you’re going to get an Error and then also change this the copy of to the specific one over here it’s not strictly necessary but it’s just it’s just kind of nice then we have the stripped one and the other strip one this is stripped red maple wood and the other one is the stripped red red red Maple log stripped red maple wood let’s just copy this one and this one is called wood there we go and then changing this here as well this is the stripped Oak log and then this is the stripped oak wood beautiful absolutely amazing now here we get the planks Interestingly enough so this is the plank so this is the red maple planks and here as well changing this to the Oak planks to copy from this is going to be the leaves but don’t leave just yet because that’s not what we’re looking for we’re gonna do the leaves over here What a horrible joke leaves there you go and this is the sapling which is actually going to be the one that is a little bit different and there’s actually two differences in that as well so the planks are actually going to be a normal Block in this case There we go and then this is actually going to be a leaves block perfect now this instead is going to be a sapling block and it’s going to throw an arrow because we actually need to put in a sapling generator however we don’t have this yet absolutely no worries we’re Going to be able to add this in just a moment but those are actually all of the blocks now what I could do is I could you know copy over all of the different resources right all of the assets and stuff like that however what I’m going To do is I’m just going to copy over the textures so this is all of the block textures and then we have one item texture which would be the no actually not the the sampling is also in here perfect that’s all of the block textures Just copied over we do need the Lang now we could also have done the data generation for the Lang but you know that’s going to be fine I feel like writing this out and just copying and changing the names here should be pretty much the same as doing it within a class And now we can use the previously created data generator well to do all of our heavy lifting so we’re going to go in here and we’re just going to say block State model generator and we’re going to say the log we want to register a log and we say modblocks.log and now Look at this right we’re going to do the wood for this as well and we’re going to we do the stripped log and we’re going to do stripped wood and done bam over we got it this is already everything we need for the those four blocks next one We have a normal one because the plank is just a normal block so this is just going to be mod blocks playing and then leaves are I actually think leaves are also absolutely normal because they are they are the same thing and then the only question is is there also one for Sapling there is nothing for sampling well what is a sampling but that is a cross so we should be able to do a tintable cross I don’t think that this is a tintable cross but let’s just do what block start sampling and then give me a tint type Of not tinted sure I mean absolutely I’ve actually not tried this one before so that’s kind of weird but I guess we’ll see let’s just put a null in here for a moment and let’s actually generate the data for this because I would really like to see whether or not this is going To generate the proper data but that should be pretty much all that we need here all right so something is wrong and that is specifically in the sapling block well what I it’s probably oh because we’re using the oak log this is what I’m saying you always got to change The blocks over here otherwise stuff is not going to work and this is the reason why right of course this was done on purpose right so now but change this to OB sampling and now we should have no error here actually and we will be able to see this should run through perfectly Fine there we go so we got two um we got nine new files so let’s actually take a look at the assets block States so we got red maple leaves planks and sampling okay and the blocks okay so it did not generate the okay this it did not generate these ones probably because Those actually okay they get me a log texture pool while these ones also get me a lock texture pool fascinating well let’s take a look at the sampling first this is a correct block say Json file for it but how does the model look like it actually looks exactly how I want it To that so that’s perfect so this is definitely correct the this one’s fine I’m just unsure why these don’t work so that one’s a little bit of a weird one oh I think I misunderstood how this works so you do the log over here and then you call DOT log with Modblocks.log so the normal log and then you do would and you do mod block stud wood and then you can just delete this one and you do the same thing for the stripped variant so you do the stripped one here and the stripped one here and they stripped one here and now this Should in theory generate this so let’s run the data again and see if the stripped variants or the the logs actually generate as well okay this looks much better so we can see we get the let’s see where is it red maple strip and that is uh the red maple log And that is absolutely correct this is exactly what we need and it also generates the horizontal and the non-horizontal one absolutely perfect this should be exactly what is needed for the logs and all of the wood to basically generate those are all the proper Json files and of course you can Still also add the loot tables to the recipes all of that jazz we’re not going to do this here that should be trivial for you to do at this point doing it either with data generation or with you know or by hand or with missile something like that should be no worries At all now there’s a couple of other things that we need to do before we can actually go into the world generation or to actually spawn the tree from the sapling first and that is to get the leaves right and the sampling right so for this we want to do the block render Layer map right here we want to use this one dot instance Dot and then we would just put in a block here and that’s going to be modblocks.leaves and then with a render layer that get cut out and we want to do the same thing for the sapling over here And this is just going to make sure that because when we actually look at the sapling or the leaves you know either one of them basically works fine you know if we look at this there are certain pixels in here that are actually not really occupied right they are Transparent and otherwise if we don’t put this to cut out then those pixels will actually be white so that and we don’t want that we want them to be see-through and therefore we need to put this in here another thing you might want to do is make your blocks flammable For this you need to use the flammable block registry that get the default instance and then basically add blocks with this now what I highly recommend you do is you actually make a custom class for this and you just put them in there so you can put this into the block Class for example so this would be mod flammable block registry something like this and you’re just going to make a public static void register flammable blocks and this is going to have the flammable block registry registry equal to flammable block registry dot get default instance and Then you can just say registry dot add and you can say mod block start red maple planks for example which are going to burn for 5 and 20 in spread and then we can just duplicate this and do it for all of them so for example the leaves Are going to be actually a burn of 30 and a spread of 60 crazily enough and then the logs are all going to be five and five so this is going to be log this is going to be the stripped log this is going to be the wood and this is going To be the stripped wood and they’re going to be five and five all the way down there we go and now we just call this one in the tutorial mode class over here instead of the uninitialize method mod flammable block registry.register flammable blocks beautiful and now the Same thing goes for the strip ability in this case I’m just going to put this like raw into the uninitialize method you can also make a new class and do that but that’s going to be fine this is going to be the strippable block registry that register and we’re going To put in the modblocks.red maple log and modblocks.striped red maple log there you go and then the same thing for the wood as well and that should be fine and our custom wood will actually function the exact same vanilla wood would would yes right now we’re gonna go on to Spawning the actual tree from the sapling so let’s create a new package in the tutorial mod package and we’re going to call this the world package and then we are going to create a new package instead of here that’s going to be called tree and this is basically going To be for our sapling generators let’s create the red maple sapling generator generator there we go this will extend the sapling generator class and we’re just going to implement the get tree feature method now here in this case we don’t have a registry key oh no so what We’ll actually need to do is we’ll need to create this registry key now what we’re going to do is we’re first of all going back to the mod blocks class and changing this null here to a new red maple sapling generator very important and now we don’t need to worry about This this we’re going to keep this error here for the moment because we actually wanted to create the mod configured features first so in the world package right click new Java class mod configured features here we go and now this class is going to be absolutely Insane so bear with me for a moment because World Generation 119 3 of course there’s lots of changes again and they’re pretty crazy so for every configured feature you now need a registry key that is going to be totally fine so we’re just going to make a Public static final registry key of type configured feature question mark comma question mark this is going to be the red underscore Maple underscore key and this is equal to and for this we need a we need two helper methods actually I’m gonna copy both of them over it is one the registered key Method in the register method the register key method we’re gonna call here and we’re gonna call this the red underscore Maple underscore tree we’ll actually just call this the red underscore Maple but that’s gonna be fine and this is now our registry key that we can pass in right here so we can Say mod configured features.red Maple key and we’re going to be find the sapling generator is done now of course how does the generator know what it’s supposed to generate well and that’s exactly the thing it doesn’t for this we need to create the absolute abomination of a bootstrap method now this is just The case because in 119 3 World Generation has pretty much changed to be completely and utterly only Json files now this is in some ways really good and in some ways kind of annoying but because we have our data generators we can make a bootstrap method that is Going to generate everything for us and that is makes it a lot easier so we need a public static void and we’re going to call this bootstrap this is going to have a registerable of type configured feature question mark question mark there we go and it’s called context and Then let’s see what this crazy method has in store for us so in theory we need a bunch of things here but right now we just want to spawn our red maple tree from the sapling for this I’m going to copy over the register method here that We’re going to need and I’m going to explain so this is what we’re going to need you can see we’re calling the register method down here we’re passing in the context parameter then we’re passing in the key we’re then saying this is a tree feature and then we have A new tree feature config now this is the same config that we’ve seen plenty of times before in previous tutorial Series this is the same idea we have a block State provider over here which is going to be the log that’s the first block save provider then we have a Straight trunk Placer in this case we can have different trunk places if we go here press Ctrl H we can see there’s a bit many different trunk places highly recommend playing around with this or taking a look at the vanilla configure feature class to take a look at how Other trees basically are generated then we have a leave block State provider The Blob foliage Placer which basically just says okay how are we going to place those trees and then the two layer feature is still an enigma wrapped inside of a mystery and this just does Stuff just play around with the numbers a little bit and you’re going to be fine and now this is going to register this tree feature to this particular key which is of course referenced in the sapling generator so when the sapling grows this the configure feature with This Keystone old and that is the general idea now how do we use this bootstrap method to do anything well for this we need to go into the mod world generator class and this is why I said the important this is important that we have this multiple generator over here And we’re going to say entries dot add all and we’re going to say Registries dot get wrapped or throw registry keys dot configured feature okay this is the first thing that we need to do so now we’ve configured this go into the data generator over here and we’re going to say Pack.adp provider mod world generator colon colon new let’s make sure that this was written correctly there we go and then we need to do another thing and we need to overwrite the build registry method we can delete this and we can say registry Builder dot add registry the registry keys dot configure feature Mod configured features colon colon bootstrap and here we go this is where the bootstrap method is called and now the word generator is done because we’ve said okay we want to actually add the entry of configure feature we have the bootstrap method with our context and now this should actually generate the Json file so if we now run data gen it’s actually also going to generate a world gen folder inside of our generated folder over here and this is going to contain exactly this information in Json file form so you can see data tutorial mode World gen configure features red Maple Json and you can see it has exactly everything that we want we have a dirt provider of dirt that’s just the basically the default we have a blob foliage Placer with exactly our numbers that we’ve specified right here and so on and so forth it all gets generated Automatically if you have another tree you can just copy this have another key over here and we’re going to be totally fine now for the sake of argument let’s actually take a look at this in game let’s spawn the tree from the sapling first and then we will continue to also Do well basically have this tree spawn on world gen as well let’s take a look alright so we found ourselves in Minecraft again and let’s just see first of all we can see everything has been added so we have one issue here with strip lock but that’s just because the Texture is not named correctly I’m pretty sure but that should be fine we can rename this in just a moment and we have a sampling and let’s get some bone meal here as well now we should be able to set this down and we should be able To grow this and let’s go we got a tree that grows strong and big now what you’ll find is that the leaves are decaying immediately we can fix this very very easily and very quickly but for the time being we have the tree set up correctly and that’s honestly already Really really cool progress let’s continue along and see first of all how to fix the leaves and then second of all how to actually get this thing to spawn in the world alright how to fix the leaves issue well we want to go down to data Minecraft tags blocks and inside There we’re going to make a new file called logs.json This is a normal tag so we can just do this and basically say tutorial mode tutorial mode red underscore may pull on or score log and then just duplicate this to get the wood here as well let’s not forget the commas Though and this is the low this is the log this is the wood and then this is the stripped variant here as well stripped underscore log n script underscore would if they spawn next to either of these blocks they’re not going to disappear anymore so that’s pretty Awesome let’s then continue how do we get our tree to spawn in the world for well for this we actually need not configured features but Place features because Place features are what are going to be placed inside of the world for this in the world package we’re Going to right click new Java class called mod placed features and this class is going to look eerily similar to the mod configure features because well it also has a registry key but this time we’re just going to copy this because this time it’s not going to be for a Configure feature but a place feature and this actually has no question marks here we will however need the two helper methods and I’m going to copy those over again and once again of course all of the code is available to you no worries at all is actually going to be three of Those there you go that are just registry key register key there you go and that should be that now we also need a public static void bootstrap method once again with a registerable of type Place feature this time call with context context there we go and this is Going to be the bootstrap method that we will need now this place feature is actually going to be called red maple place because that’s usually how I would like to call my place features and this is then red maple placed there we go that should be pretty much what we need Here now what we’re going to need here is actually something crazy and that is going to be the config a variable of configured feature registry entry lookup now the reason why we have this is so that we can actually take a look at our configure features because we need to Use the red maple key over here inside of our place feature because this is how our tree is going to spawn and we get this by using context.getregistry lookup registry keys Keys dot configure feature and now we can actually take a look with this craziness where you can Get the red maple key configured feature as well now we need this only for one thing and that is the register of the context now this is going to be the red maple red map red maple placed key we want to put in the configured feature registry lookup get or throw mod Configured features dot red maple key now the way we’re going to build this is the following it’s actually not that crazy we’re going to say placed features dot create count with extra this is going to be one and then there’s a 10 chance of adding two more trees and then The second one is placed features that would survive and here we’re going to say mod blocks that red maple sapling now here are two very important things number one this controls how many trees are spawning there’s gonna be one tree spawning and then there’s a 10 chance of Two extras three spawning now this extra chance is insanely weird if we go into this you can see we’re taking this extra chance with saying 1 divided by this extra chance that has to be an integer otherwise you will get this crazy thing so basically Right what I’m saying is that if we do one divided by 0.1 we get 10. that is totally fine this works if we put in 0.2 also works that’s 5 if we were to put in 0.3 this would not work so if you put in 0.3 here you will get an error I don’t know why this is the case it is the strangest thing I’ve seen in a long time and I can’t tell you why but if you divide 1 by this number it has to be an integer so basically you can only put in One a point one point two point two five I’m pretty sure should also work for four and so on and so forth and that’s it so please do keep that in mind if you want to use the create count extra here otherwise you can always go into the placed feature you can always Go into the place features class into the tree place features I’m pretty sure and you can take a look at what they’re doing with their placement modifiers now the other one which is the wood survive over here this is extremely important because of this one you need so that the Tree just doesn’t spawn inside of other trees so otherwise they would like spawn atop of other trees so basically we want to place our tree only where the red sapling could also survive meaning only on dirt or grass now let’s make sure to use the bootstrap method inside of right Here tutorial model generator so we can could duplicate this and say Place feature and this is now the mod placed features bootstrap and also very important in the mod world generator we need to also add the place features right here and once we’ve done this now We are done we have the bootstrap method and we have this now we just need to spawn this so while we now have if we were to run the data gen over here because why not let’s just do this we’re going to have a place feature it doesn’t Yet spawn the world but we have the place feature now we can spawn it and that is absolutely awesome so there we go we have the place feature this is the red maple place as you can see it’s a weighted list this is the so we have a Bunch of stuff would survive on red maple sapling this is exactly what we need and this is the count so this is basically how much it spawns generally speaking and to get this to spawn in the world package we’re going to make a new package called gen And then inside of there we’re gonna make the mod tree generation and we will also make another class and this is going to be the mod World Generation let’s start with the Emoji generation this is going to be very very straightforward public static void generate trees this is going to call Biome modific modifications very important you’d use the one with the S add feature biome selectors with this you could select the biome so biome selectors that and then you can see we can say all biomes we can exclude by certain Keys we can say everything that’s found in the Overworld so you can Basically just say hey you know these particular ones so we can for example say include by keys and then we can say biome key is that and then we can say for example planes and now this is only going to spawn in the planes biome that’s pretty cool and we could and we Should be able to expand this as well so we can set another biome Keys Dot and then say for example how about the how about the first so let’s add this to the planes and the forest biomes interesting we’re going to use this in generation step and we can see this is The feature for vegetal decoration important that we get the right one and then the last parameter here is mod Place features that red maple placed key so here we’re passing in the registry key of the place feature and there we go now we want to call this in the mod World Generation class make a new method public static void generate mod World gen and we’re just going to say mod tree generation that generates trees and this method over here is going to be called in the tutorial mode class now the reason I have it set up like this is Because when we add the or generation I actually want to call this here as well and then everything is just going to be a little bit easier and nicer to be done like this and then we can call this uh I’m unsure whether or not it should be Before or after let’s just use it put it here uh that’s that should hopefully be fine if there’s an issue then we’re going to be able to see this and I’ve also changed the name of the block texture over here it just had the log missing so it was just called stripped Red maple top and but it looking for a log top so that’s going to be fine so before we try this I actually have to jump in here for just a moment and there is actually one tiny thing that we need to change in the register method over Here in the bootstrap of the placed mod Place features and that is instead of just having the create count and the would survive here we actually just want to take vegetation Place feature that modifiers with would survive passing in the create count extra modifier as the first parameter and then passing in the Red maple sapling as the second parameter and that is going to actually make it so that it spawns it’s going to generate a different place feature over here because these ones we didn’t have those before and they actually if we if we don’t have them they actually prevent The tree from spawning so do keep that in mind and now we can continue and see if it works but I can assure you it actually will all right Francis in Minecraft and as you can see we are inside of a a planes biome right now and We have our trees spawning exactly how we would expect them to so you can see this is basically well those are the numbers right as as we put them so this would be one count of one and a ten percent chance of two others spawning so I highly recommend playing around with Those numbers of course and that’s going to well of course alter the result in this case but they are spawning and that is absolutely awesome and that’s how easy it is to add some tree generation to Minecraft right and we are finally at the end of the road to creating trees And tree generation in 193 for fabric quite the involved process but we’re finally here and now everything should be working totally fine next time we’re going to be taking a look at or generation but for the time being hopefully this was useful to you and you learned something new and I’ll see you All next time so yeah Video Information
This video, titled ‘Minecraft 1.19.3 – Fabric Modding Tutorial: Tree Generation | #7’, was uploaded by Modding by Kaupenjoe on 2023-02-27 15:59:48. It has garnered 4924 views and 92 likes. The duration of the video is 00:26:21 or 1581 seconds.
In this Minecraft Modding Tutorial, we are adding Tree Generation into Minecraft 1.19.3 with Fabric.
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== COMPATIBILITY == ▶️ Compatible with 1.19.3 ▶️ FOR 1.19.4 at 24:43 modifiersWithWouldSurvive is now called treeModifiersWithWouldSurvive ⏹️ Somewhat Compatible with 1.20.X
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19.3/tree/7-treeGen Assets: https://url.kaupenjoe.net/mbkj20/assets
== TIMESTAMPS == 0:00 Introduction 0:50 Creating the Tree Blocks 10:00 Spawning the Tree from the Sapling 16:17 First Demonstration 17:01 Fixing Leaves Despawning 17:37 Spawning Tree inside the World
== 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 *
== 1 MONTH SKILLSHARE FOR FREE == ▶️ https://www.skillshare.com/r/user/kaupenjoe *
== 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 ==
== 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