Hey what’s going on guys tessier here and welcome back to another uh tutorial in this tutorial i’m going to be covering how we can go ahead and make a block for forge 1.16.4 for minecraft of course so blocks are actually quite similar to items surprisingly um or maybe not surprisingly so all you really need to go ahead and do is go into our blocking it which is a class i created in the organization video and in here we once again want a deferred Register so that is a public static final deferred register and for this we will go ahead and put block and just make sure you import block actually we cannot import block yet um but we can call this just blocks and that will be equal to deferred register dot create and This will first take in the registry so for that we obviously use forge registries dot blocks and then for the second part that is the mod id so we just use um tutorial mod which is our main class dot mod id and access that static field Once you’ve done that you just need to import block make sure you import the right block so that is obviously net.minecraft.block.block and there we go that is the deferred register so so far the exact same as the um as the items now we just need a registry object so that is a Public static final registry object and this will once again be a block if i could type of course i’m just going to call this example oh what happened there example underscore block And that will just be equal to blocks dot register this will first be the name um so that’ll be just the example underscore block and then it is a supplier of the block so we can do a new block Once it loads there we go inside of this uh block constructor right here this just takes in an abstract block.properties so to use that we can just use abstractblock.properties.create and this has a few different overloads so we have the first one which just creates in which just takes in a material We have a one that takes in the material and a die color and we have one that takes in heat function for a block state and a material color so you can basically have the material color dependent on the block state which is quite useful for some things and then you just have The material and the material color i’m going to actually choose the material and the material color but in general uh people use this one just the material it doesn’t really matter which one you choose um it just depends sort of what what you want your block to Function as i suppose so for this first parameter this will just be material dots and you’ll see a whole list of materials loads of them i’m just going to choose iron which is right there and then for the material color that is just material color dot and then you get this whole List here so i’m just going to choose i’ll choose blue okay and then after that we can do any other properties we want and they just stack along along along as they all return back the properties so there’s a few that i’m going to cover um I’m going to go ahead and cover hardness and resistance so there’s actually two overloads for this there is the one that takes in one float and that will apply for both the hardness and low resistance and there is one that takes in two floats so that will be the hardness For one and the resistance for the next so i’m going to go ahead and use um the one that has two floats so for the hardness i believe diamond is about 15 uh for the hardness and i believe for the resistance it’s about 30. that is just off the top of my head Um in the description i will have two links which will be for the hardness and resistance values of vanilla blocks alternatively you can just go ahead and look vanilla blocks class where you’ll see all of these different values for each block so once you have chose your hardness and resistance values I’m just going to move this down so we can have it a little more organized we’re going to go through a few more properties here so the next one i want is harvest tool i believe so there is pretty sure two different things here there should be harvest level and Harvest tool here you go harvest level and harvest tool so first i’m going to set the harvest tool and this will basically be the tool that is used to harvest it so i’m just going to choose pickaxe but there’s obviously ho shovel and axe so i’m just going to choose pickaxe and Then for the harvest level once again i will actually have some values um based on the harvest level uh in the description there is a site for that as well now if i choose negative one that means that all levels can choose it can use it if i choose zero that is wood If i choose one that is stone and gold if i choose two that is iron free it’s diamond and four is never right um and anything past that will be only for modded pickaxes so only four pixes which um have been modded to have a higher harvest level So say for example five might be like cobalt maybe or it might be obsidian if someone adds an obsidian pickaxe um i think you get what i mean though i’m going to choose two now i think you can also do something with the hand um Maybe not i i do seem to remember there was some hand property but maybe i am wrong now i would like to mention if you want all these values to be the exact same as a vanilla block what you can do is just instead of create up here You can do uh from and in there you can just do blocks dots and choose whatever you block you want or if you want it from one of your own blocks you can do blocking its dots and then a block name dot get and that will get the values from a Block in your own block in it so that is quite useful but i’m not going to do that Um i think there is one more thing we probably want to go ahead and do and that is probably the sound obviously as i say there is loads more properties and i will be covering them in my uh advanced blocks video which will be coming shortly after this one now for this Sound we just use sound type dots and as you can see there are loads of these just as the other ones so i’m going to just use um i think there’s metal somewhere pretty sure there is metal i just can’t see it though there it is metal and Yeah obviously if you want um another property you just do uh another dot and then uh jump factor for example a lot of the properties are quite self-explanatory for what they actually do Um i don’t want them to be formatted like that so i don’t know why it’s doing that and yeah um it is sometimes better to just have it on one line for example if you’re having a lot of blocks uh doing it like this will take up a lot of lines And leave a lot of white space So it’s it’s gen really better to just have it on one line um but i prefer to separate it onto multiple lines so i don’t have to scroll across and see what it is you can always just go ahead and click this plus sign here and that will just Uh put the dot dot there when i believe you can just hover over that and it will show you and i like to keep that expanded so yeah that’s pretty much it for a block now if you want your block to have um any special properties like when you Right click it it does something or whatever and that will be slightly more advanced i will be covering that in my advanced blocks video so i’m going to be doing a lot in that advanced blocks video So that is actually it for the initialization other than actually registering the deferred register so if you were here for the last episode we did the same with items so we just need to do the same again so blocking it dot blocks dot register and that just takes in our bus Variable which we made right here now this will register a block we will have a block in the game however we will not have an item for that block since items and blocks are different so we need a block item which allows us to actually place the block so if we go back Into our item in it we can go ahead and create a another field down here so i’m actually just going to put a comment and do this block items so here we can do another public static final registry object and this will be instead of An item in here we want a block item you can put item but i prefer to keep it as block item now for this field you in general want to name it the exact same name as what you put in blocking it so if i go into blocking it you can see I put example block So what we really want to call this field is just example block and that will just be items.register and just the name should be also the exact same as in blocking it so as you can see we put example block and then you once again need the supplier But instead of a new item here we want a new block item And this will first take in the block that this block item will use so for that we can just do blocking it dot example block now that will throw an error because as you can see in our blocking it this is a registry object it is not an actual block So to obtain the block from a registry object it’s extremely simple we just go ahead and add a dot get on the end and that will return us the block class and then we just have the properties so for that i can just do a new item dot properties dot group I’m i’m just going to group it but you can do any other special properties you wish if you want it to be a food or whatever you can do that i’m going to be covering that in a separate video so i’m going to use item group dot Building blocks just add a semicolon on the end and there we go that will register a block item now there is a way to loop through all of your block items and at all of your blocks and register a block item for them i’m not going to show you how to do that However i will have a paste bin in the description of this video which will have the code you need to do that so basically all you need is just a registry event but i i will have a whole class for that in the past bin and you can just use That class if you wish but if you only have a few blocks in your mod i wouldn’t really say it’s worth um automatically registering them but if you want to you can i’m just not going to show you how to do it in the next tutorial you will see that i do have That in here and it’s it’s a lot helpful for the future because i’m going to be having a lot of blocks now we need to go into our source main resources and first we’ll go into our lang and we just want to add it to our lang So for this it will be block dot tutorial instead of item because this is a block and then it is just example underscore block and i’m going to call this example block or you can just call it a block of example for example um i’m actually Going to keep it as block of example i think that works quite nice and i believe you can also do um tile dot tutorial dot dot example Block and i’m pretty sure that will fix um a little issue with the naming when you slash kill that item because i’m pretty sure if you slash kill it it will say that tile.tutorial was killed instead of block dot tutorial um but i’m not certain on that Um yeah and then we need to do the models but blocks are slightly different so there is never a actual block in your world this might be a quite confusing concept to understand if you’ve never seen it before but there is no such thing as A block in your world there is instead a block state and that block state holds the block class but it also holds a bunch of information about the block so it will hold any any different properties with the block so for example cauldrons have different levels and those are whole Held in block states What else crops crops have different stages those are hold held in the block state so we need a block state for our block and all we need is just a default property because we don’t have any special properties yet and that will be a thing i do in a moment So we want to create a new folder or a new package inside of assets.tutorial called block states and then for the name of this we need to have it the exact same name as what we’ve registered the uh the block so that would just be example unscore block And obviously this is a json and just press finish and there you go we now have our json now in the description of this video i have got two jsons for this one for the block state and one for the block model so we just want to put the block state One in here and we just need to do a little bit of substitution so we’re going to substitute mod id with our mod id so mine is obviously tutorial and the block model is the name of what our block model will be called so i’m just going to keep it Um the same as block state name i press keep it the same so that it doesn’t get uh confused and that will just be example underscore block so you in general want to keep it the same name as the json however obviously if you have different states then you can’t do that So just going to go through this really quickly so we have the variance this basically it can hold multiple variants and here we just have the default variant since we have no special properties for our block we just have a blank property here and this holds the model So this basically um tells it that this is the model location right here it starts at assets and then tutorial and after tutorial as this colon shows it skips to models since it knows it will be in models and then it goes to the block folder which we have specified here And then it goes to a file which will be named example underscore block and then it knows it’s adjacent so it adds adjacent on the end that’s basically how it figures out what is happening so we can close that now and actually go ahead and create that file So once again we just want to name it whatever we just put for that um block state and once again as i said i have this in the description now if you want your block to have different textures on different sides you can use a block slash cube and specify the different sides Here so for example um up and then blah blah blah blah blah however i’m not going to be sort of covering that in here you can look at vanilla blocks such as the furnace and crafting table to understand better exactly how that works so once again this is just a little bit Of substitution we substitute our mod id out for our mod id so tutorial and we substitute texture name for what the name of our texture will be so once again i’m going to keep it the same and call it example block and i’m just going to run through this really quickly So here we tell it what to parent off of so this basically tells it um what textures it will be looking for um and then and and what the base model will look like and then we define those textures and here we are just using all since that is what Uh cubeslash all asks for So we are defining that’s all texture as tutorial so assets.tutorial and then as once again the colon says it jumps down to textures and inside textures we have the blocks and inside there we will have an example underscore block jason no png not jason um so yeah it obviously knows it’s a png We don’t have to tell it it’s png since you can only have pngs and yeah that is pretty much it obviously we do need to go ahead and put our texture in there i don’t currently have a texture so i’m just going to create that and i will be back once i’ve Done that Okay so there we go i just went ahead and created my texture now i’m just going to refresh the workspace so that i have that in there okay so now we can go ahead and actually there’s one more thing we do need to do we need to do the item model So i’m actually going to create this um myself i don’t think we need to go ahead and copy this so we just need to name this the exact same thing as our block model and we’re going to type this one out ourselves as it is very simple So all we do is we do the parent and in here we can just do tutorial mod block forward slash and then our block name so example underscore block and what this does is it just gets the um item model from our block model so it parents the item model off of Our block model which we specified right here and yeah that i mean that’s it for the for that so now i’m pretty sure we can go ahead and run the game and i’ll see you guys there okay so guys as you can see i am now In the game um i did have a little error because i was being a little bit stupid and i accidentally put tutorial mod for my mod id um but obviously my mod id is tutorial uh so i did just have to fix that um me being city really But if we go into the building blocks tab we can go down to the bottom and we should be able to see our block with the correct name and hopefully the correct model in hand and hopefully the correct model when placed so as you can see it works perfectly fine So yeah that’s pretty much it it has the correct sound type that we set it so that is iron and hopefully if i just go into survival so we set the material to iron um so i hope you guys did enjoy this tutorial if you did please do be sure to smash Your face into that like button and go ahead and subscribe as well it’s free i mean why not and hit that bell if you want to see when i next upload and get notified for it um so yeah i will see you guys in the next video good bye Video Information
This video, titled ‘Creating a Block – Minecraft Forge 1.16.4 Modding Tutorial’, was uploaded by TurtyWurty on 2020-12-29 16:30:10. It has garnered 18708 views and 552 likes. The duration of the video is 00:25:53 or 1553 seconds.
In this tutorial, I cover creating our own block with its own texture and name using the Forge Modding API.
|| Important Information || My Discord Server: https://discord.gg/d5cGhKQ Template Blockstate JSON: https://pastebin.com/T3rfa7dL Template Block Model JSON: https://pastebin.com/7Tf20As7 Vanilla Hardness Values: https://minecraft.gamepedia.com/Breaking#Blocks_by_hardness Vanilla Resistance Values: https://minecraft.gamepedia.com/Explosion#Blast_resistance Loop Register BlockItems Code: https://pastebin.com/AXTLGqmq My GitHub: https://github.com/DaRealTurtyWurty/1.16-Tutorial-Mod