Let’s do it let’s create a custom block entity in minecraft oh right we found this back and tell everyone’s more and in this tutorial we’re going to be adding a custom block entity to minecraft now a block entity in theory is simply a block that sometimes you can right click sometimes You actually can’t but it is basically a block with additional functionality like for example any type of machine that you’ve seen in any other minecraft mod or for example a block entity in vanilla would be the furnace for example now as a complete preamble i have updated to Forge 119.2 over here 43.11 just as a quick reminder over here there should be no changes even if you’re on 119 or 119.1 i’m pretty sure everything should work but just to be sure this is the current version that i’m using so if there are any discrepancies That might be the reason why whatever the case may be block entities they are quite complicated and i’m saying this because well number one now is really the time where some you know foundational java knowledge is absolutely required we’re going to copy over a few methods over here i’m not Going to go into insane detail on all of them i’m trying i’m going to try to explain everything as best i can but we’re going to be creating a lot of classes we’re going to be creating a lot of methods and they’re going to be all interrelated with each other it’s going To be pretty freaking crazy but afterwards we’re going to have a really really awesome block entity all right let’s start at the very beginning by going to the block package and we’re going to make a new package in there called entity and this is where our block entities will live and that’s Going to be the first one that is the gem infusing station block entity quite a long name but that’s going to be totally fine now this will extends the block entity class as well as implements the menu provider interface let’s hover over this implement methods it’s going to get the Get display name as well as the create menu method and then we can hover over this again and make the constructor now first of all as always if the parameters annoy you can click on them press shift f6 and rename them i know that this is This should be the id i believe this is of course the inventory and then this is the player then also very important in the gem infusing station block entity constructor delete the first parameter this is going to be fine this error is totally okay and then we’re going to Change this to pause and this to state that’s perfect and that is actually what we need for the component here for the display name we’re just going to say component dot literal and i’m just going to call this the gem infusing station that’s going to be fine if you want to do this Proper you should probably do a translatable component in this my case but that’s gonna be fine and here for the menu i actually want to make a deliberate error just so that i don’t forget to add well the thing that i need to add in the future so a block entity Or at least in our example consists of four different parts the block entity the block itself the screen class as well as the menu class now this might sound like a lot and it actually is but we’ll see basically what each of those parts do and what we have to do for them Now first thing we’re going to do is we’re going to make a new item stack handler this is basically the inventory of our block entity it’s going to be a private final item stack handler and that’s going to be called item handler it’s equal to a new item stack handler In the parentheses we’re going to put the size of the inventory in this case we’re gonna have three different slots and then we’re actually making an anonymous class so we’re gonna put the early brackets in here and we’re going to overwrite the on contents change method and i’m just going to call the Setchanged method here so this basically just roughly speaking reloads this particular chunk and or block position if you know any type of changes here occur and we will actually also need this method in the future as well for some synchronization but we’ll see that when We get to it we actually also need a something interesting and that is a private lazy optional of type i item handler or the lazy item handler and that is equal to a lazy optional dot empty for the time being now we’re going to need this in order to make our inventory Available via capabilities for that what we can do is we can immediately override this and that is the get capability method now we wanted to override the one with the side and that should be okay what we can then do is we can just keep this return and We can say hey if cap so this is the this is the parameter here the capability that we’re passing in if this is equal to capability item handler dot item handler capability then we’re just going to return the lazy itemhandler.cast and that is basically going to allow it So that we can well import and export items out of this particular block entity also very important we also want to override the onload method as well as the invalidate caps method especially when we have some capabilities like this because then in the on low method what We want to do is we want to say the lazy item handler equals the lazyoptional.of in this case a supplier and then just passing in the item handler that we’ve made in the very beginning there you go and then in the invalidate caps we want to invalidate This as well nope we actually want to say lazy itemhandler.invalidate and that should be pretty much fine here as well now we’re going to continue with the reading and the writing method or the save and the load method so we’re going to say save additional that’s what we Want to overwrite as well as the load method and once again let’s just change this to calling this npt that’s going to be fine you know compound tag you could call it call attack nvt is totally okay and what we want to do is in here in the Safe additional method we want to save the inventory how do we do this will be say nbt.put and we’re going to call this the inventory and then we’re going to say itemhandler itemhandler.serializenvt and then we’ll save the entire inventory if we for example were to leave the World right if we were to save the world and you know come back like two days later and of course we want the inventory inside of this particular block entity to be saved so this is what we do to save it and then to load it we’re doing item handler.d serialize compoundmbt nbt.getcompound And then we’re just getting the inventory over here there go and that will be the saving and loading of the inventory done as well now we will actually go come back to this in just a moment but for the time being that’s gonna be fine and then lastly i’m gonna Actually copy over this method because that’s a little bit more out to type and we don’t really need that all of the code is of course as always available to you in the description below get our password in individual gist as well we can see we’re basically just making a Drops method that will sort of drops the contents of all of this particular block entity we’re going to call this in a moment inside of the block class when the block would be destroyed then of course we would want all of the inventory to spill out and you know Actually spawn in the world now i believe that is all that we can do at the moment the error is totally fine we’re going to fix that for the time being what we’re going to do is we’re going to now go into the block now i’ve already made the gem infusing station Block over here now if you don’t have this just create a new one basically and what you want is you wanted this to extend the base entity block now this will actually get us an error we need to implement the new block entity method that’s going to be fine we’re going to Deal with that in just a moment let me just make a comment over here just so that you basically know all all of the things below this comment are basically the block entity stuff the first thing that’s incredibly important is override the get render shape method over here and you want to return Render shape model this is extremely important if you don’t do this your block is going to be invisible so keep this in mind and there you go we also want to override the on remove method now i will actually copy this over because once again it’s just sort of one Of those boilerplate methods that looks pretty much the same every time and you can see we’re just calling the drops method that i’ve just alluded to before and that basically is going to drop all of the contents of the block entity inventory we also want to override the Use method once again this will be copied over overall this almost always looks the same right we’re just making sure that we’re on the server here we’re getting the block entity at this particular position we’re saying hey is this actually a german fusing station if It is then open the screen when we right click this then we want to open the screen that this particular block entity sort of belongs to and that is the general idea now the new block entity we can actually also use this we can say new gem infusing station block entity Now let’s change the parameter names here pause and this is going to be this state over here oh that’s not quite right this is pause there you go and this is state perfect and then just pass in pause and state and that should be fine as well and then we need one more Method in here and that is the get ticker method and what we want to do here is first and foremost also change all of the names over here because man are they kinda stupid and i believe that we actually do have um parchment already available but i’ve not yet been able to Um basically try it out so uh we’ll we’ll take a look at that maybe next tutorial as well and then we want to call the create ticker helper method over here passing in the type as the first parameter and then we actually need the mod block entity registered all Right let’s do this then so we’re going to go into our entity package right click new java class and this is the mod block entities class there you go and inside of here we just wanted to basically register our block entities now how do we register block entities Well of course with the good old friend of ours the public static deferred register final deferred register even this time of block entity type and then once again we need angle brackets question mark in this case this is going to be the block entities equal to of course a deferred register.create Forge registries dot block entity types very important and then of course tutorial mod mod id and i hear you scream already where there is a deferred register there also is a public static void register method with an i event bus called event bus and we’re gonna all Inside of it the block entities that register method passing in the event bus and so that we don’t forget about this let’s immediately call this mod no absolutely not this one though modblog entities dot register and then passing in the event bus there you go now we can actually register this so uh Once again this is going to be one of those things i’m going to copy over actually you know let’s just type this out why not public static file registry object right should be fairly self-explanatory this time of block entity type of type gem infusing station block entity so instead of here we need To specify your block entity class i’m just going to call this the block infusing station and that’s going to be fine in terms of name we’re going to say block entities dot register then the name just them infusing station then a supplier of the following block entity type Uh this one right here dot builder dot of and then a gem infusing block them infusing station block entity column call new comma modblocks.geminfusingstation.get and then after the second parentheses that build and then passing in a null and then no more errors should be present in theory once again you can of Course copy this over from the github repository or the gist as well both linked in the description below and in theory this should be fine in high level overview we’re basically just making sure hey this particular block here belongs to this particular block entity roughly speaking that’s What we’re doing and of course also registering the actual block entity now we can fix two errors that is number one in the block entity class right here when we call the super we can just say mod blocks block entities dot gem infusing station dot get that should Fix this error and then the same thing goes here we can say mod block entities dot gem fusing station dot get and that should be pretty much what we need here now the last thing we need to pass in here is the gem infusing station block entity colon colon tick now this method Of course currently doesn’t exist but what we can do is we can just create a tick method and it will immediately make it so that it has the correct signature so the correct method signature for us we need a level a block pause a state And an e here now this e we actually don’t need let’s get rid of the generic right here and we’re just going to say this is a drum infusing station block entity i’m going to call this entity i actually call this p entity i believe that that is a little bit better but Then we can use this a little bit nicer but that would pretty much be all that we need to do this error should go away and the block is now done that’s great and now we can basically proceed in the block entity itself now the tick method Is special in that it basically gets called every tick so every one twentieth of a second this method gets called and we can do all sorts of crazy things in here now the first thing i have found is that if you call the if if we’re on the Client side we just want to return this uh i am not i’m still not 100 sure whether or not this is like a thing that you should do have to do or shouldn’t do but i just have found that doing this makes a lot of sense in my mind so it Does it did work and then we had some issues with this when we actually did have this so i am unsure about whether or not we want to do this or not now the question is what do we want to do in this tick method well let’s just think about it like this If we have some sort of recipe present in this block entity we want to do something right okay that’s actually fair and what will this entail well this will entail quite a few things when you really think about it so let’s just start typing this out and then let’s Think about this so we want to have a recipe right so if this particular the entity has a recipe then we want to do something maybe we’re gonna you know add some progress now we’re thinking about hmm well we don’t really have a progress at the moment right yeah that is correct so Let’s just add you know two new integers over here that are basically denominating the progress of how far uh how far along the the crafting process in this particular entity we are let me just search for the constructor there this constructor is so let’s just add a private Int progress maybe zero and then a private end and that’s going to be the max progress so this is basically how long it’s going to take i’m just going to set this to 78 i’ve tried this around and you know this is just a number that I’ve been using for a while you can of course also change this and it’s going to take longer of course and then we also need this is extremely important a protected final container data of type or called data there you go and now this is going to get an error that’s Fine now the first question is why do we even need something like this well i’ve said that the block entity at least in our case is actually split into roughly speaking four parts we’re currently in the block entity and instead of here we have the ticking behavior so we’re Basically you know taking up the data and the progress and all that we’re then sending that progress or that data via a container data to our menu now the menu is actually responsible for synchronizing the server data to the client that means that we have to put this into a Container data that then gets automatically synchronized because the screen later our display our gui that is going to open right and then you know you already know this from the furnace for example you can see the how how long the coal is going to take and still burn or how far along the Smelting process in the furnace for example is that is all on the client right because that’s literally only you see this so that is why it needs to be synchronized and the way that it’s synchronized is in the actual constructor we want to say this data data equals a new container data this One right here and you can see we actually need to do this this is a an anonymous class once again and what we actually want to do i’m just going to copy this the actual contents of each of these methods over as well so you can see the get method Over here this is going to be called index in this case that’s fine and we basically want to just return the progress over here if index is zero and the max progressive index is one so we’re basically saving both of these two well into just here inside of the container data this is Going to be the first one is index and the second one is the value and then the count of course is how many there are in our case is one two so we have two different variables that we’re going to save in this container data and we will Need this in just a moment when we create the menu but for the time being this is going to be fine now inside of the block entity itself we can continue to work with our progress so what we can say is pnt.progress plus plus so we’re just Increasing the progress and we also want to call set change passing in the level the position as well as the state there you go so that basically things get reloaded if they need to every time we add a progress just in case and then we also Want to say po actually we want to say pnt dot progress so we want to say the you know get the progress if this is bigger or equal to the frog max progress actually then we want to craft the item right so we’re going to say craft item And once again passing in the entity over here and that’s going to be fine now maybe we want to do something else when it doesn’t have a recipe so maybe what we actually want to do is we want to reset the progress could be the case Right so let’s just say p entity that reset progress so once again all of those different methods are actually things that are not yet implemented but we were going to implement them in just a moment and this is going to be going to be a level a position and a state Over here and that should pretty much be what we want so hopefully this roughly makes sense in the way that we want to add this and let’s then create all of those methods so the has recipe method the craft item method and the reset progress method there is no rhyme or Reason to why i’m you having some of them in static and some of them are non-static some people have said that why not make all of this non-static i personally don’t think that it matters that much if there really is that big of a deal then you can always of course change This as well so resetting the progress should just be this dot progress equals zero right that’s just resetting the progress should be nothing too crazy going on here now the question is what does it mean to have a recipe that’s a great question so the first thing i Actually want to do is i want to copy over something that is just going to make our lives a little bit easier and that is exactly this let’s just call this entity then that’s fair and let’s think about this so the recipe here we’re just making a simple container Basically it’s sort of a an inventory that we have you know that is going to be a little bit easier to deal with later and then we want to make sure that we have certain things correct so for example what i wanted to do is i want to have a A raw gem in the in the slot with index one and when we have this i basically want to well basically want to then be able to say hey now i have a recipe and there’s a few other things that i also wanted to do so let’s say For example we have a boolean and that is the has raw gem in first slot right something like this and then we actually want to equal this to the entity dot item stack item handler actually item handler dot get stack in slot one right if that item actually know if get item If that item is equal to let’s say mod items.rawzircon.get then right this is now the boolean we can actually return ah sure if this is the case then we have a recipe now this of course is not quite enough in this case because we also want a few other things To happen and that is number one we want to make sure that we can actually insert the particular amount into the output slot as well as insert the particular item into the output slot we want to say for example can insert a mount into output slot and then passing in the inventory in This case and then we also want to make sure that we can can insert item into output slot into output plot passing in the inventory as well as the item that we’re actually going to create now in this case we’re just going to make a new Item stack over here no a new item stack another item stack handler of type mod items dot let’s go with xerocon of course dot get and we’re just getting one over here let’s just import this and then with the two methods here we of course need to once again create so Let’s just create this method and this method as well so just two boolean methods nothing too crazy now let’s think about this and insert into output slot basically just is going to check whether or not the we have enough space in there right so we’re just going to say if the inventory Dot get item to get max stack size is bigger than inventory dot get item uh get get item two get count so this basically will allow us to well only insert to 64 and not higher otherwise of course we would get into a little bit of a trouble right Because that would actually it would actually literally just do it it would just go up and up to 65 and so on and so forth which of course is not something we want and we can insert into item slot we’re basically checking whether or not first of all the item inside of the Inventory right is the same as the stack over here so stack dot get item right if there is the same or if the item in the inventory is actually empty because if it’s empty then of course we can insert any item basically that is the general Idea in this case and that should be pretty much what we need to do in the has recipe method for the time being now we can actually change this in the next tutorial as well where we’re actually going to implement a proper recipe like an actual json file recipe that we’re Gonna read in with a custom gesture custom recipe serializer and stuff like that can be very interesting indeed that’s gonna be interesting now the question is what happens in the craft item class well here we’re crafting the items so what we can basically ask again Is well do we have a recipe or just in case right and if we have a recipe now we want to actually change stuff so we want to say for example we want to get the entity over here right so p entity dot item handler and we want to extract The item from slot 1. we want to extract one of those and we don’t want to simulate it we actually want this to happen so we’re basically extracting one of our raw zero cons and we then want to set the slot in like the actual item in The second slot so this is going to be our output which we’re now setting and that’s going to be the itemhandler.setstack in slot it’s going to be slot 2 of course right so this is our output slot we’re going to make a new item stack and this is going to be of mod Items.xercon.get and we’re going to make this so that this is p entity.itemhandler.getstack in slot so we’re going to get the already existing stack in the slot we’re going to get the count actually get count and we’re going gonna increase it by one so this is of course now completely uh basically hard-coded in This case right so both the item stack like what is going to be like put into this is hard-coded as well as how many of them we’re getting both of those are hard-coded and that’s totally fine for the time being but we’re going to change this as i said in the next tutorial Basically immediately and that is pretty much all that we need in the craft item method and that should be the logic pretty much done so this is the logic the logic should now work however of course we can’t even look at it right now we don’t have a Screen we don’t have a menu and we still have this one right here which of course is the menu like that is the issue so let’s move on to creating the menu now for that we’re going to make a new package in the tutorial mod package Right click screen over here and here we need a three different three different classes the first one is going to be the gem infusing station screen the second one is going to be the gem infusing station menu and last but not least we also need the mod menu Types class as well let’s start with the menu because that’s going to be the craziest probably so this is going to extend the abstract container menu this one right here let’s hover over this and implement the methods the quick move stack method as well as the is valid Method or still valid method let’s also create a constructor matching super and then we’re going to well start to actually copy over some stuff so the first thing is going to be the field this is going to be the block entity field that’s totally fine we’re also Going to need a level field as well as a data container field this is of course the data container that i’ve explained previously that basically synchronizes the data because inside of this menu is where the synchronization takes place so we actually want another um and a different constructor we actually want Two of those but let’s just do one first so that’s gonna be the infusing station menu the first one we need is an id then we want a an inventory inventory called inv then we want a friendly byte a buff called extra data in this case And then i’m going to basically make a second constructor that’s going to be the public gem infusing station menu and that is going to take also in an integer id also going to take in an inventory inf is also going to take in now a block Entity not a block entity type a block entity important difference here a block entity called entity and it’s also going to take in container data called data now we’re actually going to call the second constructor with the first so we’re going to say this and then passing In the id we’re going to pass in inf we’re going to pass in inf dot player dot level dot get block entity extra data dot read block position or read block pause comma and then we’re going to make a new simple the container data with two different well parts of this data now This might look absolutely insane what is going on well first of all this right here the two right here very important that this matches the amount of data that we’re having right here right so this is two and this then has to be two as well so that’s very important and the Rest should be pretty much fine so here we want to call the super now the first parameter is actually going to be the registered menu but we don’t have that yet so we just want to then pass in the id here we then want to check the Container size just in case right so check container size we’re going to get the inventory and that should be three once again this is of course the size that we’re giving right here to the item stack handler right this is three so we have three different slots or the or we Can hold three different item stacks we’re going to set the block entity equal to the entity that we’re passing in here and it’s going to throw an arrow we can just hover over this and cast it to our german fusing station block entity we know that this is should Always be the case and then we can say this level equals inf dot player dot level we can say this.data is equal to data and then we can proceed to adding a few methods let’s first of all let’s actually start at the bottom of this craziness so we’re gonna add two helper Methods i’m just gonna copy them over overall you can go through them in your own time they pretty much just add slots for the inventory as well as the hot bar for the player they should always be in the same positions overall if you need to change the positions because for Example your inventory or your gui is basically bigger then you can always change them i highly recommend going through this in your own time figuring out this is not it should not be too crazy it’s just a bunch of math basically on how to place and where to Place the different slots so it shouldn’t be anything too insane here and we want to call this right here so we want to call the add player inventory first passing in the inventory and then add player hotbar and then passing in the inventory again that should be fine in this case and then Let’s actually once again go down here and continue with the craziness so the still valid method what it’s going to do is we’re actually going to call this still valid method the top one right there from the container level access and stuff like that we’re also going to Change the name over here to player and then we’re going to say this is the container container level access dot create i’m going to pass in the level we’re going to pass in block entity dot get block pause and then after the second parentheses we’re going to pass in the player and Then we’re going to pass in modblocks.geminfusingstation.get and there we go this can be quite complicated when you look at it it pretty much just means hey can we actually right click this particular block at this particular position and can we then open the container that’s pretty much all that we’re doing here And then we come to my absolute favorite method and that is the quick move stack method because this is something we’re going to pretty much just completely ignore and not even like not even care about in the slightest i’m just going to copy over number one a whole host of Different fields as well as the entire method and that is going to look quite like this so the only thing that is very important here is this one right here this is extremely important so please pay attention if you have different number of slots this is what you have to change This must be the number of slots that you have otherwise you’re when you shift right click or you shift click into this inventory then it’s going to crash this it always needs to be the same number as you have right here so keep that in mind And then you should be fine i guess we could go through this in half an hour or so but you know what we’re just going to thank the zmo7 here for making this available for us so that we can basically just use this not worry about it and just basically You know just make this small and never look at this again because the quick move stack method is just a whole bunch of math basically figuring out okay if i shift click in what basically what slot should this item end up in and it’s it’s all sorts of craziness so you can go Through this in your own time once again otherwise just copy it over and thank dzmo7 for making this available and then that’s it and that should be that method as well and we’re going to need two new other methods as well that’s going to be i mean more or less like custom methods That is the it’s crafting method as well as the get scaled progress method so these crafting method of course just checks if we’re having any type of progress because as soon as we have some sort of progress we know that a recipe is available in the block entity and Then we can start basically showing the well the arrow and the progress and that is what we are doing with the get scale progress basically it’s getting the arrow size and then just having it um basically displaying as much arrow in terms of percentages as we have done with progress So what else do we need we need the custom slots actually and that’s going to be done by doing this dot block entity dot get capability so now we’re actually checking for a capability and we’re going to check for the capability of item handler over here item handler Capability and if this is present then what we want to do is we want to say handler and then basically make a consumer over here and that is going to be the following this dot at slot and we can then make a new slot item handler passing in the handler Index is just going to count up from zero all the way to whatever you want and then we have a x position and a y position i’m going to show you where those positions come from in just a moment let’s just duplicate this once again the index just counts up and this Position is 86 and 15 and this position is 86 and 60. beautiful so those are our three custom slots where we can then later insert well our items basically into very interesting indeed so overall that’s pretty fine and then the last thing we need to do is we need To say add data slots and then pass in the data right here now this should be the entire menu class done so that is pretty good already so this might be a little bit crazy over here but overall we’re just basically saying hey does this particular block entity actually Have some sort of capability to handle items and if it does well fair enough then we can actually add our slots that we can then later use to well basically manipulate the items inside of the inventory the only thing we need to fix is this one but that’s no worries at all Let’s go to the mod menu types method or class rather and let’s just add a once again a public static final the third register of course of type menu type of type question mark absolutely and that’s going to be called menus this is equal to a deferred register.create Or registries dot menu types and this is tutorial mod let’s go tutorialmod.mod id there you go and absolutely of course public static void register method with an i eventbus with eventbus over here making it menus.register passing in the eventbus and there we go let’s immediately call this otherwise we might Forget it and that would be terrible mode menu types dot register passing in the event bus and that should be fine right there let’s go back here and let’s actually create this so for this what we actually need is a helper method i’m just going to copy this over this is all available To you of course as well in the description below we can see we’re just making a register menu type method over here and then just registering it with a name and then making a i forged menu type creating it and passing in the factory here and when we actually Register this we just want to say public static final registry object no absolutely not a registry object though there you go that is the menu type of type gem infusing station menu this is the gem infusing station menu absolutely this is equal to the register menu type method that we’ve made gem infusing Station menu colon colon new and then passing in the name which is of course gem underscore infusing underscore station underscore menu beautiful and that is it for this as well we can now close this and go back to the menu class say mod menu types that jam infusing Station menu dot get and that should get rid of this error here as well and then finally we can also go into the block entity to our last error that is here and we can actually create the menu inside of this one as well so here we Actually want to create the new menu now luckily we have everything available here so we could say new gem in view gem in fusing station menu passing in the id the inventory as well as this and this data very important and there you go that should be pretty much what we need In this case and that also concludes the block entity class actually and the last thing that we need to do is adjust the screen the screen is going to be very interesting indeed but the screen is going to extend the abstract container container screen of type gem infusing Station menu also very important that this is done correctly hover over this implement the render bg method that’s fine and then let’s create the constructor matching super as well let’s once again just change the names over here it’s just a little bit annoying when they have this and are not mapped we’re definitely Going to change this in the um oh this is actually that’s this is kind of a bummer let’s do this is actually partial tick this is going to be the p mouse x and this is p mouse y now i just know this that this is the Case uh for next time we’re definitely going to take a look at parchment i think that they should be available and then most of these parameters are going to be um absolutely mapped as well let’s also get the render method over here and i’m actually just going to copy this Over because it’s going to pretty much look the same anyway we just want to render the background pull the super and then render the tooltips so that should be what we need here and then we just need some boilerplate code in the get background method but we Also want to init and all of that craziness but first of all we need a texture let’s add the texture over here so you can see this is just a resource location under textures gui gem infusing station gui now let’s immediately add this texture this is going to be under Textures of course right under gui and then let’s just copy over the actual texture for this i’m infusing station gui png perfect there you go and this is the beautiful gui and now everything should probably also make more sense right i’ve told you in the menu where do We get those numbers from right where do we get the x and y values well those are just the x and y values right here we’re starting at 0 0 right here so this would be like 15 and 12 or what was it exactly At 12 and 15 there you go so this is at 12 pixels in this direction and 15 into this direction and then the rest should pretty much be fairly self-explanatory uh all things considered you want to overwrite the init method as well and let’s just keep it there because i’m Going to need this in the future as well and now just some uh well other basic things in the render bg method so this is pretty much all boilerplate code this is sort of just setting up like everything the same with this one right here this simply uh this is actually the Stack let’s actually change this to people stack over here as well there you go so this basically just renders the texture this texture right here that we’ve specified that you’ve literally just seen this is what gets created when we call this split over here and then we want to actually make a new Method that is the render progress arrow once again i’m going to copy this over and i’m going to explain i’m also going to call this right here a render progress arrow passing in the post stack as well as x and y all right that’s going to be fine and Then the question is okay what is this doing well first of all we’re checking whether or not we’re crafting because if we’re not crafting we don’t need to render any type of arrow right that doesn’t make any sense we only need to do this if we’re actually crafting and Then there’s a whole host of numbers over here that you’re going to be like wait where did those even come from well first of all what is x and y x and y is pretty much this position right here so this this would be the 0 zero quote Unquote of our gui and then we’re get going into 105 and 33 well where is 105 x and 33 why what does that do well it goes right here and then it goes down right here ah okay so what does this do well we’re drawing the we’re rendering The progress arrow ah so this is where we started drawing it yes exactly now what are we drawing is the question well we’re drawing something that is at location 176 and that is right here so we’re basically drawing this arrow how do we know like what size it is well that’s The last two parameters here that is the eight so we know that it’s eight in width and then the height is what is the height get scale progress ah so depending on how far we are long we’re drawing more or less of this arrow that is what happens in this blip method i Can just say that the blip method can be quite complicated if you’re looking at it for the first time i highly recommend playing around with this a little bit trying to understand what is going on here and changing around those numbers once you understand it it actually is Not as crazy as you might think but it is just going to take a little bit of time to sort of understand it now we need to register this craziness of course as well so the screen here needs to be registered let’s go to our tutorial mod class over here and let’s Register it so this is going to be in the on client setup event here and that’s going to be the menu screen start register passing in the mod menu types dot gem infusing station menu dot get and then gem infusing station screen colon colon new no errors should be present and Everything should be properly registered and everything should be done that’s i mean it sounds pretty good let’s i would say looking at it it should all work so let’s go into the game and see if it works all right fans ups in minecraft so let’s just try and Right click one of those blocks and there we go i mean that’s already a very very good start of course now the this and this is like those are spoilers we’re not going to discuss what those are in just a moment but let’s actually just get a few raw zircons and in theory What should happen is that if i take this raw zircon in here we should see a you know an arrow appear right here and then at the end we should get a normal zero canal that is already a great start over here and then once it’s done bam a Zero coin is there that’s actually perfect let’s see if we just put this in here and then everything should work totally fine we can see we’re just getting more and more zircons over time i can close out of it it’s going to run you know without me looking at it as Well so if i you know just run around oh a nice cow here goodbye thank you very much and then i can go back and we should have even more zero cons there you go so it continues to run basically and everything works if i destroy the Block there you go everything drops as well so this is pretty awesome indeed now there’s actually one tiny thing that we want to add as well because that i might may or may not have forgotten something i know it’s absolutely crazy but that is already pretty freaking Awesome to have a custom block entity in minecraft now luckily i still thought about it and that is saving the progress as well so i highly recommend what you do is you do nbt.put over here are actually put in and we’re going to save the gem underscore infusing underscore Station.progress there you go and then just saving let’s start progress absolutely and then we’re doing the same thing right here we’re actually doing it the other way around though we’re going to say progress progress is equal to nbt.getint and we’re just going to get gem infusing under scorestation.progress Beautiful and then the progress is also saved now when we actually would you know unload the world and reload the world later so that should be pretty fine indeed now that should actually conclude everything i can definitely say you know it is quite a complicated topic and there are you Know all sorts of different things to do here but it just is what it is if you’ve gone through making the block entity once or twice then you’re gonna get way more of a feel for it how everything works and while we’ll basically continue working with this Block entity for let’s say like the next couple of weeks or something like that definitely the next couple of tutorials whatever the case may be hopefully found this useful and you learn something new i would very much appreciate a like from you if you did otherwise i will see you all next time So yeah Video Information
This video, titled ‘Minecraft 1.19.2 Forge Modding Tutorial | CUSTOM BLOCK ENTITY | #22’, was uploaded by Modding by Kaupenjoe on 2022-08-23 13:59:48. It has garnered 19787 views and 276 likes. The duration of the video is 00:40:56 or 2456 seconds.
In this Minecraft Modding Tutorial, we are having a COMPREHENSIVE TUTORIAL for a Custom Block Entity in Forge with Minecraft 1.19.2
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== CATCH ME LIVE ON TWITCH == ▶️ https://www.twitch.tv/kaupenjoe
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/tree/22-blockEntities Gist: https://url.kaupenjoe.net/yt401/gist Assets: https://url.kaupenjoe.net/yt401/assets
== TIMESTAMPS == N/A RN
== 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