Hey welcome to Namak of monster day and teach you how to add custom AI into the game so today I’m not really gonna be showing you like what like how to do me like all the code I’m going to be showing you codes that I’ve made because I add a custom AI to my mob so let’s pull it down and you see that it actually teleports I thought made it make it sound but you can see that if I go near it or teleport it’s cool and I was showing you the AI I made for this to happen So it’s aspect out of this okay so this is my entity class and you know I’ve added the AI z space and mines entity a i teleport from player and basically it’s this class here now you can check out the github for all this code here I’ll just explain let’s go along so this is the world this is just a player’s class and it’s just making sure the class extends entity this is the ghost and you just need a sorter for this should execute that’s just tech checks River is a player in a five by five by Five area so basic constructor it just set certain stuff into certain stuff yeah basic basic stuff now and as you can see it extends entity a I base now it just has all the base entity AI stuff just you got do these and basically you’ve got this should execute so this is the First one I added so I’m just getting a list of all the entities in a 555 radius so yeah that’s what the players and just gonna sort these as you can check if it’s empty the newest and the player nearby so returned false if there is and it isn’t empty so Your return true so should execute so continue execute in just sets and the gets yet attack target if there is no attack target it returns nothing if the entity isn’t live it returns nothing you just it says it shouldn’t do it and it’s just basic checks start executing just Start executing reset in just reset stuff update tasks this is basically the actual main AI but here this just checks if it can if it should execute and basically I’m just getting position that it’s going to teleport to and just setting the position and updating it to the server because position is handled On the server so you have to have the and update method or wise it will crash your game and this is using a get teleport location method which is basically this method down here so all this method does is return a block pause so it this is just a bool in here so This is whoever it should be adding stuff to the location of the ghosts like making it teleport in a positive x Direction positive Y positive Zed and now this just generates a random number so this is this R and here so that’s just random number between 0 and 30 and Just gets the next double this isn’t different one because I don’t want it to go 30 high and I just set the pause X for why not and then I just changed these depending on if it’s positive or not and then I make a pause I block pass and a Check that where the block is that is going to teleport to I’m just checking if it’s air and then I’m checking if the block underneath it is not air so it there is a block underneath it and if that is true just return the position of the new location which will then Teleport it to but if none of these are true you’ll just ruin s which will just return the location because you just put in the ghost location here and just returns it so it doesn’t move at all so that’s that’s my a I if you want to look At any AI it’s in a forged source net entity AI and all its here now some stuff that I looked into was monster and entity Enderman because entity Enderman has some AI in it so here so listen to find player I didn’t use this one but it’s the same as any entity Campus block could ask for placing blocks take block I use one of these to teleport one there’s it like a teleport one so yeah this is got its own AI yeah so yeah it’s not it’s not too difficult to make hey I just got know what you Want it to do and recommend using a lot of Internet to get stuff but also source code because source code has got a lot of stuff that’s how I made this it took me about an hour to make this because I just had to look up the different stuff And yes so thank you guys for watching don’t forget to Like comment and subscribe I am out don’t get to watch any of my previous videos or last tutorial so yeah go check them out Video Information
This video, titled ‘Minecraft Modding Tutorial | Custom AI (1.8.9)’, was uploaded by CJMinecraft on 2016-05-05 16:30:00. It has garnered 2012 views and 34 likes. The duration of the video is 00:07:03 or 423 seconds.
Watch todays modding tutorial to discover how to add a custom AI to our entity.
Don’t forget to like, comment and subscribe!
Links: ►GitHub – https://goo.gl/YkQYpu ►My Website – http://cjminecraft.theclever.me/ ►Modding Tutorial List – http://cjminecraft.theclever.me/modding-tutorials.html ►Modding Tutorial Playlist – https://goo.gl/ZnZWTd ►Facebook – https://www.facebook.com/CJMinecraft01/ ►Google Plus – https://goo.gl/3n1umj
For modding help or if you want to contact me, email me at [email protected]
My Schedule: Monday or Thursday: ►Modding Tutorial Wednesday: ►Qbeh-1