Hang on guys happy working here homework with Maxwell on Minecraft morning song fort walk version 1.15 in destroyer we are going to be going over how to create a passive entity now don’t worry passive entities are pretty much the same as hostile entities and neutral entities however just in case you do get Confused I will be doing separate tutorials on them in the future maybe next tutorial or the one after and but I want to do them in the future as well and a bit further in the future I will be doing bosses and so yeah just so you Know all of the videos that I am intending to do are in the description of this on a Trello board and so if you open that Trello board you’ll see all of the videos I’m planning to do for 1.15 and hopefully I will get through all of Them is my intention and hopefully even by the end of the summer holidays hopefully I’ll get through through all of them while we’re still waiting for for 1.16 I will try to get through as many as I can anyways let’s go ahead and get started so the first thing you’re going to want To go and create is your mod entity types class so we’re going to create this you’re not in it package and it’s a new class and that’s called mod and c-types now we are going to be using deferred registries for this obviously you can use object holders if you wish So we want a public static final deferred register of entity type and that’s going to have question mark in it just like that and we’re going to call this about entity and score types and that is going to be equal to a new deferred register of forge registries dot entities and Then obviously your mod ID so that is just tutorial mod mod ID and just import entity type and forestry and foremost reason tutorial mod now we can create the registry object so that is a public static final registry object and that is going to take in entity type and then That’s going to take in our entity class which I’m just going to call example entity and let’s call this variable example underscore entity and that can just be equal to entity types dot register first is the registry name so example underscore entity and then the supplier is just like normal but then it Is entity type doc builder of example entity and you need to make sure you put a dot before these so that we can do the method afterwards which is create and that takes in the factory for our entity so that is example entity : : new and then it is the entity classification Which basically defines how it will spawn when it will spawn and where it will spawn and if you remember in our biome we said B’s and the classification for B’s is creature I believe and so creature is just animal so all you need to do is entity classification dot and You can do ambient creature misc monster water creature so I’m just going to do creature and then after that we need to set the size so you can do dot size and this is basically this isn’t the size of the entity this isn’t the size than the Shadow this is the size of the bounding box for the entity now because mine is going to be roughly the size of sheep I’m going to be setting it to the sheep bounding box which is 0.9 F and 1.3 F so obviously the first parameter there is The the width and the second parameter is the height I believe or it might be the depth it’s probably not going to tell me is it because we still have errors yeah okay so after that you want to do dock build and that is going to take in a new resource location of Tutorial mod mod ID tutorial mod mod ID and then the name of your entity so example and score entity and then you want to make that string so you do top to string and a semicolon on the end import resource location and we can just format that there we go that’s a bit Nicer okay so now that is it with that class obviously we need to make sure we import example entity once we create that but we actually need to register this deferred register and to do that we just go in our main class and below mod container types we can do mod entity Types dots entity types register to arm water event bucks okay so now we have done that and the next thing we can go do is actually create the entity class so I’ve made a package called entities inside our main package and in here I’m going to create the class Example entity now because I’m doing a passive entity I’m going to extend animal entity and this basically defines what attributes it can have what a is it can run so obviously you need to do the respected one for your entity but in here we just want to add the constructor Just like that and we want to make that constructor public there you go and that’s pretty much it for the constructor actually and but I’m going to be doing a few things in here so I want my entity to just be like a sheep And I want it to be able to eat grass so the way I’m going to do that is do a private eat grass goal so basically a eyes have now been renamed to goals which is really weird but yeah they’ve they’ve now renamed to goals obviously You can go ahead and create your own goals they’re not hard to make really like if we just look at the eat grass goal on let’s see so we go we checked that the block state is grass and and that will tell it if it should execute And if we find the tick function and so if it’s grass its destroys the block but you can basically see how this works it sets to dirt it plays a sound event grass bonus you know it does all that stuff it’s pretty simple and to do this We also want a timer for our entity and so it knows when at start eating grass and so I’m just going to make that a private int and I’m gonna call this example timer so this is basically just from the sheep code if you are wondering it’s useful to Just copy the vanilla entities where you can also if you can’t then you have to do those yourself but they’re really not hard and you should be able to get hang of it quite quickly anyways okay so the next method we want is this method right Here create child and in here we want to first create the entity so to do that we just do example entity and we’ll call that entity is equal to a new example entity okay and this is going to take in the entity type so that’s just mod entity types dot example entity don’t Get and then the world in is just a distant world just like that and then what you can do well first you want you to do the initial spawn so NC dot on initial spawn on initial spawn and we want to do this dot world Oh god I’m messing that up to stop world yeah like that and after the world it’s the difficulty so this dot world don’t get difficulty for location a new block pause of entity and then it’s the spawn reason so off the are just going to be spawn reasoned dot breeding Because it’s creating the child and then it’s an i living entity data and we’re going to cast null well cost no to that that to null I mean and then you want the compound NB t and we’re casting compound Mme t-too null null to compound MBT I always get those the wrong way And then we can just do returned entity I’ll see here you can do anything else as well so obviously you could do the entity dot set glowing as just an example but you need to make sure you do that before you return it obviously we Have an error here but we can go ahead and fix that now by just importing example entity in our mod entity types and there you go that gets rid of the error there as well and the next thing we want to do is register the goals or AI whatever you want to call it so that’s use the register gold method and in here you first want to call this super one so super dot register goals and then you can do this dot this dot eat grass goal is equal to a new eat Grass goal of this and then we can do this dot goal selector dot ad goal and then first is the priority so basically how important it is the lower the number here the more important it is basically means uh how often it will run so zero And I will first do the swim goal so this basically allows it to swim that’s pretty simple and then we can do a few more I’m just getting these ones from the sheet I’m not doing anything extra special here I am just doing like the normal the normal things so a panic goal Of this and this is the speed that it runs so 1.25 D is the normal speed that it will run out and then the breed goal so this goal selector just a goal selector but ad goal and then priorities free and that is a new breed goal And so that is the entity so this and then the speed 1.0 d and then we’ve got this cup goal selector don’t add goal ok there we go that I used all the goals next we can update the AI tasks so update AI tasks in here obviously we Want to set the timer so let’s start example timer it’s equal dis got to eat grass goal dot gets eating grass timer so that just creates the timer and then living tick so this is basically what you do while the entity is just going About so in here and we can do if this dot world is remote so if it’s client side you could well you need to do this timer is equal to math dot max 0 and this dot timer straight example timer negative 1 that just does some math to work out the Timer and then you super and then you want to register the attributes so register attributes in here we want the super first thing and and then we can do this dot gets attribute gets attribute and then that is going to be shared monster attributes dots and then these Are all the attributes you can use just note that if you use attack damage your entity has to be able to attack so it has to be a an attacking entity so you can’t just add any of these you can only add the ones that your HD allows so I’m just going to Do the max health first so job max health and then set base value and this is basically how many hearts it has so obviously a sheep has eight so we can just do sixteen which is pretty high and then you can do this don’t get attribute shared monster attributes dot for Movement speed and then set the base value and the normal movement speed and what I’m gonna have it as as well why I’m gonna have it a bit lower so 0.23 is normal so I’m gonna have it as point two oh there we go Or we could just put 0.20 d and then we don’t have to call it a double that just makes more sense doesn’t it and then we’ve got a few more methods which I’m just going to copy from the Sheep class it’s basically to do with head rotations when it’s eating and Stuff like that and which you can go ahead and copy from the Sheep class it’s pretty you know normal stuff and and here I’ve just done an example method of something you could do so on struck by lightning it sets it to glowing that’s just an example of what you could do in The Sheep class okay but next we need to go ahead and do the render and then we need to go ahead and do the model so let’s go ahead and do that so in our client package I have created entity and I’ve got the model and the Render so let’s go first create the render class so that it’s just going to be example render well actually it should be example entity render as we’re going to have different renders in the future which aren’t going to be for entities and this is going to extend mob renderer And verse is the entity so example entity and then it’s the entity model so example entity model and that is privatized with our entity so example didn’t I know this is a bit of a generic spaghetti but you don’t really need to worry about that it’s just that’s what It’s going to be and you kind of have to deal with that so in here first we need to create the texture path so that is a protected protected static final resource location and we can just call that texture that can be equal to a new resource location if it loads there we Go first is obviously the mod ID so tutorial montmartre ID and then it’s the path so that can just be textures /nc for slash and then the name of our texture so that’s just going to be example and score ends feed or PNG there we go and and next is just to construct Her so you can add that up here or at least I thought you should be able to add it but we have an error actually so it’s not going to add it is it so that is a public example entity render and that’s just going to take in the entity Render manager so entity render man nature and we’ll just call that rend random manager in and in here we can just super so super random manager in and the model class so a new example entity model of example entity the brackets and then 0.5 F so The 0.5 F is the shadow size and just so you know and then the next method is get entity texture so let’s just use that and for return texture so finally when you need to go ahead and do is create the model so I’m going to be using block Bench and all you need to do as you can see I’ve already created my amazing model right here but all you need to do is create a new mod identity and you need to make sure that it is all in one group called the body and inside the Body you split it up into all the parts so basically every cube should be in its own group which is inside the body I know it’s a bit complicated and but this is just how it works and I mean I hate modeling personally as You can see this is why this is not the greatest model in the world it’s just a showcase of what you can do but you need to make sure everything’s in its own group and I will be showing you why very soon and because if you don’t you’re Gonna have to do some some weird stuff and you’re gonna have trouble with animations if you don’t have it in its own group and because you can only animate groups so for example with this group I can only rotate the group like that I can’t go ahead and rotate this Cube as you can see no rotation ball comes up it’s just yeah and just create the texture so create the text so you just create heck to tick the template box confirm confirm and then that creates the texture that you want and then afterwards you just Export as a Java entity and you save it and yeah I will show you what you do from there so let’s just close this now because I don’t need this anymore and let’s create this model class so you can just use the one from block bench but I’m going to actually create it and and coffee what I already have in so example entity model okay and I’m just gonna go and find my random folder cause in my I basically have it all I have the raw file somewhere so if I go on my F Drive Documents random and I look for model open that okay so when you export your model class will look something like this now as you can see it is Error error error galore because block bench isn’t suited for 1.15 actually that is one thing I do need to mention if your on block bench You need to make sure your settings are 1.14 so go to settings export and make sure this is one point 14 not one point twelve advisor going to export it right I mean it already doesn’t export it right but you can just ignore that so The first thing you will need to do is just add the package declaration up at the top and then you need to rename the file back to what it’s actually called so example entity model is the name so just rename that your example entity model and that will fix that error but Once you change the constructor as well okay and then you need to go ahead and change a renderer model everywhere to model renderer and stat will fix some errors there once you’ve imported that you need to delete the render method and create a new render method which is this One and just render the body in here so you could do body Brenda and needs to be the one with the four floats at the end and just use those there you go we also need the method set rotation angles yep that one which we can just Leave blank for now because I’m not going to be showing your animations in this tutorial okay that’s pretty much all wait no there’s a lot more we need change than that so the next thing your needs change is actually up here so this needs to be it Needs to have a generic and that is t extends example entity and just like that’s and the entity model also needs T in it now see this is going to give an arrow down here cuz we’re using entity to change entity to T and that will fix That and now we need to actually fix up this code because it’s all wrong block bench exports it wrong it doesn’t work for 1.15 so we have to write it out ourselves which is a bit of a pain but it’s okay so what you can do keep this Line right here because we’re going to be using it to get our values so you just do body dot assets texture offset and these two values are the first two integers so for me that’s just 0 0 for the body here and after that you do not Add box okay and this first takes in these these floats right here which is the positions so it takes in the X the Y and the Z so- 6.0 f- 6.0 and negative ten-point over and then it takes in these free imps right here which is the size so That is the width the height and the depth so 12 8 and 18 and then it’s the float which is the scale and then it’s whether the texture is mirrored which for me is false and just make sure you add that comma there you go and then you Can just delete that line and that is it and now you need to basically do that for all of these so I’m just going to show you this one and I will do the other ones off-camera so right back dot add note set texture offset 0 0 and then dot add Box so that’s yeah just add box first one is negative six point zero then it’s 2.0 then it’s just six point zero and then it’s – 6 – it’s the scale which is also known as – Delta and then it’s perfect mirrored or not which is false And that is it you just delete that and you just need to do these for the other ones as well so I’m going to go ahead and do that so I can pretty much just copy this because I’ve already done it myself and there we go that will fix all Of that now what you might want to do is use the you might want to create some guesses for your stuff so if you just type gets you can see it’s get back and then type get again get body get front get ahead and this is basically a useful because These variables are private so if you wanted to use these methods those variables in a different class presume in that you have an instance of this class that won’t be any issue so you don’t need the merit these methods if you don’t want to it’s perfectly fine to Not have them I just think it’s quite useful to have them and that’s pretty much it the next method just one last thing is set living animations and this is basically what you can do when the entity is going about you can set its animations to what you need the Animations to be so yeah and that’s actually it for the model class obviously for more complex models you might be spending a while doing these texture offsets and boxes but honestly it doesn’t take too long obviously if you feel like you need to you can create a generator to actually Change what it was to this and that would be very simple to do obviously if you feel like doing that you can go ahead and do that no one’s going to question it and because it’ll be your generator so you can do that if you want But I don’t feel the need to do that let’s just go back into our entity render import our model and we have an issue here cannot be resolved to a type I think entity outs entity renderer manager my bad yep and that should be it for values Classes now the last thing you need to do is you need to bind the renderer to the entity class and we do that in the client setup so if we go into util and we go into our client event bus subscriber below where we’ve done the Cutouts and the binding of screen and we can use rendering registry surrendering registry dot register and Steve rendering handler and that can be mod entity types dot example entity get and then the render factory which is just example entity render program : new and just import that and that is it That is all you need to do for an entity now obviously this won’t have a spawn egg we haven’t done we haven’t got to spawn eggs yet I want a separate episode for spawn eggs they’re not hard but it’s just worth having a separate episode for Anyways so now let’s go ahead and run the game and I will see you guys in the game ok so as you can see we are now in the game and if I go on top of the tree right here and I do /summon tutorial mod example and see where it is Summon that and here here he/she whatever is beautiful we can punch it if she doesn’t have sound yet we’ll be doing then soon as well let me get our item are now they’re moving now they’re moving interesting mighty mighty interesting isn’t it Summon it down here is it gonna move because you’re meant to be moving like eating rocks but that could take some time for them too oh now they’re moving there we go I don’t know what I did to make them move but now they’re moving yeah I’m lagging badly that computer Doesn’t have a career in the world and they are moving now I don’t know what I did but they’ve decided they want to move now right like you guys want to move now right yeah these close down on me I don’t know but they they are moving now anyways And that was bit weird but the video is already getting quite long so I do have to wrap it up here so I hope you guys did enjoy this tutorial if you did a plea to be short to smash face into that like button and subscribe if you really Enjoyed it please do be sure to share and yeah I will see you guys in the next one Video Information
This video, titled ‘Minecraft Modding Tutorial 1.15 | Episode 28 – Basic Entities | Passive’, was uploaded by TurtyWurty on 2020-03-29 20:00:41. It has garnered 12606 views and 246 likes. The duration of the video is 00:33:58 or 2038 seconds.
Hey guys, TurtyWurty here, in this video I cover how to make a basic passive entity. In the next one, I will be covering either spawn eggs for our entity or sounds. Hope you guys enjoy, all links are below VVVV!
My Discord Server: https://discord.gg/d5cGhKQ Episode 27: https://youtu.be/X8Rr_Gkri5U My GitHub: https://github.com/DaRealTurtyWurty/1.15-Tut-Mod Tutorials I will be doing: https://trello.com/b/LNQlC0l1
Minecraft Forge 1.15.2: https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.15.2.html