Let’s add some custom blocks to minecraft all right friends back intellij once more and in this tutorial we’re gonna be adding some custom blocks to minecraft and this is going to be very similar to how we add the custom items however there are let’s say one and a half steps Extra that we have to do but no worries at all we’ll still get through this so in the tutorial mod package we’re gonna right click new package called block and then inside of there we’re gonna right click new java class called mod blocks and then let’s just start so the first Thing we’re going to have is a public static void register mod blocks method over here and once again we’ll just do tutorial mod.logger.debug and then we’re just going to say registering mod blocks for tutorial mod.mod id once again this is not necessary to actually put this into The method however the method itself is necessary and we’re immediately going to call this after the mod items method over here so modblocks.register modblocks and once that is done we actually need two helper methods for us to properly register the blocks this is because when we register a block then a Block is added but the item that is associated with that block is not added automatically this is why we’re going to need two helper methods so the first one is going to be a private static block called register block if this ever is read over here you can just click on it Press alt and enter and then import the correct one from net minecraft block over here that’s very important and then the register block method also contains a string parameter called name able rock parameter called block and an item group called tab in this case you can also Call this group or whatever you want i’m just going to call this tab that’s going to be fine and here we’re going to return registry.register with the registry.block over here with a new identifier passing in tutorialmod.mod id the name and then after the first parentheses put in comma Block and then ending it with a semicolon very important is when you import the registry class over here right when you do this make sure that it imports netminecraft util registry registry and none of those java classes then you’re going to have an error that comes when you import the wrong class Right and we’re going to need another helper method and that is going to be a private static item and that is going to be the register block item method over here let’s just write this out and then we’re going to import the item in just a Moment this is a string name a block block and once again an item group i’m going to call it tab once again let’s click on item again alt enter to import it and there we go then we can return registry.register registry.item this time and then a new identifier one more time with Tutorialmod.mod id comma name and then after the first closing parenthesis comma new block item in this case and then passing in the block comma new fabric item settings dot group passing in the tab over here and then ending with a semicolon all of the code as always is available to you in the Description below in a github repository an individual just as well and you can basically see we’re just creating a new block item in this case instead of just a normal item that is associated with the particular block that we’re passing in here and we’re just going to call This right here so register block item passing in the name the block and the tab and that is pretty much all that we need to do in this case and now we can finally start by adding our first block so how is this going to look well this Is a public static final block of course called tanzanite underscore block in this case equal to the register block method over here starting with the names or just a string once again this name plate right here which gets generated automatically it is just the name of the parameter that we’re currently passing In you don’t have to type this out yourself then in the string we’re going to write tanzanite underscore block and comma after the string and we’re going to say a new block here with the fabric block settings this time dot of and then we have to choose a material here so We’re just going to choose material material.stone that might make sense we can also choose material.metal you know whether or not the tanzanite block is metal or stone you know it is up to you this really only changes the sounds that it displays and some other things but Basically so some so block settings are being set automatically however the block settings once again are a builder pattern so if we put press the dot over here you can see there are quite a few different methods that we can actually call over here and change so you can set The luminance so this would actually add a shine to this like a torch basically or or glowstone break instantly should be fairly self-explanatory so there’s quite a few things here and i highly recommend just playing around with a lot of this slippery resistance very interesting now we’re just going to set The strength this basically just sets how hard this might be to break in this case so how long it’s going to take to break the block now what’s very important is that we also call the requires tool method if this block requires a particular tool to mine now In this particular tutorial we’re not going to have this be mineable so this means that you can’t take out a pickaxe and you can mine it but nothing will drop this is going to be done in the next tutorial so please keep that in mind and here after the second closing Parenthesis we’re also going to add in the mod item group that tanzanite and that should be pretty much all that we need to do for this block right now the block is registered but what do we need when it comes to the json files well there are quite a few more json files That we actually need in this case but no worries we’ll still get through this totally fine let’s start here in the assets folder in the block states in the very beginning so we’re just going to right click on this new file called the tanzanite underscore block.json making Sure that this name right here of course matches this name right here and then also adding a dot json for the file name for the file ending basically now the contents of this i’m going to type this out and then i’m going to explain so we have variants over here colon pearly Bracket once again then empty string over here curly brackets and inside of those we’re going to have a model colon tutorial mod colon block slash and the night underscore block now what is this craziness over here well you can see we’re basically pointing to a model file Now what does that mean this basically means we’re pointing to a file in the models folder inside of the block folder once again all under the tutorial mod namespace and we’re looking for a file that is called tanzanite underscore block.json right here in this folder what you can probably gather from the Name variants over here is that you can actually have multiple variants this works with different block states rest assured we’ll take a look at that in a future tutorial as well now please make sure that you write variants correctly and you have an empty string over here Once again the json files are also available to you in the description below in the github repository individual gist as well but please make sure that everything is written correctly now in the block models folder we’re going to right click their new file called tanzanite underscore block that is json now interestingly enough Here this name does not necessarily have to match this name because we are actually referencing the block model json file right here so this is the name that this has to match i could also call this xyz whatever i want and if i if this if the Name of this json file matches this then we’re going to be totally fine if you only have one model here so you’re referencing only one model then please make sure that this is named the same otherwise you will just get lost in the source basically right Now how does the block model json file look well actually it’s very similar to the item model json file but let me just type this out and then i’m going to explain so once again we have a parent this time of block slash cube underscore all textures poland curly bracket and Then we have all and then we’re going to say tutorial mod colon block slash tanzanite underscore block now what’s going on here if we actually compare this with an item you can see they are very very similar right we just have a different parent right this is the block Cube or parent basically meaning that we’re having a cube with this particular texture that we’re referencing here in the textures block folder called tanzanite block png and we’re going to set all of the different sides of this cube to this particular texture that is pretty much all that is happening here So nothing too crazy going on once again make sure that the parent here is also written correctly it’s not blocked with an uppercase b is blocked with a lowercase b now with an uppercase c cube all just like this please keep that in mind as well right and then we have a Block model now we still need an item model for a block as well because of course that is what we need so let’s just make a new file here as well tanzanite underscore block.json now this one does have to match the name of this one right here so keep that in mind as Well so that’s why i’m saying make sure to basically always make the names match that is the smartest thing and now this particular json file actually looks way easier because this literally only has a parent and this is just going to point to tutorial mod colon block slash Tanzanite underscore block now this in this case actually points back to the block model and it’s going to make our custom block appear in our inventory just like any other custom block might appear in the inventory in this 3d way and that is literally what this Basically does we still need to add the texture as well of course that is in the block folder so tanzanite underscore block this will be available to you for download as well and that is pretty much all that we need for this particular block now we also need a translation now Can you guess what the translation might be i mean it should be fairly obvious it is of course a block that tutorial mod that hands a night underscore block and then just a block of tanzanite there you go that is pretty much all we need for a Particular block now before we go into the game let’s just add another block because why not let’s actually add the ore block as well so we’re going to add the tanzanite ore so what i do is i just select all of it press ctrl c to copy Ctrl v to paste it in and then we just change the name over here and then very important that we change the name given to this block here as well because if you have two blocks that have the same name then minecraft is actually not going to start so you’re gonna have an Issue there so keep that in mind as well now we have the tanzanite ore and when you mine an ore block this actually does drop some experience so we can make this an or block over here and this can then have a second parameter which is a uniform in provider over here that Create and then we can say for example between three and seven experience will be dropped when you mine this particular block and this is also going to be material.stone just because that makes a little bit more sense now let’s just duplicate this one more now let’s just Duplicate this one more time and then we’ll also make the deep slate variant over here we’re going to make a deep slate underscore tanzanite and then here in the name as well of course deep slate underscore tanzanite or there you go and that should pretty much be all that we Need here now yes we need a new block states json file a new block model file a new item model file and also the textures as well so this is going to be copied over in this case so i’m just going to copy those over however those Are also available to you for download and also they are pretty much the exact same thing as the you can see tanzanite or over here and the tangentine block they are very similar so there’s not that crazy of a difference in those files so hopefully you should be able to Actually make them yourself and at the end i’m actually going to give you two textures that where you can try out to add a block yourself and then you can see whether or not you’re going to be able to do that right so let’s add the Textures here as well and then last but not least let’s also add the translation so let’s just duplicate this this is going to be the tanzanite or over here making sure this is written correctly there you go and this is going to be tanzanite or and then this is going to Be i’m just going to copy this over this is the deep slate underscore tanzanite or and then same here this is going to be now written correctly deep slate hands knight or there you go and that would be all that we need in order to add our custom blocks over here let’s go Into the game and see if it works all right fans are back in minecraft again so let’s just see there we go all three blocks have been added and let’s set them down and there we have it don’t they just look absolutely beautiful they really do and this is absolutely amazing Now for some troubleshooting if the textures of your blocks do not work inside of the inventory but they do work inside of the world then there is an issue in your item model json file for your block if the texture works in the inventory but not inside of the world Then there has to be an issue in your block states json file if the texture doesn’t work in either one of them then it could be any one of your files please make sure that you write everything correctly and that you have no typos in any of your json files and also that Your folder structure is set up correctly all right and then just for fun i will leave you with end stone tanzanite ore and netherrex tanzanite ore over here let’s just take a look there you go so you have those two textures also available in for download And in the github repository as well and you can just try and add those yourself now this should very much be a trivial matter you pretty much have all of the json files over here you have two examples for ore blocks so this should be no issue for you at all right that Concludes this tutorial right here i hope you found this useful and you learned something new and i’ll see you all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19 Fabric Modding Tutorial | CUSTOM BLOCKS | #3’, was uploaded by Modding by Kaupenjoe on 2022-06-17 13:59:48. It has garnered 16982 views and 351 likes. The duration of the video is 00:13:03 or 783 seconds.
In this Minecraft Modding Tutorial, we are adding CUSTOM BLOCKS with Fabric in Minecraft 1.19
== MINECRAFT COURSES == ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 *
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19/tree/3-blocks Gist: https://url.kaupenjoe.net/yt333/gist Assets: https://url.kaupenjoe.net/yt333/assets
== TIMESTAMPS == 0:00 Intro 0:23 Creating the ModBlocks Class 3:21 Registering the Block 5:16 Adding the JSON Files 9:36 Adding two more Custom (Ore) Blocks 11:46 Demonstration 11:59 Common Problems and How to solve them! 12:29 Leaving you with two more textures 🙂 12:54 Outro
== 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