Hey what’s going on guys 30 worthy and welcome back to another minecraft modding story or video and in this video we are going to be going over events and let’s get started so first I suppose a letter explaining what an event actually is so an event is something where you Will do something inside the game and it will cause it will trigger an event to happen so something will happen depending on what you do inside of the game so it’s better to just show you rather than explain and yeah so you once you create an event package inside of Your main package so not events events inside of here you want to do a class called event handler in fact no but you want to have the event handler in in our main class so we’ll have event example so we are not going to be going over how To create a specific event in this video instead we are just going to make it a bit simpler and go over the basics of an event and what you can do with one we all have separate videos on how to do certain things with events and but Currently we are not going to the next video is going to be loop tables and that involves an event we also have one on overriding overriding loot tables overriding crafting recipes and adding your custom seeds to grass so let’s go ahead and do so inside of your class you Want to have a public void register I’ve no not register public void and then this is the name of your event so this can be cool whatever you want so mine is simply just going to be called example event and inside the parameters you want you so the parameters of an Event can only have one parameter so there’s only allowed to be one parameter in an event and basically this climate has to be the actual event that you want to use so for example if you type in event and control space that should be I know it’s not coming up So let’s look at player event for example player event event and if you import player event from yeah that one you can then go to this class and you’ll see loads of different events right here so this is quite useful so then you have this this argument or kind of called Event with this you can do event dot and then you have for example get entity so if you wanted to have NC entity is equal events docket entity and then you can whenever you want you can just call NC dot and you can do so many different things Another thing is if we look at event dogs and there’s a few things so get entity player so you can then have player player is equal event get player in fact it should be entity player my bad we can have event dots it an event dot results dot World event there should be a world thingy if we I think we can do NC don’t get world and is he does get world get entity well so yeah you can have a world world you will entity dark world and but I think a better example would just be To use harvest drops event because that allows you to answer this much more thing so all the all the things inside that of an event are usually different so you know and here we can do world world is equal to event get world we can Do what else is there event dot you can do get harvester so then you can have entity player player is equal a vent don’t get harvester you can have a vent docket pause so you can have block pause pause you cool event get pause you can then get a state From that pause so you can do world don’t get a block state of pause because you can then have that as my block state state equal world ending it okay it’s always best you create these variables so you don’t have to have individual ones of these all the time it’s much Better and you can then do block block is equal states get block you can do for example item item is equal block or no is equal I turn get item from block of block so you can do all these different things you can do let’s see what else Can you do now you can actually get the state straight away so you can do I block state state is equal to event yet state that’s much simpler you can have a fortune level so int or tune level and this is all just saving you time obviously this is an example of one Event all events as I say will have different things so is silk touching so that would be for example boolean is silk cha-ching you can have boolean is can’t have all is equal to event dot is cancelable now you can also have boolean is canceled is equal to event is Canceled as I said there are many many things but I want over most of them hopefully that will make it easier for you you can do the event priority so event don’t get faith and then you can have an event alrighty you can have so all of these things are Going to be very useful to you get drop chance so you can have float get drop chance or just drop chance actually you can have if you have item stack array items it is equal to event don’t get drops that it would be better to just call this dropped weight oh yes of Course so the list and then you can do list of item stack Java dot util dot list you can have it anymore and then don’t get class so you can have like class class right or my just be no I’m being shoot you can’t do that has result So like boolean as result and so as I say all these different things and you can then obviously use these things to do for example F block is dot equals block in it dot no random block then you can do world dot set block states pause And you can then do block in it dot so a block get default state and you could do world dot for an entity and new entity the lightning bolts obviously you can then add the parameters once you’ve imported it to a world and what are these so if he doubles the let’s double Wide double Z so actually that’s a good one you can do state dots wait no you can’t you can do pause dot get X cars don’t get why cause don’t get Z this is actually very useful so I should do double X is equal to positive get X Double y is equal to post-up get Y double Z is equal to positive get Z and then you can just do X Y Z for the last one boolean effects only in just put true that’s just an example obviously there’s many more more things you can do But that’s down to you to work out those and they’re not difficult so yeah if you guys did enjoy this video actually we need to register it my bad let’s go ahead and do so in do to handlers we need to create a new class and call it Event handler and inside of our registry handler we need to call our event handler inside of pray in it yep per unit below register entity renderers so there’s no not registry handler own event and got register events just like that and then here you can do a public static void register events Inside of here we first need to declare the event so we need to make an instance of it so we can do a vent example example event is equal to new event example and then you need to do minecraft forge dot event bus dot register example event just like that And that should register if not you can actually go into your main class you can totally skip this event handler if you want and inside of pre in it just here you do the exact same thing so if that didn’t work you can copy this from in here go to your Main class and below this in pre in it you can do that and that will work but don’t have both otherwise your event will be registered twice and you don’t really want that because it’s not the greatest thing in the world so if you guys didn’t enjoy this tutorial please Do sure to smash face into that black button and subscribe really enjoyed please do be sure to share it and I’ll see you guys in the next tutorial which will be on Luke tables good bye Video Information
This video, titled ‘Minecraft Modding Tutorial 1.12.2 – Episode 25 – Events’, was uploaded by TurtyWurty on 2019-05-02 17:36:35. It has garnered 2674 views and 36 likes. The duration of the video is 00:16:26 or 986 seconds.
Hey guys, TurtyWurty here, in this tutorial we cover how to create your own event and the basic variables that you may need to access inside this event. If you have any issues, problems or need help join my discord server below as that is where I am most active! Hope you guys enjoy!
GitHub: https://github.com/DaRealTurtyWurty/Tutorial-Mod My Discord Server: https://discord.gg/d5cGhKQ My Own Mod: https://minecraft.curseforge.com/projects/minecraft-madness-mod