Let’s add a custom entity to minecraft oh right reference back in intellij once more and in this tutorial we’re going to be adding a custom entity or custom mob to minecraft now this is going to be a very very interesting thing indeed and for this mob what we’re actually going to need is Another well api and we’re going to use the geckolip api for this so in the description below i have linked the gecko lib repository here for from github basically and this wiki will explain everything on how to install it but of course we’re going to go through this as well we need The for forge use right here and making sure that we go down all the way to 118 there you go and then we need to first of all copy this one right here for the repositories so let’s go in back to intellij and let’s go into our Build.gradle file and we have to add this specifically a little bit further down so we need to go to the repositories right here and then just add it right here so we can see pretty similar to you know the ji one where we just add this maven right here this Maven url and then we also wanted to add this one right here the dependency and let’s make sure that this is also copied over so this is going to be down here there you go and that should be all that we need in this case we can then just Hit the load gradle changes button and let it build run through you know once again might take a minute to maybe even just a few seconds depends on a lot of different factors your pc your internet connection and whether or not you’ve done this maybe even before but let’s Just let this run through in the background one way or another i highly recommend checking out the wiki because there is actually a lot of stuff in here that you can well basically get from well taking a look at the wiki i highly recommend it and then the yeah that’s Pretty much the general idea there are also some example uh basically example build.raider files but you know we basically have seen this already this is now run through 31 seconds and there you go so just add those two and then immediately afterwards in our tutorial mod class at the very bottom we’re just Going to do is we’re just going to say geckolip dot initialize and then we also know of course that it works because the geckolip class has been successfully added you know to our project therefore geckolip is correctly installed now geckolip is installed how are we going to add our custom entity well First of all what we’re going to do is once again use blockbench to actually create our custom entity and this the reason why we’re using geckolip is because then we can add amazing and very cool animations to it so let’s open blockbench here as you can see i’ve already prepared the raccoon entity Right here so this is really well done i mean it’s really awesome so the idea here is that when you have blockbench you can actually download a plugin so this is going to be under file plugins and that is the geckolip animation utils right here so just go to available and Search for that and then install this and then if you have this then you can make the new entities so we can then go down here gekko lib animated model and then you know whatever test let’s say and then you can change this up you can Also go i believe to the where is it it is in right here gecko model settings and then make sure that this is set to entity and then you can well change this however you would like and in this case right we already have our raccoon done and then You see this animate button right here so we can click on this and then there are different animations i’m gonna quickly sort of roughly explain what this does if you’ve ever edited a video or if you’ve ever you know made something with animations then you will know this timeline it basically Works with keyframes so if we go to the walk animation right here you can see that if i for example click on the leg you can see there are certain well different things that happen um let’s actually see if there is the legs should have animations too associated with it Maybe it’s actually it’s the individual parts that actually have the animation so you can see those are the different keyframes here so you can see the rotation and then the rotation right here is going to be something different and then in between it just well it changes the actual rotation in between So that’s the idea of keyframes and you know i highly recommend just playing around with this a little bit and checking it out if there’s a lot of demand for it then i can also make a little bit more of an in-depth tutorial for blockbench just you know just give Me a comment down below and then we’ll see that to that as well but yeah the general idea is that you can basically change stuff with the animations here you can i also have a sitting animation which is just you know literally this and then the walking animation you saw It right if i play it there you go there it’s walking and really freaking awesome there also is an idle animation i can show you this as well so it’s like very very basically like it’s almost not visible you see it’s just like the body And the head moving up and down and then of course the tail just rotating around and the way i’ve done this is if i click on this and see i’ve actually done this with a rotation and this is just some mathematics once again so the sine curve of course is just a curve That goes like this right and then we’re basically just putting in the actual animation time and then you know actually just multiplying it with some factor here and then outside as well so you can also change those factors to i mean change the speed and or you know The actual where it stops and where it starts basically so the amplitude and all of that you can basically change with just these two factors right here so once again highly recommend playing around with this this blockbench file will be of course available to you as Well let’s just save this for the sake of argument and then we what can we do with this well first of all we have to go to a file here and then export the geckolip model so there you go i’ve already done this this is a geo.json File so very important a bedrock model don’t worry about it this will work in java as well let’s just replace this that’s fine but if we go to the animate tab and then to animations we can export the animations as well make sure to select all of them confirm and then we Can basically see this is an animations.json file so just say save this as well and there you go and then we have all of the json files that we basically need as well and then we can proceed in intellij right so what are we going to need here well first of all we Are going to need a new package so in our tutorial mod package right click new package called entity and then instead of there we’re going to make a new a new package called custom and inside of there we’re going to make one class so in the entity package mod Entity types there you go and then in the custom package we’re going to create the raccoon entity class there you go and this is going to be very very interesting let’s start with the raccoon entity class and this is going to be well quite interesting indeed this is Going to extend the animal class this one right here and this is going to implement the i animatable there you go let’s hover over this and implement methods it’s going to be three methods right here and then we’ll also hover over this and construct create constructor matching Super and this should be fine if the actual names here bother you you can click on it shift f6 to change the names and then the actual suggestion should be fine the next thing we’re going to need i’m going to copy over a few things once again of course everything here is Available to you in the description below get a repository individual gist as well the first thing we’re going to need is the animation factory this is the thing that we’re going to return right here so we’re just going to say this dot factory that should be the first thing that we Need this is of course needed for the animations the get breed offspring is something we’re going to actually ignore for the time being this is going to be done in a future tutorial where i’m actually going to show you how to add the you know baby entities as well it’s Not that complicated when i wanted to do it in a custom tutorial as well so that we have this as well let’s make this constructor public as well otherwise we’re going to forget this and then we’re going to need another thing and that is going to be the attributes so the attributes are Incredibly important here so i’m going to copy this over as well as the set attributes method and the reason why we need this is of course well this particular entity needs some attributes and if we forget to set the attributes then it’s actually not going to work so Please keep that in mind we’re gonna see how to set them in just a moment if this is great to you then usually you have not called it therefore the attributes have not been set so keep that in mind as well then what we’re also going to need is We’re going to need the things for the animation so some things here are of course you know vanilla and some things are specific to geckolip specifically geckolip are these two methods and for this register controls method we’re going to need another method which is called the which Is called predicate i’m just going to copy this over and it’s going to look like this there should be no errors present and the idea is that you can see it basically goes to the animation so it basically has a reference to the animation that raccoon walk and Animation raccoon idle so if we switch back to blockbench for a second and look at the animations this is exactly the name of these animations here and this is what this basically refers to in our register controller what we want to call is this this is pretty much boilerplate Code this is always going to be the same a data.animationcontroller just with a name controller and then passing in this predicate here as the last parameter and this is well yeah pretty much the thing that we want so if the actual entity is moving then we want to display the walk Animation and if nothing happens then we just want to display the idle animation all right these are almost all of the things that we need to add here we need to we have two different things that we can still add number one is the sound so we can actually add some custom sounds Here so you can see there are five methods play step sound ambient sound heard sound death sound and the sound of volume which you can basically override and you can return any type of sound event here for these and then just basically play them when certain things happen i highly recommend playing around This as well like always be open to experimentation and just play around with this and then you’ll hopefully find a few cool sounds to play here but the last method that we want to add is the register goals method and i’m just going to copy this over and you can see so This is probably what the most complicated the most complicated one simply because of the fact that the goals can be quite complex so the general idea of the goals is the following that you have certain goals with a certain priority and then those goals are basically executed and we can Go into those you know goal classes by pressing middle mouse button on those classes and then you can see we’ll have basically how they work now what i can do for example is i can go into any goal and you can see it extends from the goal Class if i click on this and press ctrl h we are able to see all of the different goals that are exist in minecraft if i you know expand all of them we can see even more goals that exist so we’re not going to do any custom goals in this tutorial series Because that would be way too complicated and also it would be probably too specific because you know the one person maybe wants a specific goal that is something completely different from another person and here it just is once again what i always say if you don’t have sufficient java Knowledge custom goals are going to be very very hard to understand because it just requires a lot of java knowledge here i would say intermediate at least otherwise you are might be stuck i mean once again be open to experimentation try out a bunch of stuff look at the Vanilla goals here and try to understand what they’re doing and then probably hopefully you can sort of map it if you have custom goals that you want otherwise you can also take a look at some of the actual other classes so if i middle mouse by click on the animal Middle mouse button click on the ageable mob middle mouse button click here and then on the mob i can you know once again and then once again on the living entity and then the entity is pretty much the last one yeah the entity is the Last one so what i can do is when i’m on the entity click on it press ctrl h once again and then see all of the different entities that are available to us let’s actually expand this as well and then you can see all of the different entities and once again highly suggest Go through the you know the actual vanilla code look at how things done if you’re like i want to add something that’s similar to a guest look at the guest the gas has everything you need to know and yeah it looks like quite a lot but when you really think about it you Know you usually don’t need everything and even if you need a lot of it you know just go piece by piece think about it okay what does this mean what does this mean what does this mean so i highly recommend i cannot recommend this enough because entities your custom Entities custom mobs can be very very complicated depending on what exactly you want to do and you know looking at the vanilla things is just the best resource that you have basically right but that would be the entity and now what we want to do is we want to Register this entity so this is going to be in our mod entity types class right here and i will actually copy over the deferred register and the method because let’s be honest you’ve seen me you know type out the deferred register about a billion times already so i think that These two things should be fairly self-explanatory at this point right just this and then we of course also call this right here let’s just call it um actually right here so that’s going to be the mod entity types dot register and then passing in the event bus there You go and then um we’ll also copy over the registry object right here but this should be you know no worries at all so you can see we’re calling the entity types for register.register of course and then the name raccoon fair enough and then we’re making a supplier of Entity type builder of the raccoon entity colon code and new so this calls the actual constructor right here make sure that you know everything here is set up correctly that this is made public as well and then we have to specify a category this is a creature There’s also as you can see ambient x lawless misc monster and some other ones but creature here fits perfectly the size here is actually the size of your hitbox as well so keep that in mind for the size and then here the build in this case just needs a resource location once Again with the name of the actual entity and then tostring so this is all that you really need for this and that would be fine but after having added this we now need some sort of way of actually well displaying the raccoon entity so in our entity package we’re gonna make a New package called client and inside of there we’re gonna need two new classes one of them is going to be the raccoon model and the other one is going to be the raccoon renderer so once again this is specific for echolib if you have if you don’t have Geckolip then this is not going to work you can’t follow this tutorial and like anymore um i mean you couldn’t follow it anyway with the i animatable of course right you need geckolip for this but still the model and the renderer are specific to geckolip now so we’re going to start With the model which is going to extend the animated geo model and then in the angle brackets raccoon entity there you go and i’m going to hover over this implement methods and this is going to be three methods now this is actually going to be fairly straightforward we’re just going to need A new resource location of course every time of tutorial mod that mod id and then another path here the first one is going to be geo slash raccoon dot geo dot json and of course how about we write this correctly there you go rakunji or jason there you go and then let’s just Copy this over because the other ones are going to be very similar this is going to be a textures slash entity slash raccoon slash raccoon dot png actually there you go and then the last one is just animations then instead of geojs and we have animation.json there you go so this is All that the raccoon model here really needs so here we’re pointing to the actual model file here we’re pointing to the texture and here we’re pointing to the animation file should be fairly self-explanatory these two we have exported from geckolip and then this one well i mean it was also in gekkolip but We also have this available so we’re going to add those in just a moment first we’re going to go into the renderer which is also not that crazy so this is going to extend the geo entity renderer once again of type raccoon entity here and let’s hover over this Creek constructor matching super and the first thing we want to do is this model right here we want to get rid of and then here instead of the model provider you want to say new raccoon model there you go and then here we can also define the shadow radius so for example shadow Radius is going to be i don’t know 0.3 for example and there you go so this should be done as well here we want to overwrite two methods i’m just going to copy them over it’s not going to be too complicated you can see once again the get texture location Method and the get render type method here we can also scale the size of our entity so if you for example want your entity to be bigger you can then here do it right 1 1 1 would be just 100 and then if you had you know 1.5 in Every direction then you would scale it by 50 up so think about that and you can also do that as well but these are pretty much the things that we need to do here so let’s then go and actually register the entity renderer as well so this rendering class Instead of the tutorial mode package inside of the client setup event what we want to do is we want to say what we want to say is in entity render us there you go dot register and then pass in mod entity types dot raccoon dot get and then the raccoon renderer which i Actually mistyped colon called new you can see let’s actually rename this written properly there you go and then we should be fine there should be no errors present right here as long as you change the constructor of the raccoon renderer and then we should be fine We can close those two classes this one as well and then we only need the attributes method and then the json files so the attributes method very very important as i’ve said this has to be said otherwise it’s not going to work and this is going to be done in our Events package mod eventbus events and here we’re just going to need a new method i’m going to copy this over quickly once again this is not too crazy you know this is just the set at the entity attributes event and you can see this is the entity attribute Creation event here and we’re just adding the raccoon with the raccoon set attribute that’s literally all we’re doing nothing too crazy here so yeah that’s pretty much how we what we have to do very important and then you can see also this turns yellow so now we Know that this has been set and everything here is fine and now we need the json files now luckily where we need to put the json files is pretty much defined in this model right here so you can see geo raccoon geojson so this goes into our assets folder tutorial mod Folder and here we need to make a new directory called jio and then i’m going to copy over the actual geojson there you go that’s the raccoon geojson yes please and then we also need the animations folder so animations and then copy over the animations raccoon animations json there you go And that should be fine as well and then last but not least we also need under the textures folder a new directory entity and then here a new directory called raccoon and that is one oh too many that’s gonna be fine let’s just do this and then there you go and then Let’s add the raccoon png as well and those should be all of the different well things that we need to hear now what we still need and this is pretty crazy we still of course want a custom item now what custom item what we want Well we want a spawn egg yes that is exactly right so we could in theory already spawn our custom entity with a with the summon command but let’s be honest a custom spawn egg would be cool as well so let’s just add the spawn egg right here so let’s just copy this over Quickly that’s going to be fine like always of course everything available to you in the description below get up repository individual just as well you can see we’re using a forged spawn egg item in this case i mean here we can actually make it an item i mean it Doesn’t need to be this but here you can see this is a forged spawn egg item and raccoon spawn egg with the colors so those are gonna be the colors of the actual egg now what we still need for this is a translation file so in the Translation actually and we also need a item model file for this as well so let’s just add this there you go raccoon spawn egg it should be fairly self-explanatory and the actual item model is not going to be too crazy as well this is just going to be the actual Spawn egg there you go but we can see this is also very straightforward it just has the item temp slate templates spawn egg as a parent because of course then it’s going to basically color it in with the two colors that’s the general idea here And those are all of the steps that you have to do here in order to add our own custom entity uh you know once again there are quite a few steps overall and you know the actual class itself while not particularly crazy in terms of how Much there is you know it can be quite complicated to get exactly what you want i once again highly suggest you just have to be open to experimentation try a load of stuff look at the vanilla code that is the best resource that you have at hand the second best resource is Probably other mods on github basically that also use geckolip and you can always take a look at those as well but for the time being let’s see if it works all right friends i was back in minecraft and the spawning has been added so let’s see if we can spawn the Raccoon and there you go let’s spawn a bunch of them and you can see the idle animation then the walking animation as soon as they begin to walk so let’s see we can see it a little bit more there you go so we can we saw the walk Animation there and there well they also have the custom sounds so you can hear that and well they also flee so this is another goal that is basically determined in the goals register goals method and yeah that’s pretty much how easy it is to add a custom entity minecraft Right and while this is it for this tutorial right here we’re going to continue with the entity tutorials for another week and a half right about so we’re going to basically make it tameable as well add the baby entities we’re also going to take a look at how You can spawn them and then also have different variants so basically have them have different colors so that’s all still to come but that would be it for this tutorial right here i hope you found this useful and you’ll learn something new if you did or very much Appreciate like and don’t forget to subscribe for more tutorials just like this one i also want to thank all of my lovely patreon supporters for supporting me and this channel it is very much appreciated and i’ll see you in the next tutorial so yeah Video Information
This video, titled ‘Minecraft Modding 1.18.2 with Forge | CUSTOM ENTITIES WITH GECKOLIB’, was uploaded by Modding by Kaupenjoe on 2022-05-10 13:59:53. It has garnered 32583 views and 524 likes. The duration of the video is 00:21:30 or 1290 seconds.
In this Minecraft Modding Tutorial, we are adding a custom Entity with GeckoLib to our Minecraft Mod using Forge in Minecraft 1.18.2
== MINECRAFT COURSES == ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 *
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.18.1/tree/52-customEntities Gist: https://url.kaupenjoe.net/yt290/gist Assets: https://url.kaupenjoe.net/yt290/assets
== TIMESTAMPS == 0:00 Intro 0:28 Adding GeckoLib for our Project 2:30 Looking at our Entity in Blockbench 5:14 How to export the Model & Animations 5:45 Creating the Custom Entity Class 11:55 Registering the custom Entity 13:25 Creating the Custom Entity Model Class 15:13 Creating the Custom Entity Renderer Class 16:20 Registering the Renderer 16:50 Adding ther Attributes to the Custom Entity 17:29 Adding the JSON Files 18:41 Adding a Custom Spawn Egg 20:15 Demonstration 20:51 Outro
== 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 *
== 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 == Outro Musik by Kevin MacLeod: “That’s a Wrap” Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0
== 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