Hey guys it’s thomas here with technovision and welcome back to another minecraft modding tutorial video for 1.16 in this episode we’re going to be covering natural mob spawning and i will be covering mob spawn eggs in the next episode i’m splitting them up because they are two separate topics But just know that we’ll be covering that next time but in today’s video we’re just going to be doing natural mob spotting and if you remember from the last episode if we go to our init package and go to mod entity type we did create a hog entity in the last Video and it is a creature and so what i want to do in this video is make this creature this entity spawn in the overworld and so to do that we want to come over to our world package here and we want to create a new class inside of our gen package So right next to our mod origen class we want to right click new java class and we’re going to name this mod entity spawns all right so add the repository and this class is going to do something very similar to what mod origin does so we do need to register it With the mod event bus subscriber so we want the at mod tag above and make sure you import mod import class and then dot event bus subscriber and then we need to pass in our mod id is equal to our main class so tutorial tutorial dots and i think i need to Import my class first tutorial dot mod id there we go import class from our our specific mod here so tutorial dot mod id that’s your main class there and then we need to also set our bus equal to mod dot event by subscriber dot bus and then very important has to Be dot mod so there we go uh now that we have that set up what we want to do is create a add subscribe event at subscribe event uh because this is going to be a an event and we want to call this this method just public static void uh spawn entity Or you could also do like spawn mobs whatever you want to name it really spawn entities entity plural entities there we go and we want to pass in a fml uh load complete events and we can just name this e or event if we want there we go All right so again just like with mod origin this event is going to run after uh forge loads it completes this load event so uh basically uh it’s just going to run through all of the the biomes uh in in the game and we can decide if we want to add To that biome spawn list or not so pretty simple i’m going to show you a few if statements here so you can see how to spawn things in the nether in the end but just know you don’t need these if statements if you’re not going to spawn in the in The nether or the end if you’re just going to spawn the overworld you can just skip all these if statements but hopefully you know java obviously and you’ll be able to figure that out on your own because you really shouldn’t even be using forge if you don’t know java so Uh if you want to spawn things in the nether you can oh well actually i forgot to mention very important we have to loop through the biomes of course so we want a for loop that just grabs a biome from uh i believe it’s forge registries dot Biomes yeah so an import biome there so this is for loop is going to loop through all the biomes in the game and uh oh let me bring this up so if we want to spawn our mobs in the nether this will be nether mobs then we’re gonna have to Check for uh if the biome is in the nether so if biome dot get category is equal to biome or not biome it’s i think it’s just category right yeah category dots uh and then you can choose a category uh in this case it would be nether So what this is saying is if the biome is inside of the nether then we can run this code and then you can throw your mob in there i’m not going to be uh using this because um i’m not spawning the nether i want my hog to Spawn in the overworld but just know that you could do that and yeah it’s pretty simple now we can do the same thing actually we can copy and paste this line for the end but instead of checking if it’s equal to the nether biome of another category rather we can just Check if it’s equal to the end and again same thing if you wanted to spawn your mobs in the end you could throw the code that i’m about to show you inside of here instead and do whatever you’d like i’m going to keep these up just for tutorial purposes you can see them But obviously you wouldn’t want to check for this if you’re just gonna like leave them empty that would be pointless uh but yeah so just know that’s how you do it uh and if you wanna spawn in the overworld um overworld well i guess um in this case I’m gonna add some else’s because we’re assuming that uh if this is gonna run then it obviously isn’t another one uh so yeah okay so then we can just do an else statement um again you don’t need this stuff if you’re just doing overworld you can just Check for the overworld biomes um so now that we know that we’re inside the overworld here in this else statement we can do a few things so we could just spawn our our mob you know however we want but i want to make sure that our mob Does not spawn in the ocean obviously because we don’t want our like hog entity just like running around in the ocean so i’m going to first make sure that the biome i’m going to get the category i want to make sure that is not equal to uh very important biome dot category Dot ocean so there we go so we’re making sure that the biome that we’re accessing is not an ocean because otherwise you will have your mob spawn in the ocean so now that we know that it is a land biome on the overworld we can add our our mob by doing biome Dot get spawns and we can pass in the entity classification so if we go to mod entity type here you can see that we classified our hog as a creature and there’s a lot of different ones we have like um like i showed you earlier there’s monster there’s water creature Uh i set minus creature and that’s probably what most of yours are going to be so uh whatever you your whatever you put here essentially this this mod entity classification we can just copy it you just want to paste it in here uh and all of your creatures are going To go here if you were for example trying to set the natural spawn for a mob uh like a hostile mob you would put a monster here instead and it would follow like monster spawn behaviors so yeah i’m doing creature though um and we want to um dot add A new spawnless entry so we can dot add let’s bring this down here because it is going to be kind of long uh a new biome dot spawn list entry and inside of here you’re going to pass in your entities so mod entity type dot Get your entity in my case hog and then we need to do get of course and then we need to pass in three unique parameters so uh this is going to determine how your your mob like spawns so we know that it’s spawning in um a biome that’s not an ocean But the weight which is this next number here is going to determine how like rare your uh your entity is so the higher the number of the weight the more likely it is to spawn i believe could be wrong about that but i’m pretty Sure that’s how it is and i have a link in the description here to a mc creator wiki and again i know we’re not using mccreator but these pages are really helpful and it just talks about how spawning works in minecraft and you can come down here and see the Default uh weights for vanilla entities and you can see cows have a weight of eight a sheep has a weight of 12. pigs have a weight of 10 and you can sort of go off of that so i want my hog to be similar to a pig so I’m going to copy the same weight that pigs have which is 10 here and that’s going to make it you know somewhat likely to spawn but not super likely so we can put 10 there and then um the next one is going to be the minimum group count so this is the Minimum size of groups that it’ll spawn in if you set this to like three for example your mob will always spawn in a minimum group size of three so with three other mobs so we’ll get basically like groups of three hogs if you were to set this to one then the Minimum that will ever spawn is just one so i’m gonna set this to three so we always have a group of three spawning and then the max i’m gonna set to five so again this is the minimum group size this is the maximum group size if you just wanted your mob to only Spawn as one mob every time you could just set the minimum to one and the maximum to one and that would accomplish that pretty much so yeah you can customize these however you’d like and yeah we’re actually completely done which is really awesome super easy as you can see and every time You want to add a new mob to the like natural spawning here all you have to do is just get the biome get the spawns throw in the entity classification entity classification maybe you’re doing like a a monster this time um and then you just need to do dot add And then pass in a new one of these listing these list entries that has your entity uh the weights and all that stuff so super easy to just continually add over time and yeah so now we can actually file save all i’m gonna run the client here and i will See you in the game to test this out alright so i just loaded up a fresh new world and we’re gonna go look for some of our custom entities spawning naturally in the world All right so here we go we found a group of our custom spawning entity that did take a while so you might want to change the uh the weight if you’re having trouble finding your mob but we can see that they are spawning naturally right by this village and it Seems like it’s a group of one two three uh four so just like we sat between group size of three and four so yeah that’s pretty much going to do it for naturally spawning entities oh there we go there’s another group right over here so yeah you can see it’s working Uh so that’s gonna do it thanks guys so much for watching in the next episode like i said we will be talking about how to make custom spawn eggs so definitely stay tuned for that and i will see you in the next episode Video Information
This video, titled ‘Minecraft 1.16: Forge Modding Tutorial – Natural Entity Spawning (#19)’, was uploaded by TechnoVision on 2020-08-05 21:37:31. It has garnered 8495 views and 279 likes. The duration of the video is 00:10:30 or 630 seconds.
Learn to code a Minecraft mod from scratch in this complete tutorial series! In this episode, we add natural spawning to our Hog entity in the overworld biomes.
— Important Links —
● Mob Spawning: https://mcreator.net/wiki/mob-spawning-parameters
● 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