Let’s add custom blocks to Minecraft oh we found some packaging once more and in this craft Forge 119 3 and let’s just jump right in so in our tutorial more package we’re going to right click new package look and there we’re going to make a new Java class called the mod blocks class Now the general structure of this class is going to be very very similar to the mod items class the first thing we’ll need is a public static final deferred register once again this one from net Minecraft Forge Registries just hit the Tab Key to autocomplete and then we want In angle bracket inside of there we want to write block making sure that net Minecraft world block is selected and then hitting tab if for whatever reason the import does not happen automatically and the block here is red you just click on it press alt and enter and then once Again making sure you choose net Minecraft World level block and not nas or an internal IR very very important so just make sure that the correct block class is imported and then we can call this blocks and this is equal to a deferred register once again that create Forge Registries once again I’m just always Auto completing with the Tab Key dot blocks comma tutorial Mod Dot mod ID and then there you go and now what we want to do is we also want a public static void register method with an i event bus called event bus and inside of There we’re going to call blocks.register passing in the event bus now to register blocks properly we actually need two helper methods for this and the first one is going to be a private static and now it’s going to look very very crazy but don’t worry it Actually is not too bad we’re going to make a angle bracket here extends block and then we’re going to say registry object this one right here just autocomplete with AB angle brackets and so there we’re going to say item and then this is the register block item Method with a string name and a registry object of type T alt block this Insanity right here if you’re a beginner in Java this is called generics and it basically just just means that this registry object right which basically holds our item and then this registry object which Holds T we’re basically just saying hey this T can be anything that is a block that’s the general idea so don’t get too hung up on this at this point it is an advanced Java technique so I highly do recommend if this is something where You’re like okay I do want to know how this works I highly do recommend looking up at generics in Java however it is a more advanced technique so if you’re still a beginner you should go through some of the more basic stuff first anyway instead of here we just want to Return mod items dot items dot register and then we want to pass in the name we want to make a supplier of a new block item in this case once again hitting tab to auto complete this passing in Block dot get after the closing parenthesis is from get comma new item properties and Then we can end this with a semicolon and there you go that is it that is all that we need to do in this method and now we want a second helper method that is also going to be a private static once again angle bracket extends lock Registry object of type T this time or register block and this is going to be a ring parameter called name and a supplier this time of type T and this is going to be called block as well and again if this is red you can just click On this press alt and enter and we’re going to use Java util function right here and that should be fine now inside of here we want to make another registry object which is going to be called to return this is equal to blocks dot register passing in the name and the Block parameters and then there you go now this will actually register our block now for this block we also want to register the block item hence we’re passing in the same name and the to return registry object that we’ve created right here and then we’re also returning the to return registry object So that this can be saved in a field right so then we’re going to do a public static final registry object once again angle brackets of type block this time and this is going to be first of all the black underscore opal underscore block this is equal to register block the Method and then once again we’re starting to type in a name this name right here this thing that generates automatically you don’t have to type this out I’m only typing out the quotation marks and inside of those quotation marks we want the black opal look right here and then afterwards Comma and then a supplier of a new block this is absolutely correct and then the block needs some properties so we’re going to start with block Behavior once again autocomplete with tab dot properties dot of and here we Supply a material the material we’re going to Supply for the black opal block is going to be metal and then we’re going to also call strength so this is basically how long this takes to break and how resistant it is to explosions and then if you can see if I put a dot here in Here as well if I put another dot in here you can see there’s quite quite a few methods that we can basically call and all of those change things like speed Factor we have a sound right so I’m going to change the sound when you mine this block when you walk over this Block things like that so there’s a few things no inclusion No Loot table no Collision insta break so there’s a few things that you can basically call the only thing that we still want to call is required correct tool for drop and then we end this with a semicolon right and Now the block has been added now let’s not forget to call the register method in the tutorial mode class so we want to go here modblocks.register passing in the mod event bus and then also we want this block to be added to a creative mode tab so let’s just make a new if Statement here first of all event.get tab equals to creative mode tab Dot and we’re going to put this under building blocks so we’re going to say event.accept and then mod blocks dot black opal block and then we’re just going to copy this and also add it to Our tutorial tab because once again we can add them to as many apps as we want to but we’re not done quite just yet because of course we still need Json files and for the blocks the Json files are a little bit more complicated than for the items but no worries we’ll still Get through this so in the block state holder we want to right click new file and this is the black underscore opal underscore block.json and this is going to look like this I’m once again going to write this down and then we’re going to go through this so if you first of All have variance first of all we have a variance colon open early brackets and then a empty string curly brackets model colon Oriole mod colon block slash black underscore opal underscore block now what the frick is going on here well we’re basically defining some variants now in this case this doesn’t have any Variance this only has one variant and that is going to be the black block now this over here refers to a model file right this is a block model file that we’re looking for so we’re looking in the tutorial mode assets folder once again in the models folder right here in The block folder right here and we’re looking for a black underscore opal underscore block Json file so this is exactly what we’re going to create now so new file in there black underscore opal underscore block dot Json and this is the lock model Json file this basically determines the texture for This particular block and it’s going to have a parent this parent is going to be Minecraft colon lock slash Cube underscore all armor extras extras there you go colon early brackets all and then this is Once Again tutorial mod colon block flash black underscore opal underscore block there you go now what You will find is that this particular Json file looks very very similar to the item model Json file like if we compare those you can see they are very similar in style and this is exactly right so the parent right here in this case Cube all just says hey how is this particular Block displayed what are the textures of each of the faces it all just means that all of the faces have the same texture then we’re once again looking for a texture in the textures folder of tutorial mod and we’re then looking for a block folder and inside of there we’re Looking for the black underscore Opel underscore block we’re just going to add this right here and then this is going to be displayed as all of the textures on all six sites now in this case the block will have a texture inside of the world but it will not have a texture Instead of the inventory because to get that into the inventory we also need an item model however that one is one of the easiest ones so this is the black opal underscore Opel underscore block at adjacent files and that one simply has a parent and the only thing it looks for Is tutorial mod colon block slash black underscore opal underscore block and this in this case simply refers back to the block model Json file right here so this just looks into the models folder into the block folder and looks for a black opal block Json and then displays It in this you know in the normal 3D way that blocks are basically displayed instead of the inventory now last but not least we also wanted to translate the name over here so let’s just zoom in a bit let’s just duplicate this and then instead of an item this is of course a Block it is still under tutorial mod and this is going to be the name of the block once again black underscore Opel underscore block and this is going to be the black block or you can also call it you know block of black opal whatever basically you want to do and with that We have added the block successfully so let’s just go into the game and see if it works all right Francis back in Minecraft and let’s just see first of all in the building blocks at the very bottom there we go the block of black opal and I do really love the texture And it also is in the tutorial tab absolutely amazing so you can see that works and if I set it down it also looks freaking amazing inside of the world so once again to quickly troubleshoot some stuff if the texture does not display in the world but it does display in your Inventory then the block State’s Json file is at fault if it displays in the world but it doesn’t display in the inventory correctly then it’s the item model Json file and if both textures don’t work then it can be any one of those files if neither of the textures Work and the name also doesn’t work then you probably have written your mod ID wrong or you’ve registered it under the wrong mod ID hope that helps you for troubleshooting but that is pretty awesome to have added a block right here so let’s add some more right we’re not Quite done just yet I actually want to add several more blocks that we’ve seen like how to add more of them so what I usually do is I just copy one of the existing blocks then make sure to change everything properly so this is going to Be the black opal or actually and this is also going to have a different name now this is not only going to be a normal block this is actually going to be a drop experience block because in this case I want our or to drop experience this is a normal thing that Or does right and what you can do is you can actually middle Mouse button click on this and you can see the actual class this is the actual Java class from Minecraft itself that uses the drop experience block now you can see we’re currently using this Constructor right Here which would drop nothing this of course not what we want so we want to add a another parameter into the drop experience block Constructor and that is an in provider so we’re just going to say uniform uniform int dot of and we’re going to pass in something like let’s Say between two and six something like that now for the vanilla values what you can do let’s go back to the drop experience block and we can just middle Mouse button click on this and then what you will find is every instance this particular class has been used so for Example we’re like well you know what I want this to be exactly like the lapis block oh or the lapis ore so we go into the blocks class and you can see in line 132 if we just zoom out here a little bit the uniform of two to five okay That’s pretty good two to six I think that that is pretty okay and these are all of the blocks so this is a incredibly useful thing right so middle Mouse button click on classes that are from either Forge or from Minecraft itself can basically open up a lot of Stuff for you right for the sake of government let’s just duplicate this four times and then we also have a deep slate underscore black opal ore so that’s going to be late make sure to always change the names right here because once again if the names are the Same that is actually going to lead to the game not working then we have Netherrack underscore black opal ore and we also have n Stone underscore black opal ore once again changing the names here very very important Netherrack underscore and then here it is n Stone Under four and then also we want to change the material to Stone because well this is Stone right like all of the ore blocks are really Stone they’re not real Idol and then we can for example also change maybe some of the strings right so some of the things are a little Bit easier to mine maybe Netherrack is a little bit easier to mine and then and soon it’s the hardest to mine there you go now what’s also incredibly important please note this you will not be able to mine those blocks with any tool right now and they will not drop anything That’s something we’re going to do in the next tutorial right now the question will be well for all of those four blocks do we still need to add all those Json files that is indeed correct now I already have all of those prepared but if you take a look at them they are Pretty much exactly the same just changing whatever it basically refers to now all of those Json files as well as all of the code is of course available to you in the description below as I download and also adds a GitHub repository so no worries there at all But I just wanted to mention this so yes you will have to do those every time however we will later in this tutorial series we will see a way of generating those automatically and then you don’t have to type everything out and duplicate them and all of that that Would be pretty awesome indeed alright so here we have the translations right nothing too crazy I mean at this point the pattern should be pretty obvious like what it is right so nothing too insane over here and then the block model Json files right these are all the Item model Json files and then last but not least the extras of course and there you go and of course everything here is available in the description below GitHub repository and there you go so that would be pretty much all of that let’s also add them to a rate of mode Tab so let’s just add them to the building blocks I I mean I guess is there another one wait let’s actually like an or no colored blocks it’s not really a color block um op blocks it’s also not an OP block it might be natural blocks I feel like That that could work let’s just duplicate all of this and then say this is the natural blocks get rid of this this one in here another rack This is the End Stone ore plate or black opal or there you go and we’ll also add all four Of them right here I just selected press Ctrl C and then Ctrl V to paste it in and there we go now all of those orders should be added to the game as well so just for completion sake let’s go to the game and see if it works alrighty Francis back in Minecraft again and let’s just see and there we go all of our different blocks have been added let’s just set a couple of them down there you go beautiful so all of them are added and they should also be added to the Natural Blocks so let’s see there you go they’re also there absolutely freaking awesome and well that’s pretty much how easy it is to add a bow load of blocks to Minecraft and that’s gonna be it for this tutorial right here thank you so much for watching and I’ll see you all Next time so yeah Video Information
This video, titled ‘Minecraft 1.19.3 – Forge Modding Tutorial: Custom Blocks | #3’, was uploaded by Modding by Kaupenjoe on 2023-02-01 16:00:14. It has garnered 10414 views and 225 likes. The duration of the video is 00:14:46 or 886 seconds.
In this Minecraft Modding Tutorial for Forge, we are adding a Custom Block to Minecraft 1.19.3 using Forge.
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== COMPATIBILITY == ▶️ Compatible with 1.19.3 and 1.19.4 🛑 NOT COMPATIBLE with 1.20.X
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19.3/tree/3-blocks Assets: https://url.kaupenjoe.net/mbkj11/assets
== 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 *
== 1 MONTH SKILLSHARE FOR FREE == ▶️ https://www.skillshare.com/r/user/kaupenjoe *
== 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.
== 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