Let’s add a custom hostile gecko lip entity to Minecraft right we find ourselves in intelligent once more and in this tutorial we’re going to be adding a custom hostile entity with gecko lip to Minecraft this is an absolute Banger of a topic as the Hostile entity the real issue here is The attack animation now will not tackle the attack attack animation in this tutorial but in the next tutorial now we’re basically going to set up gecko lib you know import everything so that it works and we’re going to take a look at all of that so first of all of course We have this beautiful Chomper over here this is the actual entity and for that you just need to basically export the Geo you need to export the geojson file the animation file as well as the texture those are the three files that you need to basically export I have a Series on making this you know particular entity here you can just go to the export gecko lib model over here that’s going to be the geojson file under the animation tab animation export animations this is going to get you the animation Json as you can see and then The texture you can just save by going right here basically right click you can do save as and then you can just save the texture here as well and those are the three files that you’re going to need from blockbench and then we can proceed in IntelliJ and with IntelliJ of Course I mean in on GitHub here with the gecko lib repository because we need to go all the way down to over there it is Forge 119 1 or 2. because we need to add those different repositories in the dependency here so that we have access to gecko lib for our project basically So what we’re going to do is we just want to get this one here to the maven one and then let’s go here to our build.gradle file and then down here in the repositories right so you can see we basically want to go all the way down to repositories paste this in here Absolutely no worries then we want to go back you know we can select this one Ctrl C to copy it and then paste this under here so under the dependencies we then want to place this one and that’s pretty much what we need to do now let’s Just load the Gradle changes this can take once again as always anywhere from a few seconds up to a minute two minutes depending on how fast your internet connection is the PC and all of that craziness and whether or not you may or may not have downloaded this before Because I’ve already of course downloaded the you know this version before this is why this is probably going to be a little bit faster for myself and there we go build successful in 52 seconds exactly what you would expect to and well now we can basically Proceed the first thing to do in your main mod class Constructor right in the tutorial mode Constructor over here what I just want to do is I just want to call gecko lib dot initialize and this basically also shows that okay gecko lib is properly you know added to our Project and everything should work totally fine we do need to call this so definitely don’t forget that and then we can basically proceed in our tutorial package right click a new package called entity and inside there we’re going to make a new Java class called the mod entity types And then we’re gonna make a new package here called custom and inside of there this is where the Champa entity class is going to go there we go now we’re going to start with the chomper entity because that’s going to be the I would say the most complex one this will extend the Monster class this one right here from netminecraft World entity monster and it will also implement the I animateable interface if the interface is not available for you this means that there’s something wrong with the gecko lip installation for your project so do keep in mind that the this one is of Course as you can see right from gecko lib so if gecko lip is not properly added to your project then this is not going to work right so implement the methods from the interface that is going to be the register controllers and the get Factory method and then create Constructor Matching super and there we go then let’s make this Constructor public that’s actually very important and then I’ll start copying over piece by piece code basically and then I will explain a very important of course as always all the code is available to you in the description below GitHub Pastor an Individual just as well let’s start with the animation Factory this one is going to be basically always the same thing when you have an animatable you’re always going to have an animation Factory and it’s only always going to look like this and you’re always going to return it here in the get Factory Method that’s pretty much always going to be the case right next let’s start with some other things and that is going to be the attributes for example so let’s just copy this over as well the set attributes over here and you can see this basically just sets the max Health The attack damage it’s the speed and the movement as well so nothing too crazy this basically just sets some basic attributes if you want to look into how other you know mobs do things or how their attributes are all of that I suggest you go to the monster class over Your middle Mouse button click and for example for the monster you can just press Ctrl H when you click on it and you can see everything single basically like hostile entity that Minecraft adds and you can even expand it even more and you can see every like literally Everything is in here you can say oh how does the zombie work absolutely no worries just go in there and you can see this is the entire zombie class so you have so much like so many different classes so much code available for you to take a look at and try to understand How it works so of course this is not like easy or you can just go in here and like immediately understand everything of course there’s a little bit of java knowledge that or maybe maybe even a lot of java knowledge that goes into there but you can definitely see that there is A lot of stuff in here that you can use as blueprints for your own custom entities anyway so those are the set attributes that’s gonna be fine but let’s actually then continue along with first of all the gecko lip stuff so of course we have the register controllers Over here now for this what we’re going to need is actually a predicate I will copy this over but it will pretty much look always like this you can see it is a private you can see it’s a private method here that returns a place date And we also have an animation event over here with an e that’s totally fine you can that’s pretty much always how the method signature looks like and you can see when the actual entity right so this is event but when the entity is moving then what we’re going to do is we’re Going to play the walk animation and if it’s not moving then we’re going to play the idle animation that’s basically all that happens here and to basically do it properly in the register controls we need to create a new controller and that literally always looks like this data.animation animation controller Making a new controller over here called controller and passing in the predicate method that we’ve just copied over so that’s pretty much always going to be that and this is in at this moment in time actually all the things that we need to do for the I animatable Interface in the entity class there’s a few more methods that I just want to copy over just so that you have seen them before and they do understand them and those are mainly the sound sound things basically you can see play soundstep get Ambient sound hurts on Death sound sound volume you can of course change this as you know as you see fit to different sound events custom sound events would also work so that would be a thing that you could do as well to see all of the methods that you can override you can of course also type In override and then you’re gonna find well you know basically every method that you can override I did say that entities are very complicated and I think that this sort of shows what I mean by it right there is a lot of methods to possibly override and I mean I don’t even know what all of those do or what that’s happening here so it is a thing that is definitely for more seasoned basically modders or not necessary Motors but at least with you know like good solid Java Foundation well I wouldn’t necessarily say required it is like insanely suggested and Insanely recommended alright so this is actually the entire entity class done so let’s just register our entity in the mod entity types class so how is this going to look well of course we’re going to have one of of our favorite things again and that is of course the Deferred Register of type into T type this time entity type of type question mark very important that this is done correctly entity underscore types equals to A deferred register.create or Registries dot entity types tutorial mod.mod ID and I hear all of you scream where there is a deferred register there of course is a Register method over here with an i event bus all event bus and we’re going to call the entity type sub register passing in the event bus and before we forget this let’s also add this to our instructor over here mod event mod entity types there you go register and then passing In the mod event bus and there we go now we can proceed to actually properly register The Entity as a public static final registry object as per usual of type entity type of type Trump entity or the chomper equal to entity types dot register the name Chomper that’s exactly Right and then a supplier of entity type dot Builder dot of in the for any parentheses here Trump entity colon colon new I’m a mod a mob category mob category monster in this case of course right after the first closing parentheses we want to do dot sized Uh let’s do 0.4 F and 0.1.5 F uh though those numbers determine the hitbox of the entity very important and then we want to call build with a new resource location a resource location with tutorial mod at a mod ID and the chomp as a name and then after the first Closing parentheses to string and there we go and then we can end it with a semicolon as always of course all of the code available to you in the description below GitHub repository individual just as well and when once this is registered over here we can now actually also do The other thing that we need to do and that is called a set attributes method this is extremely important right so keep this in mind we can see that this is now grayed out so this is not being called we have to set the attributes otherwise if you spawn the custom entity Your game is going to crash if you don’t set the attributes properly so what we want to do is we want to go into the mod events class and I’m actually going to change this class around a little bit now this might look a little bit weird At first but don’t worry about it we’re going to be fine so inside of here I’m going to make a new class so public class and this is going to be the forge events class so Forge events right and what I’m going to do is I’m going to Take this guy over here and put it over the class here and literally everything that is inside of here I’m just going to take and put it into the this class right the forge class so nothing here has changed really uh overall it just is Now inside of this class in this case I will also make this static that does make actually quite a lot of sense yep there you go and then we’re going to make another class public static class and this is the mod bus mod event bus events there you go now this will have The same attribute over here with a little bit of a different thing and that is a second parameter and that’s going to be bus equal to Mod Dot event bussubscriber DOT bus dot mod instead of Forge and then here we can finally create our event that is the public static void entity Attribute event and we’re gonna do the entity attribute creation event very important and inside of it we’re going to say event.put mod entity type start chomper.get and then do Chomper entity dot set attributes there you go and do not forget the add subscribe event over here this is exactly how this needs to Look like and then the attributes will be added as well so we can see this is now yellow so this would be fine and the entity class is done the mode events class is also done the mode entity types is also done but what about the rendering I use stream absolutely so in Our entity package right click new package called client I like to call put this into the client package here and we’re going to have the Champa model uh you know making this writing this correctly would be of definitely a little bit nicer there you go to the Chomper model and then the second class is going to be the chomper renderer there you go we’re going to start with the model here this will extend the animated Geo model of type Trumper entity and we can just hover over this implement the methods over here and that Those are just going to be three resource locations I will copy those over but they will be you know they will make sense in very very soon you know you’re gonna be able to figure this out in no time so you can see those point to the Json file the animation Json file Here and the texture right here that’s literally all that there’s to it for the model and where do we get those Json files from and the texture file from well those are all from blockbench this is what we’ve already exported from blockbench so we can now add those so Those go into the assets folder tutorial mod folder or whatever your mod ID is new directory called Geo and we’re gonna get the geojson file over here copy that over there you go and then the next one is going to be the textures so textures entity and then Inside the entity folder just the chamber texture there you go absolutely and then last but not least the animation one as well so in the tutorial mode folder once again new directory animations making sure that we write all of this correctly and then the chomper animations file over here as well there You go so now all of those three files are in there and the model is done and we can proceed to the renderer and the renderer is actually fairly straightforward as well this will just extend the Geo entity renderer of type once again Chomper entity and we’re just going to hover all this Create the Constructor matching super what we want to do is we want to delete the second parameter over here instead of the model provider we want to make a new Chomper model over here we can also Now set the shadow radius over here let’s say for something like you know 0.3 is going to be fine so this is the shadow radius below the actual entity and now we have two more methods that we can overwrite so the first method that I actually want to override is the get texture location method now here I’m just going to return the exact same Texture that we’re basically getting there as well and then we also can override the get render type method which is pretty much a well a render method which is which could be very very useful for a lot of things you can see there’s a lot of a lot of parameters Over here but that’s going to be fine so here you can because you have access to the the post stack you can do all sorts of craziness so for example we could scale the actual entity by for example like 80 so we’re just gonna say that the Entity is like only 80 the size that we’ve actually made it in Block bench there you go and you can do all sorts of craziness because you have actually access to the Trumper entity so you could do I mean insane stuff like you know if the entity has a certain value Then you can change the size or you can change the texture all of that craziness so there’s a lot of stuff you can do in this method but that is pretty much what we are going to do in this case now we still need to register the renderer this Is also extremely important in the tutorial mod class in the client mode events over here FML client setup event what we want to do is we want to say entity render us entity render us this one right here dot register mod entity types dot jumper that get and Then render and then the chomper renderer colon colon new no errors should be present if everything is done right if you do get an error double check your instructors over here that they have the correct amount and the correct types of parameters right and for completion’s sake in so in theory Now the entity is done but just for completion sake let’s also add the spawn egg over here because that sometimes is a thing that people ask for as well and we of course wanted to do that as well let’s just copy over the account sort that’s going to be fine this is the Chomper underscore spawn underscore egg and then the name here as well of course Chopper underscore spawn underscore egg this is a very important Forge spawn egg item extremely important that you choose the correct one the first parameter is going to be the entity that it spawns so Of course mod entity types dot Chomper actually without the gets that’s also very important then we have a background color we’re just going to do something like this this is going to be a green over here in HEX of course and then we’re going to do another one that’s one Nine seven three two e I’ve already tried those out and those are going to be okay making sure that this actually Stacks to 64. and that is the item registered and then when it comes to well of course this is a normal item so we still need the translation here there You go nothing crazy Trump or small egg and then when it comes to the item model that is actually a very interesting one but also not a complex you can see of course just called Trump spawn egg over here and it actually just refers to Minecraft item template spawn egg and That’s going to be filled in with the colors that we have specified right here I think I was a little over enthusiastic over here because there is actually one more thing we need in the entity class and that is of course I mean pretty much one of the most important things I’ve Not overlooked this I’ve of course just wanted to test whether or not you’re going to figure it out or not well it is of course the goals method over here because we still need the register goals map that let’s just override this one we don’t need to call the super and well I’m just going to copy over the contents of this and quickly explain over here so what we’re going to have is we’re going to have a float goal a melee attack goal water avoid random struggle and a random look around goal you can see those have priorities the lower the number the Higher basically the priority so it’s first of all going to float and then it’s going to melee attack and so on and so forth and then we also you can see those are different selectors so there’s a goal selector and this is a target selector because for example for the Melee attack goal what we need is we need a Target and this the target selector basically selects the target based on the well based on this particular nearest attackable Target goal when it comes to the goals we’re not going to go into extreme detail next tutorial we’re just going to make a Custom melee attack a goal so that we basically have the attack animation as well but what I can say is that if you want a custom AI or custom entity AI basically number one this is this can be extremely complicated so you need proper Java knowledge to do this that you can’t Just go in there say like I’ve you know I’ve done like three Java tutorials and that’s probably going to be fine absolutely no like I don’t think so it’s not going to be a thing but what we can do is we can go to the goal class over Here press Ctrl H and take a look at every single vanilla goal that is being used or has been created you can see there are so many different goals over here you have I mean so much stuff that you can take a look at try to understand And this is like just vanilla like let’s not even start talking about you know all of the things that you can look into other mods and their goals but this is just vanilla goals I cannot stress this enough you have to take a look at these Goals and try to basically look at them how they work you can say okay let’s try this out and just try stuff out this is like the best thing to like to be open to experimentation that there is so a Duke take a look at this and then you’re Probably going to be fine now after having the register through goals over here now we’re finally done and we can finally take a look at the Trumper entity in game alright so the final says in Minecraft and let’s first of all see there is the chomper sponeck has been Added and let’s also get a villager and a creeper because those are actually two of the entities that the chomper will attack let’s spawn it and there we go so the Island mission is already playing and we actually saw the The Walking animation did also play it’s it’s very Subtle but you can see the legs are moving let’s just spawn a few more just so that you can see like when the you could actually saw it there as well so the walking animation definitely does play now when I spawn the Villager they’re gonna attack but there’s no Gonna be there’s not gonna be an attack animation but they are going to attack it so as you can see that does work they don’t they don’t seem to be you know having that much attack damage but fair enough let’s also go into survival mode you can see they’re immediately Gonna attack me as well okay that’s um no that’s terrifying let’s attack the creeper as well oh it’s gonna blow up all right so that’s uh that was an interesting I I didn’t expect that one but that was very funny indeed now so as you can see at least the chomper Definitely does work and well I mean the two animations Work It is in-game Well it it works it has sounds all of that craziness and well next time we’re then going to also add the attack animation when it attacks an entity right so because now it’s just like walking Towards it and you know something happens and then there’s going to be another basically attack there as well so very interesting indeed and yeah that’s how easy it can be to add a custom entity Minecraft all right that’s gonna be it for this tutorial right here hope you found this useful and you Learned something new and I’ll see you all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19.2 Forge Modding Tutorial | GECKOLIB ENTITY | #28’, was uploaded by Modding by Kaupenjoe on 2022-09-13 13:59:47. It has garnered 19513 views and 206 likes. The duration of the video is 00:20:42 or 1242 seconds.
In this Minecraft Modding Tutorial, we are adding a custom Hostile Geckolib Entity with Forge in Minecraft 1.19.2
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/tree/28-hostileGeckolibEntity Gist: https://url.kaupenjoe.net/yt422/gist Assets: https://url.kaupenjoe.net/yt421/assets
== TIMESTAMPS == N/A
== 25% OFF FOR GAMING SERVERS == ▶️ https://www.bisecthosting.com/Kaupenjoe
== 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