Hey guys it’s Thomas here protect no vision and welcome to the next part of our minecraft modding tutorial series for 1.16 in this episode we’re going to be creating some custom or generation so you can get whatever block you want to generate randomly inside of the world in Any of the three dimensions and you can use any block you want but I did create a custom Ruby or block off screen before the video and I wanted to do this just so I could show you if we come over to our blocks package here I did make a Custom class for this just like with our Ruby block and if we open both of these you can see that this Ruby or well this is our Ruby block that we made on screen together but our Ruby or is pretty much exactly the same except in whereas Ruby Block extends block Ruby or extends or block now the reason I did that is because when you extend or block you get access to this special method here that you can override called get XP drop and you can access this as long as you extend or block and this will allow you To set an XP amount that will drop when you mine your block so just like every or in the game for the most part when you mine it you can get experience points I think iron doesn’t do that though except because um you you get xp for that for smelting but things like Coal all those things job XP and that is how you do it by using this method and of course as long as you know Java you should be able to set up some cool stuff with this like creating random amounts of XP calculating the fortune level or The silk touch level and having that affect XP whatever you want really but I just wanted to mention that so make sure your block extends or block if you want this special method otherwise it doesn’t matter we can use any one block you want to generate alright so in order for us To get started we want to make a new package under our main package here our tutorial or whatever the name of your mod is package right click new package and we’re just gonna name this world and this is gonna have some more stuff in it later once we get to like custom biomes And stuff like that but for now just to make a new package in here call Jen which is short for generation and inside of this package we want to create a new class and we want to name this it really doesn’t matter but I’m gonna put mod or Jen you could also put like or a Jen that works too whatever helps you understand what the class is so inside of this class we’re gonna have all of our or generation related stuff now what we want to do is make sure that we have the app mod tag above so above your Class here your class declaration you want to do at mod dot events bus subscriber that is definitely not how you spell subscriber subscriber and in parentheses here we want our mod ID to be equal to equal to tutorial dot mod ID let me let me import mod at Montague Just so this is a little bit easier here and import your main class as well so your mod ID should be equal to your mod ID of course so from your main class you want to get your mod ID like we do all the time And then we also need to make sure that the bus is equal to mod dot event bus subscriber dot bus dot mod there we go all good okay so now we can actually use this class for subscribe events which is what we’re gonna do to generate this or Now if we come down here a few spaces down we want to make a public static void method so public static void and we’re gonna name this just generate ORS I guess because it is going to generate all of the ORS so generate ORS and this Is gonna take in a forge mod loader load complete event so FML load complete events and we’re gonna name this events I’m and that’s of curly braces now we need to add a add subscribe event tag to this so add subscribe event above the the method here and this is going to be An event we haven’t really talked about events yet we’ll all go in more detail and a full video about events later on but essentially whenever Forge modloader gets loaded it completes its loading phase basically when you first run the game with this green triangle once that Load complete event gets hit by the or started I guess is the right word by the forge mod loader it’s going to run whatever is inside of this this man so that’s we’re gonna do we’re gonna generate all the ORS on load event so in Order to do this we want to loop through every single biome in the game now the best way to do this is just a for loop so for biome biome and we’re just gonna do a well let’s import by them first so we’re gonna loop using every biome Within for two registries dot biomes all right so what this is doing is it’s just getting every single biome in the game and then we’re looping through each one and assigning it to this variable here each time so now that we have this variable we want to do three checks one For if the biome is in the nether another for if it’s in the end dimension and then a final one if it’s in the just the regular overworld if you’re not doing origin in the nether or in the end you can just skip those if statements no No reason to have them if you’re not going to use them but I’m just going to show all of them of course just in case you are so first one we’re gonna do if biome dot get category is equal to biome dot category dot nether so let me Explain this for a second here and what a little tag up here a little comment that says nether generation so once we have this biome that we’re gonna each biome that we’re gonna loop through if the biome category which is essentially like what the biome it is or what the The where the biome is I’m located if that’s equal to the nether meaning if it’s like a biome inside of the nether then we’re going to run this code and what we’re gonna run is a custom method we’re gonna make so let’s set these up first and then we’ll do those custom Methods so we also wanted else if biome get category is equal to biome dot category dots at the end and again everything inside of here is only going to run if the biome happens to be from the end dimension and then finally else if it’s neither of those if it’s not on The nether and not in the end then this will run which is just the overworld and let’s add some more tags here keep saying tags I mean to say what’s the word comments Java comments and generation and just so it’s clear one more time world generation and let’s Move this over here alright so again if you’re not generating in the nether and you’re not generating orders in the end you can just delete these and just have world generation here no need to have them if that’s the case so we need to make our our special little hum method That we can call so below this method that we’ve just created we’re gonna make a new private method called privates static void genore and this is gonna take in a ton of different parameters so bear with me we’re gonna run through all of them I promise and it will make sense By the end so first thing is a biome to biome biome then we need to take in the count int count and I’ll explain what all these are in a second because I promise they’re actually very important int bottom offset then we also need the Int top offset the int Max and then this next one is a long one it’s the or feature config dot filler block type and then we’re naming this filler and then I got a scroll over because it is so far off screen but I think this is the last One no it’s the second last one block states blocked open it’s a capital s block States default block state default block state you know what let me just move this down here just so it’s easier for you to see just for now block state defaults block state And let me import block state as well and then the final one is the integer size in two sides all right so we’ve got all of the parameters I know it’s a ton of them but you’ll see why in a second it’s actually very important bring this Up but just know that that’s what this is one last look at it and we need some curly braces as well so inside of this method we’re going to actually register your or as something that needs to be generated so we can do that by first Getting a range so we want to count range config and we’re going to name this range and there’s going to equal a new count range config and this gonna take in the count value the bottom offset the top offset and the max value okay semicolon sigh this is just so much Information to get through so bear with me next thing we needed to do is the the feature so and again I will be running through this I promise I’ll explain all of it but we need an or feature config name feature is gonna be equal to a new Or feature config and this is gonna take in the filler and the default block state as well as the size we can add a semicolon alright now that we have those two we need to actually add the the feature so we can do that by doing or Actually I think we should get the conf it let’s make a config variable just so it’s cleaner so let’s do configure configured placement a my name is configure or config is it going to equal placement dot count range count underscore range rather dot configure and we’re just going to pass in the Range and now to semicolon all right so now that we have our three of variables here we want to add the feature we could do that by using biom dots add feature and we want to pass in a few things first the generation stage dots decoration and we want this to be Underground or so you can see there’s a bunch of different ones we’ll be touching on these later when we make like custom structures that generate but for now we want Underground ORS because that is what we’re making here we’re generating and then we also need a feature So feature dots or again there’s a couple in there but we want to really only focus on or right now dots with configuration we want to pass in our feature we just made our feature from up here and then to move over I believe it’s one yeah one after this feature This with configuration method and then just do dots with placement and we want to pass in our config which we made right here alright so that is it I know it’s a super long method but essentially what this is doing is creating the or it’s not creating or it’s registering it To be added as a feature to the biome which essentially means that it’ll be generated as an undergrad or okay so now that we have our method we can actually use this method to generate our or so first or I’m gonna do is just the overworld and we can do that inside of Our else statement here again if you don’t have these if for else if statements you can just kind of throw it in here and this for loop but inside of our our statement here for world generation we’re gonna just type genore and you want to pass in first the biome It’s just biome next one like pass in the counts now this is going to determine how rare your or is the higher this number is the more common you’ll find it so for example if we were to put 20 in here you would find this or all Over the place it’d be super common but if you were to put one in here for example I’d be super rare you’d rarely ever find this or so the higher the value the more common I’m gonna put this to 15 so that we can actually find our Or when we’re looking for it but you can set it to whatever you like next is the bottom offsets on the bottom offset is the lowest possible y-value that your your aura can spawn in so if we were to set this to like eight for example what this would mean is that Your or cannot generate past why level eight downwards so like it’s eight is the lowest possible y-value it’ll ever generate at i’ll actually leave it there but again whatever you’d like to put there next to the top offset and this is the opposite with the bottom offset so This is like the top possible y-value that your or can ever generate in put this as five and that might sound confusing at first but this is actually subtracting from another value that we’re going to set in a second so I would just set this to five if I were You or anywhere between five and one and you all explain why in a second because it will make sense so next is the max value and this is actually that the top y value that can your your or can generate from so if we were to set this To like 50 for example just for this demonstration what this would do is take 50 here the max value subtract the top offset value for a value of let me write it out here a value of 45 so this is the top possible Y value that our or can Spawn app now our bottom offset is 8 and that is our bottom so what this means what we’ve set here essentially is for this or in the overworld your ore will always spawn between 45 Y level and eight white level never above this value and never below this value and again we Got 45 here because we take the max and we subtract our top offset and then the bottom offset is literally just eight it’s just that’s just what it is there’s no subtraction for this one here so hopefully that makes sense again set this for whatever you want the max to be And then this to be whatever you want to subtract from this number and then set this to the bottom offset the bottom max all right after the max we now have our next value which is the or feature config so we want this to be well it depends we’re doing world generation Over world so we want to do or feature config dot filler block type dot natural stone you’ll see there’s a couple here if it’s the overworld you’re gonna want to use only natural stone essentially so always sort of choose natural stone for this one comma next is the actual block That we will be spawning the the block that will be generated I’m gonna bring this down here just so we can see it and doesn’t go off screen but you can access your block by doing registry hand handler dots and then of course you can get your block from this list mine is The Ruby underscore or block but again you can choose whatever block you want and then make sure to do dot get as well and then we also needed to do dot get default state because we need the block state how to comma and then this last Value is the size this is the maximum or vein size that your orrible generate in so you know how some like iron veins in the world have like five to ten pieces of iron that’s what this value is setting so if we were to set this to twelve for example our rubies could Spawn our Ruby or could spawn in chunks of either one ruby or all the way up to like twelve ruby or blocks all clumped together so the bigger this number is the bigger the the vein of ore is I’m gonna set this to six just so it’s more Like vanilla sort of sized and it’s not too big alright so this is actually done we’ve actually finished our our origin and this will generate in the the overworld now so we can bring this up here and this is all done but I do want to show You how to do end generation as well as nether generation so if you want to generate in the end which is our next one well actually let’s do another first because end is going to require a few more steps so if you’d like to generate In the nether again it how you have to make sure you have this check here for if the biome is a category of nether and inside of here we’re gonna do the same thing we set here we can actually copy all of this just so we can make it easy For ourselves and I’m gonna change a few values let’s make the count a little bit rarer so maybe like twelve we can make the bottom offset like five the top offset we can make five we can just keep it as five and then let’s make the max Like why eighty because the nether I wanted to generate all over the Netherlands very important to change with this nether generation is that instead of natural stone we do need to select dots netherrack if you don’t do this if you keep it as natural stone it will not work it literally will not Generate in the nether no matter what so you have to select a dot netherrack here and then again select the or that you want to get make sure to get the default state and then the size let’s make this a little bit smaller like three is the Maximum that I can generate it in or maybe maybe four is a good value okay so now our ore will spawn in the nether and it’ll spawn in the world and again just to remind you every time you want to spawn a new or in the world just add Another method here another genore method and then literally just change the values and then change the block that’s all you have to do and it’ll and Hindle generates so this is all set up for you really okay so now we want to generate in the end dimension so if you Want to do this you have to add a public static or feature config so come up here and again this is just for the end dimension you want to make a public static or feature config dot filler block type we’re gonna name this n underscore stone and there’s gonna equal An or feature config dot filler block type dot creates and we need to create this let’s pass in a ennum name just end underscore stone is fine let’s just let’s bring this down here so you can see it we need to pass in a name in you Just to end underscore stone and then finally the new block matcher and we’re gonna have this be blocks dot n stone and underscore stone there we go so what this is doing is creating a new filler block type now this filler block type like I mentioned what this is Doing is determining what blocks should be around your your generated or so in the overworld it’s saying make sure that there’s natural stone blocks around your or and the nether it’s saying make sure that there’s netherrack surrounding your or for the end there is no automatic Filler block type that is set for us so we have to make our own and for this one we’re setting that the block should be n stone so we’re saying please fill in our or with n stone and again you can make as many of these as you want really Anything you want I thought that generates in the world naturally and your or will spawn next to that and that’s how you sort of make your or spawn in specific areas and caves or next to like specific stone types so like if you wanted to make one of these For diorite you could make it so that your or only spawns inside of diorite or surrounded by diorite blocks so that’s what that is and we can use this by again copying this genore here that we made just copy it paste it in and we can Change a few values so again I want this to be like a count of let’s make it like 18 this time super common in the end dimension and then for the bottom offset we can just keep it let’s make it like three just so it’s different top offset Can be five again and then max let’s make it like 80 just like the nether and again very important we have to change the filler block type to our custom one so end underscore stone oh and we actually need to just use the the variable so you can get rid of all that Unnecessary stuff and just use the variable here and we are using the Ruby or so we can keep that and let’s make the size like I don’t know let’s make it like twelve this time much bigger okay so we are now completely done your oars will generate now in both the world the End and the nether and you now know how to add as many as you want now one thing I want to mention is if you would like your ores to spawn in a specific biome what you can do is let’s say we want our Ruby or to spawn only inside of the like A Plains biome for example what you can do is come to your your if statement wherever whichever category you’re looking for end nether or world and you want to encapsulate your your method here in an if statement that just checks like if biome is equal to biome dots or Sorry biomes dot and then you can just choose a biome so like if we wanted let’s choose maybe desert is a good one so if the biome is equal to desert then we can just encapsulate this in an if statement there we go so now this code will only Generate our Ruby or if the biome is a desert biome and you can do this for any biomes you want as many times as you want and that’s how you specify it that’s how I’m emerald or only spawns in a an extreme Hills biome in case you Were curious so now we can run the game and test it out okay so inside of the game make sure that you create a brand new world because we do need to generate completely new chunks in order to get these ores to spawn and in order to find Them the most efficient way possible we can just go into /gamemode spectator and that will let us see underground and we should be able to find inside of our cave system here hopefully not too hard to find there we go so we did find some of our Ruby block there that’s in my Ruby ore block that I made let’s see if we can find like a bigger chunk somewhere maybe in this ravine somewhere not there there we go so let’s go to game mode creative let me get a torch here and there we go so we Have our Ruby or it looks like this is a vein of like – or it actually is for so anyway that doesn’t mean that it is generating in the overworld and now I’m gonna go over to the nether and I’m gonna go see if our ore is generating There alright so I just went into the nether and you can see actually right here we did make it very common but our Ruby blocks are generating in the nether and of course this texture doesn’t really match the nether hopefully if you had another generating or you would Actually make it look like it belongs in the nether but this was just for testing purposes but it is good to see that it is generating inside of the dimension so now let’s head over to the end dimensions we can check out our or over there okay so we’re now in the end Dimension and if we come over here oh there we go if we can see our custom or again spawning in naturally in the end and again just like with the nether hopefully if you have an end spawning or it will look a little bit nicer than this and actually match with the end Stone but once again it is good to see that we have a custom or that is generating alright so that’s going to do it for this episode thanks guys so much for watching I hope now you can generate your own custom ores or any block that you In the world and yeah I will see you guys in the next episode Video Information
This video, titled ‘Minecraft 1.16: Forge Modding Tutorial – Ore Generation (#11)’, was uploaded by TechnoVision on 2020-07-12 06:49:24. It has garnered 17965 views and 534 likes. The duration of the video is 00:23:29 or 1409 seconds.
Learn to code a Minecraft mod from scratch in this complete tutorial series! In this episode, we learn how to make our custom ore blocks generate naturally in the overworld, nether, and end.
— Important Links —
● Discord: https://discord.gg/ZsB3Eha ● GitHub Repository: https://github.com/TechnoVisionDev/Minecraft-1.16-Modding-Tutorial.git
— Music —
● Chill Out Media – Minute Mix
— My Channel —
● Subscribe: http://tinyurl.com/zbc7mwy ● Instagram: https://www.instagram.com/tomm.peters ● Twitter: https://twitter.com/TechnoVisionTV
#minecraft #modding #tutorial