In this episode of the custom mob series I’m gonna show you one of the many different possible ways to implement natural spawning for your custom mob this method only requires ten commands and I’m gonna walk you through how it all works how to customize it for your Own mob and also I’ll provide an example pack make sure to check out more information in the description below such as the table of contents for this video and the example download okay guys so for naturally spawning your mob this method that I’m going to show you is Basically what it’s going to do is it’s going to take a random selection of whatever mob that you want to replace and just replace a random amount of them and the frequency of the random replacement is going to be determined by whatever you want it to be so if you Want your mob to be really rare then you could just change a number and if you want it to be really common then you can just decrease the number and this method will be replacing existing mobs but you could make it not replace the mobs and Just spawn on top of them if you want so it doesn’t really matter too much but I personally prefer with replacing the mob because that can cause lag so I’ll give you a basic explanation first and then I’ll show you how I’m gonna make it work with commands so basically how it’s Going to work is let’s pretend that we have all of these mobs let’s say we have these five fish right so the salmon pretend this is the normal mob and the tropical fish is the special mob so our own custom mob so what it’s going to do Is so pretend this was already a salmon right so how it’s going to work is we’re going to have a scanning system that’s going to randomly scan each of these individually one by one and then what it’s going to do is it’s going to determine if it should replace it with The custom mob so how we’re going to do that is we have a scoreboard counter to count how many are being spawned in and every time that we scan one of these normal eligible mobs to be replaced then it will increment by one so the first Time it does it it will be at zero and when it’s at zero it’s going to spawn the custom mob so it’s going to go okay scanning the first random mob okay it’s at zero now let’s set it to a custom mob and kill The old mob now it’s going to go to one now the the counter is that one and then it’s going to say okay it’s not at zero therefore keep the mob and don’t replace it then it’s going to go to two and do the same thing it’s going to say okay It’s not zero so don’t replace it don’t replace it and then once it gets to four or whatever a number you select in order to change the frequency of your custom mob once it gets to that number it’s going to say okay I’m going to say a Normal mob but now we have to reset it back to zero so now the next time it goes to detect another mob to scan in scan it and see if it’s going to replace it it’s gonna say back to zero now let’s replace it now as you can see by Changing this maximum number you could change the frequency of your mob so if this is for right now if I changed it just the two then we’re gonna have more of our mob and if I changed it to one that it’s going to be 50% because it’s just gonna Go between 0 1 0 1 so it’s just gonna go custom abnormal mob custom abnormal mob so you could change that number to whatever you want so it’s really flexible in how frequent you want your mob to spawn so the first part that we have to set up is the scoreboard and the Fake player so some of you might have not used fake players before but I’ll bet I’ll try to explain it and it’s pretty simple and how it works so first we’re setting up a normal dummy scoreboard so scoreboard objectives add and I just call it CM underscore example Cm for custom mob it could be whatever you want to call it and dummy so that means it’s changed by commands only because you want to tally it up every time we do a scan and we don’t want any other interactions with the scoreboard other than our commands so I was just Gonna be called dummy and now we set up a fake player so a fake player is in a scoreboard basically used like a normal variable just a way to store information and the reason I’m using a fake player instead of assigning it to an actual entity is because there’s no entity here We’re trying to keep track of the count of the total mobs that are being scanned at the moment so we don’t want to assign it to a normal entity if you remember when we use scoreboards for my right-click tutorial with the care on a stick we had the scoreboard not on a fake Player but on the actual player using the stick because we’re trying to track it for each individual player but for here we’re trying to track the entire custom mob type so what I’m doing is scoreboard players add zero and that’s just to initialize it because if You don’t add zero and there’s no score then it won’t be able to detect it later the sessile little trick to use to make sure that your commands are able to detect number because when you create a scoreboard all entities don’t automatically get a value of zero they Just don’t have any value so you basically have to initialize the scoreboard by adding zero and the fake player is called mob one count so it’s basically just a random variable called mob one count that’s going to be stored in the side so normally it would be a Player name here so from you and say Ryan Ethan and have like a number here but in my case I’m using a fake player just to store the number okay so now I’ll show you all of the commands that I use to make this work so first we have The scoreboard objective creation which I showed you just now and the setting to zero which I showed you just now just to make sure that we could actually detect the scoreboard value of zero instead of having no score there so this is just going to be the counter for mob one if You have a different model or yours it’s called for example crimson serpent then I’ll just be like cs4 crimson serpent underscore count it doesn’t matter just as long as you keep track of what you’re naming it and just try to keep it consistent but now what we’re going to Do is I’m going to show you this command here so this command is basically just scanning all of the type of mob that I want to replace so for in my case it’s a zombified pig lens that I’m going to scan and replace a random amount of so Execute as all of these mobs that are eligible to be replaced and I want to make sure they don’t have the tag of not mob one because I’m going to add that on later on and the reason that I’m doing that is to make sure that once I scan it I make it clear to the game or clear to my commands actually that I already scanned it because I don’t want to keep re scanning all of them because if I infinitely scan all of them without signifying that they’ve already been scanned then eventually all of them are Going to be scanned and replaced to be the custom mob so once a mob scan I wanted to scan it once and that’s it so I tagged it to make sure that it doesn’t scan twice so then I also do sort equals random to make sure that it Randomly picks the mobs from around the map I’m going to go to their positions because I want to make sure when I run the summon command that it actually summons on the position of that mob and then run the function of mob demo mob one spawn or whatever mob you want it to Be so in order to make that you could just create a new text file the exact same way that you created the leap function and if you don’t know where all of these came from make sure you go watch keep my how to create a day to Pack video and download the template so with that said let’s move on to this function which you could just create as a new text file just make sure you add dot MC function to the end of it so it looks like a lot here but most of it is Just the big summon command that we made in the last video so what we’re doing here is if it’s 0 remember how I said we’re running the spawning if it reaches 0 so I’m doing execute if the score for the player mob one count which is actually a fake player and the Scoreboard of CM example so that’s the example scoreboard that we were doing so custom mob example that’s just the name of the scoreboard that we were using to track the counts of the mob and if it matches zero then we are going to summon it so basically if the scoreboard is at Zero we’re going to run the summon command and then this is the exact same thing if the mob one count is at zero then we are going to teleport the mob down into the void so that it will die without leaving its loop everywhere and so you won’t see the mob like dying Randomly when you see custom mob spawn so that’s what happens if it matches zero but even if it doesn’t match to zero and you don’t want to spawn the mob there are still things we have to do so every time we just add the tag not mob One just to make sure that doesn’t scan again because even though the mob is getting teleported into the void we still don’t want it to be double scanned because there’s no point in that so we’re just tagging all of these mobs with not mob one just to show that has Been scanned and it has been determined to not be replayed with the custom mop we are also adding one to the mob one count so scoreboard players add and then which player mob one count the fake player and in which scoreboard CM example which is the scoreboard were using to count the Players or count the mob sorry and we’re just incrementing that by one so that we can continue to see if we are going to replace the next one with a custom mob or not and then also this is for resetting the count so execute if the score for mob one count with the Scoreboard of CM underscore example matches three so this number here three this can be whatever number you want in order to determine the frequency so if I set it to 300 then you’re going to have a very very rare custom mob and if you Set it to like two then it’s going to be like a one in two chance of something like that so you can just set that number to whatever you want and just tweak it based on the rarity of the mob that you want and then so if it does Match three then what we do is we run scoreboard players set mob on count CM example zero so we’re just setting the count down to zero again so that the next time the mob will spawn it will be a custom op this will be for download and I will continue posting new Downloads as we work on this custom web series but the main things that you want to be able to change if you’re just going to use the download is change this number here in order to be whatever frequency you want higher number means more rare and you also want to change All the scoreboards so for me that would be CM example you could do cm underscore nother for example if you’re making another mob pack just change the scoreboards and change the fake player so maybe you’re not gonna call it mob one maybe I’ll call it Wraith underscore Count or whatever custom mob you have just try to make it your own and of course change the summon command to whatever some in command you made in the last video and for the last thing that you’ll change is the type of mob that you’re going to be replacing so for me That’s the zombified biglan but of course if you’re making an overworld mob you would probably want to change that to like a zombie or a creeper or something like that and also something I want to say if you’re going to be adding multiple mobs you don’t need to create a new Scoreboard just keep on using this example scoreboard for all the custom mobs that you’ll be spawning with this method in your data pack so I’m using CM example here all you have to do is duplicate this so you just the scoreboard players AdMob to count CM Example zero so you could use the same scoreboard with multiple fake players in it for each of your custom mobs and add another spawn function okay so here’s what it looks like after you code the whole thing so as you can see right now on the side the custom mob example Counter is has the fake player value or variable value for a mob one count of zero and that’s how it’ll start out and I also change the max number in order to match this so how it’s going to work is it starts at zero so the first scan on a Random mob that fits your criteria for whatever you want to replace will have a custom mob so as you can see that zombie pigman got replaced with the crimson serpent but now as I go to the next one and as you can see it’s a normal one Because this mob one count is not set to zero and here it’s not set to zero so it’s still normal still normal and now once we get to here it’s going to detect that it’s four but then it’s going to rise up back to five and it’s going to Detect it’s too high then it’s going to reset back to zero which means that once we go back around to here it’s at zero and it’ll make another custom mob during the next scan and it will just keep going through that cycle until there are No more mobs to scan and when mobs do scan then it’ll just keep going on and on so as you can see it’s a it doesn’t look random when you’re just spawning them in order but again when you’re actually doing it in a real world you’re Not going to notice it at all since it’s not just a line of mobs being summoned so hopefully you guys understood this tutorial and you guys are able to use it to make your own custom mobs and remember the template will be in the description below Video Information
This video, titled ‘Make Custom Mobs SPAWN NATURALLY [2] || Minecraft Data Pack Tutorial’, was uploaded by Timber Forge on 2020-05-07 19:06:00. It has garnered 40150 views and 1006 likes. The duration of the video is 00:13:09 or 789 seconds.
Welcome back to the custom mob series. Last episode, we chose our base mob, made sure that a model would display and remove correctly, and added custom effects and attributes.
In this second episode, I go over one easy, 10 command method for making your mobs spawn naturally.
I tried to explain the way that all of the commands work as thoroughly as possible, but if you need clarification or have other questions, feel free to ask me a question here. You can also join the discord server to get help with and collaborate with other data pack creators.
Check out my new website! https://tinyurl.com/timberforge
Table of Contents: 0:22 Conceptual explanation of how it works 3:17 Setting up the scoreboard with fake players 5:18 Load and loop function commands 7:20 Scanning function commands 10:16 How to customize if using the template 11:33 End Result
DOWNLOAD THE DEMO PACK HERE: https://drive.google.com/open?id=1gDJKFNmcsfZY08Ulntj26c9vdYiS7uEr Resource Pack from the the Nether Mobs+ Pack: https://drive.google.com/open?id=1ZUkXVxCWriWvxYGiiOy6swIMDHUAcvr0
JOIN MY DISCORD FOR DATA PACK CREATION: discord.gg/bwBsSbr
Credit to Gravitowl for the crimson serpent model from my nether mobs+ pack: https://www.youtube.com/channel/UCnwwNuHXu2on_yDo4pTr85g