Hello everyone welcome back to the Minecraft client tutorial coding series and let’s continue navigate to the Minecraft files and because we are coding our custom client we’ll have to make custom package names so I believe you are known with the Google or generally the Java naming conventions Etc so so you can Make your own packages if you have the net domain can go under net but for our for my pointless domain we are store. script Kitty and this client will be operating under that Alias all right um today we’ll be coding the main class and we’ll be hooking the initialized method the shutdown Method and we’ll be hooking and creating some events today without further Ado let’s get into it all right let’s start with the main class for us it’s going to be um because it’s best clan we’re going to just call it best I guess and we’ll make it an enum you can Call whatever you want if you use get whatever make it final oh never mind don’t make a final stupid of me best and instance I hope you know how enims work instance there we go instance and without further Ado let’s continue um first off we’ll make a Minecraft object which we’ll be be using fraud or whole client to access the Minecraft class so public static final Minecraft MC equals to minecraft. get Minecraft all right the next thing is also very important is the event boss which we’ll be using throughout the event system is called Alpine it’s made By zero memes and you can search it up up on GitHub all right so to do that we have to do it’s public well I prefer public static final public static for the in for the best class directly instead of having to call for the instance um event bus interface call it Bus and then do equals to event manager do my bad Builder and this is the event bu builder for this event system so first off you going to set a name should be a descriptive name for your event bus I guess we’re just going to call it rout for forward my bad forward Slash best then dot set super listeners just read for the event system if you’re interested what this does and that’s build to build the event bus all right and now we’re going to do some customizing so we want to make some variables which will be using throughout The client for example the name the version the command prefixes authors Etc but let’s get started so we’ll make it private oh yeah uh we’ll be making using gathers well that’s how I do it I don’t make it public use encapsulation so we use lbox so just do like a a global GA so private string name name equals to best comma why is this not formatting go uh comma version equals to b001 you can do like maybe V1 or Alpha we’re just going to leave it I guess at b001 and then we’re going to do command prefix this is for the future command Manager r we’ll be making um hashtag we’ll be using hashtag I don’t know like it then we’ll be using I will be making another prefix the client prefix it’s going to be pretty simple for now going to make so fast and this is like when you want to display Chat messages to know like it’s displayed by the client not by supp player something else and for good measures you can add an author’s string for me for us it’s Point oops points and death of death that’s me woohoo there we go these are the one the Strings we’ll be using if I didn’t forget any and now we’ll be making the init method and the shutdown method so first off the init method final board in it so this method is going to be called at the startup of Minecraft this will initialize all our managers resources Etc this is like where your client starts executing and in the opposite manner is the shutdown method which handles the closing of the client so there will be like saving the configs for example um handling how to close the client which system message should be ex should Displayed Etc so this is like the thing that runs when your client is shut down all right um to H these methods we have to go into the Minecraft class if you haven’t watched a previous video to get this pop up press shift consecutively two times and you Can like search classes so to hook the inet method we will be having to go into start game to the start game method you can just like control click here and then just just scroll down to the bottom of the method there looked it and look at here Above this render global. make entity outline sh so what we’ll be doing is best do instance. init and for good practices we’ll be putting here edited client hook cuz we’re hook and some you may see some people like start and then they’re likeing or something for example for me it would be Best like start best and stop best so you can see the changes but we’ll be just be doing edit to client so my comments always start with edited and it’s like where I search where I’ve hooked stuff in the original Minecraft code you can do how you prefer it this Is just my preferred way okay let’s continue the shutdown method will be hooked in the shutdown Minecraft applet preferably well how I do it is under the logger do info and this try cat so what we can do is again edited client hook if you want To make it more descriptive you may do that and God a lot of toos right now s. instance. shutdown all right we’ve got the variables done the event bus the Minecraft object instance that’s going to be it for the main class for now we will be expanding this and Let’s continue with the event all right the first thing you want to do is make a new package and I like calling it event you can call it event or event whatever you may wish to call it I just like keep it in simple comiment and the first thing We’re going to create is something very simple and enim it’s going to be called event flow my bad event flow we’re going to have two instances of the enim first off is inbound and outbound so this is to determine up uh if like for example when packets Flow if they’re inbound or if they’re coming from the server to the client or if they’re outbound if they’re coming from the client to the server so this is um s2c so server to client and this is client to server then we’ll make a new class we’re Going to call it event this is our public uh abstract final class public abstract class yeah so we’re making an abstract why because we don’t want instances of the event class itself we just want um classes that inherit well which will extend this class so which inherit attributes and Methods from it so we never want an event or class in stship then add Getters and setter by using Lok all right publ class event and we’ll be extending at the cancelable event this is from Alpine from the event system we’re using this just gives Some uh it’s gets like your it gives it cancelable so you’re can make a cancelable so we don’t have to write out so you see have cancel it can cancel so set cancel is cancel check and then we’ll be doing some extra stuff adding to our own event class so first Off is the event phase so event phase event phase this is to like if you want to customize in which state the event is currently in so you can have one event but it has like multiple States so Alpine gives free states pre on and post then the class we made earlier is Public event flow event flow and actually we can just make this private if we’re already using cap encapsulation we’re going to make it pretty these two then we’re going to do a bunch of if checks so public Boolean is pre then we do if event phase equals Equals to null then return false so this is just so we don’t get a all pointer exception or any unforeseen Behavior if it is no so if we have that check then we do return event phase equals equals to event oh my bad event phase equals equals event and event phase do pre Perfect and now we can just copy paste this and do the same thing with on on and with this one is post there we go here oh let me see if I didn’t miss anything nope and the same thing we’ll just do like with the event flow So if you event flow you see know is inbounds and and flow in in oh my bad vent flow. inbound we can just copy this and paste it is out there we go okay this should be the event class so together sets abstract cancelable blah blah blah yeah so this is Everything it’s just a bunch of utility methods we created and let’s get to creating events all right so we will make a new package we’re going to call it impl this stands for implementation so we have everything sorted nicely and then make a new event or new class bad and call it event Up update there we go and make it extends event there we go um yeah for event update this is going to be for for later on on um yeah no just leave it like that my bad so have an event update then the next event we’re going to make Is my bad you can press here and C all tabs is event key this is an event that will listen for key presses and why I didn’t like for more experient people well no bad so we will be sorting our events by categories cuz I like everything sorted my sorting freak I Like my code clean so we’re going to have categor so we have like a update category we will be having an input category and an hacking category these three categories we will start out we will of course expand later to other ones but this is what we’re Starting with so event key goes into input because it’s user input then up go when update goes into update and there’s going to be a last event which will be event second all right so for update you can just leave it like that all right let’s go to event Key excuse myself extend event there we go and now we’re just going to do at gather at all our Constructor since we don’t do not want to really manipulate the keys we’re going to make a private Final End Key um key strokes are handled via key codes which are integers and we We we’ll just be listenting for them by passing them down through the event by plan for this event yeah okay let’s go to packet this will be the last event for today so at G and Setter while here a set too is because we will be manipulating packets to handle Some special stuff I guess if you want to call it that it’s just to make um killer for example or some other stuff if you want to for example have a disabler you need to cancel packets or modify them somehow so that’s why I have a gther seter and of course an Alla Constructor what lombok does just readed up if people didn’t know so if you don’t know what Lok is it’s inde dependency which replaces Getters Setters and Constructors it’s written like this if you don’t know what it is just Google it right and we’ll have a private packet Wild Card generic and packet There we go and this will be the last event for today now of course we’ll be having two hook do so I guess we’ll be starting with event key so go into the Minecraft Main class again and then search k equals equals to one right and then we’ll be Having um my bad we’ll be having to hook it above here so okay equal equals to one hook it on in the first after parenthesis of the L statement so what we’ll be doing is I’m thinking can we just directly post it yeah I guess sure so what we’ll be doing is best DOT bus. host new event key I maybe you’re wondering by now what the is an event system basically how we’ll be handling modules and cheats is we’ll have certain events that happen when a certain line of well when a certain thing is executed so we basically hook to certain area of the Game’s code where something happens and we want to modify something in there or just listen for it for example we want to know what key the player pressed so what we can do is then when the key presses when the player presses a key that it then Turns on a module so that’s why we listen for it I will explain in a later video how the event system works in detail and we’ll get an example but for now just think as this magic thing where you can pass an event and it spits it Out on the other end where you can modify the values that you pass in and here we just want to pass in K which is a key and for good measures just going to do edited oops on edited cant event there we go you can do it like With start stop or whatever I just like it like this so the next thing we will will be hooking is an entity in the on update method as the name suggests we this is where we’ll be hooking the update on update method so what we’ll be doing Is bus uh my best. bus. poost new event update there we go and for good measures just paste and edit the client event all right my bad for the last event this is going to get a bit more fancy is event packet so remember how we made This event flow enum this is where it comes in handy as already is playing with the server client relationship ship is first off we go into net manager network manager into Channel R zero this method and we’re going into the try catch and we’ll be making a final EV Event packet event equals to new event packet oh yeah I already renamed this to Handler context and pack it so for you it’s going to be like some gibberish so what you do is just press shift and F6 and rename it to hand Handler context adequately rename this to packet or P Whatever you wish for what is comfortable for you I just rename a packet like it like that and we’ll be passing on the packet I’ll be setting the event flow to set ah look I forgot to extend it so extend event oopsie event and event do set event flow event flow do Inout this is where the packets are right From the server yep and then we will cancel it well if if it’s cancelled we will cancel it so if uh event. is canell event. cancel so for example we all know disablers well not all but I hope you know it and for example when you when Someone says like disable a packet or cancel a packet this is what they mean is the packet is not processed so this is the process method of the packet interface um the packet is not processed and not really registered by the client in that sense okay and we’ve done that and the Last thing is we will have to be hooking in net Handler L clim there we go it’s in add to send Q this is the method name so just SE up add to add to send Q control click it I also rename the tier to pack it please do that or Rename it to whatever is comfortable for you then we’ll be making the same thing as here so we can just copy that actually whoops close that there we go and we’ll be setting it to now it’s bound UNP it yeah there we go this should be fine so what this does Is it this is the method which adds a packet to the send Q and this is just like the Q well if you know Java and Q interface you know how that works it’s just like adds a packet to the queue and these packets will get will be Like sent to the server in the order so first in first out Etc yeah just just learn Java please we’re not making a Java tutorial here yeah and that’s the last hook for today and pointless is going to be doing the rest I guess hello everyone this is me Bess Let’s get uh right on to the tutorial so first things first let’s open up best let’s open up the main client class what we want to do in here is we want to do bus. um um it is uh I think it’s subscribe right yeah yeah yeah definitely subscribe this and then Bus do unsubscribe this so we’ll go here and uh let’s do display. settitle um uh let’s go name plus let’s put an arrow and then Plus um version and so this is going to set the title of uh once we launch Minecraft the top of the title is going to be that so Let’s go ahead actually and we’re going to make a new package let’s name this module and uh here you go so you can see in the uh the title of Minecraft it’s best arrow build 001 so there we go now uh in module let’s go ahead and Make a new Java class we’re going to name this or we’re going to put this as an enum and we’re going to make it a category make sure to put this as an enum please okay Enter so now we want to go ahead with categories so I’m going to go ahead with Combat um let’s see uh combat motion player Visual and miscellaneous yes there you go that’s good so um now let’s go ahead and we’re going to new uh Java class interface uh module info and uh we’re going to go up here and we’re going to touch some stuff so Target um I think it’s element type um type um at retention uh reten engine policy runtime pretty sure yep and uh we need to put an at here to prevent that from erroring so now we can type in string name so this is going to be the name of the module String uh description so this is going to be the tool tip so basically the description of the module and then the default is going to be no string that way it doesn’t error um and I forgot to do this and then category um is category okay there we go So that’s module info let’s go ahead and make the actual module class so new um module and um we’re going to start it with a getter so everything that we type in here is actually get um so that we we don’t have to manually make Getters and Setters but there you go so Goen toggles um private final string name uh description um private final category category and so this is going to error for a bit because we still need to initialize it so at Setter um private oh private in key this is going to be the Key bind for our module so then uh we want protected final Minecraft MC equals best. instance. getm SE and then now we can initialize the things over here so module um module info info equals get class uh. getet annotation module info. class and then we want to validate so validate do Not null um info and then this time type in um confused anotation exception that’s good um now let’s go this.name equals info. name um this. description equals info. description and then this do uh category equals info. category cool so now let’s go ahead and type some more stuff so public void on Enable um in here we want best do oops bro bestbus do subscribe this um it’s Error okay I’ll fix that give me a sec on disable on bestbus do unsubscribe this and so um to fix this we need to implement um subscriber there we go much better so um Now we need a toggle so we’re going to do um public void on toggle just uh just so we know when a module is toggled and then we’re going to do um public void toggle and um this is for say um this is for like notifications and stuff If you want to ever have those so um on toggle if toggled so if the module is currently on then we turn it off and we call on disable otherwise if the module is currently off then we turn it on and we call on enable and then we’re going to do do the Same thing but we’re going to make a set uh set toggled um just in case you want to set it directly um I’ve had to use this before so um do do that and then so on toggle um yeah sure if toggled then this. toggled equals um we’re going to do false Because if it’s true then we turn it off and then we go on disable so then we do else and then this. toggled equals true and then we call on enable there you go so there’s the U module class done so now we need to make a module manager to Handle all of the modules in a client I that up royally okay let’s change that okay there you go so let’s start off with getter um and uh let’s make sure this is final so uh let’s let’s go ahead um private final hashmap this is going to be a pretty Complicated um module manager uh we are going to be using hashmap as it’s more efficient um and and more performance than say a list or an array list so we’re going to be using just hashmap and then this is going to be um modules um now let’s go ahead uh public module Manager um this. module uh modules equals new hashmap all right um so now we need to return the list so public um final module bro module on get module then this is going to be um class question mark extends module um we’re going to name this mod and then Return um modules. getet um mod there we go and now we are going to uh register the the mods the uh modules so we’re going to do that automatically uh just to make life easier on us so void a register just like that um so now we want a final Reflections Reflections Um I’m just going to name it rfl short for Reflections and then equals New Reflections um and then this what we want here is we want a prefix that points to where the uh implementation is going to be so in this case I’ll go here impl impementation and then you want it To point to this folder implementation so store. script kitty. event or module do implementation so store. script Kitty so right now we are in this folder so module now we’re in this folder and then implementation now we’re in this folder this is what we want so just make sure to translate that Over to uh to your workspace SP environment so going to go ahead and do a final set um classing extends um module and then uh we need to go ahead and import this and then let’s go ahead and do um classes yeah Reflections do get subtypes of and then mod. class And then four um class extends module um class or oh class classes uh classes and then we want this um we need a try and a catch so that it doesn’t error so final module um equals a class. new instance there we go this is going to Error because we need to put in a catch which we are going to do so modules. put oops. put a class and then feat there you go and actually for uh funny I’m going to put that as Fe all right cool so now we need a catch so we’re going to catch instant Exception and a legal access exception and we are going to ignore those Okay cool so there it is there’s the automatic registration and now we’re going to have an unregistration but we’re going to make this one a manual one so unregister and then module module and then four module mod um Module and then modules do um remove mod. get class there you go so there you go so now we have a module manager and up here in the module manager we need to type in register to register all the modules and now we’re going to go into Best and we need to initialize the module manager so let’s let’s go ahead and do um private module manager mm and then in here underneath the um yeah sure actually we’ll do it after set title why not uh let’s go here mm equals um new module Manager and then uh now we need a listener for event key so and do subscribe um um private final listener um event key oops what did I do okay there we go Alpine and then um listener equals new listener um e and then we’ll do that okay um if this Mm is not not equal n cuz we want to check if the module manager is not n we don’t want a n pointer exception then we need to get modules then we need to get values and then we need to do for each um we’ll go M and then and then there we go so if M do get key and M is module by the way m is module so um so gety key equals event. getet key then we are going to toggle the module there you go um and so now that we have the on key Essentially now we are free to make a um a module so we’re going to go ahead and go into package we’re going to make a motion package and inside of motion package we’re going to make a Sprint um a Sprint module so we’re going to start up here we’re going to do module Info and we’re uh we’re going to do um name equals um Sprint uh oops description equals um you’re gay deal with it all right cool this needs to be a Comm cool um and then so we want this to extend module make sure you uh import the right Modules then we’re going to um or import the right modules sorry and then we’re going to uh make new public Sprint or yeah public Sprint and then uh we’re going to set the key so this is going to be the keybind so keyboard and then you can choose any key here personally I’m Going to bind it to B okay there we go so now we’re going to do at override um public click void on enable there you go and then Super do on enable um and let me uh let me check if I can override methods um yep on disable right here cool and so Now we have on enable on disable and uh now we’re going to add a listener so we’re going to add event update so subscribe private final um listener event update list listener or you can just make this you know on update if you wanted to equals new listener e for the Event and then this is going to be mc. uh the player dot um set sprinting um true there we go so now we are free to run the client and so now when we hit B our character should Sprint indefinitely um and and and we’ll see That this is our our first module so let’s go ahead and and check and see if it works uh please work there you go you can see our character is now sprinting indefinitely even when we go backwards it’s not really sprinting but there are Sprint particles So uh I’ll take it but uh we’re not going to end on this we want to improve Sprint so let’s go ahead and show you how to do that so we need to apply basic logic here okay in Minecraft you can’t Sprint when you’re against a wall obviously because You’re not going anywhere so we’re going to add an an if statement so if mc. the player dot is collided horizontally return because we don’t want um we don’t want to continue on if we are collided horizontally moreover we don’t want to continue sprinting if we aren’t moving so mc. the player. move Forward less than or equal to zero so if we’re going backwards or um if we’re not moving then we’re going to return so now what we want is uh we want to do a check to say if we’re using an item so mc. the player. is using item um we’re going to Return and then we’re going to do if mc. theep player. is sneaking because we don’t want to be sprinting while we’re sneaking as well so we’re going to add all of those and so now you should see that it is improved there we go we have now improved Sprint there we Go so now the world world is looking a little bit dark so let’s go ahead and fix that by adding a full bright so we’re going to go here going to make a new package now when you make a new package want to make sure to remove this Because this is the old motion so we want to create a new package or we’re going to name this say visual or whatever you set your category as so we’re going to do new Java class full bright you can title this however you want going to do a module info name equals for Bright um there we go uh comma and then description is going to be right equals full sure just trying to be witty witty witty okay there you go category um visual all right cool so now we’re going to extend module and we are going to to add two Methods we’re going to add um on enable and on disable so let’s go ahead and add those and um there we go it extends module and now we need to add a keybind so public um a full bright there we go and then we’re going to do set Key um keyboard. key um M sure so there we go now we need to read add um on update so subscribe um private final listener event update oops okay then update bro okay I’m I’m done trying to use Alt Enter because it’s not working all right Event update um on update sorry I lost track of where I was new listener eay oops going to add that there that there and then um now what we’re going to do is we’re going to make a new uh value over here we’re just going to do Private um old gamma um or we need int old Gamma or I think it’s float actually that’s we’ll see uh float old gamma equals um we’re just going to not initialize it for now so then uh on enable we are going to do um old gamma Equals MC do the player dot uh or actually game settings do gamma setting there we go and then we are going to do we’re going to do the reverse on disable so mc. game settings. gamma setting equals old gamma but on update we’re going to do um mc. game settings. gamma setting equals Uh three you really don’t need more than three um because it’s not going to really affect much some people have it at 10 or 100 or whatever but in the future we will make it so that you can adjust how much full bright you want um Which is a staple of many clients for some reason okay so there we go going to turn on Sprint module there we go it’s working and then going to turn on full bright there we go so now we have full brightness we can look in caves we can Toggle it on and off uh sorry for the seizure but there you go thank you for watching you made our first two modules and I’ll see you guys in the next video bye-bye Video Information
This video, titled ‘How to code a Minecraft 1.8.9 Hacked Client Pt 2’, was uploaded by ExecutableContent on 2023-12-19 21:33:07. It has garnered 1120 views and 51 likes. The duration of the video is 00:46:53 or 2813 seconds.
Thanks for watching!