Hello hello hello everybody and welcome back to another minecraft modding tutorial for forge 1.19 in this tutorial we’re going to be making a block so let’s go ahead and let’s get started so let’s go jump straight into the code it’s coming to our init package let’s create a new class And we’re just going to call this something along the lines of block init by the way i just wanted to mention it doesn’t matter where you call these classes just call them sensible names something that makes sense uh you know if you want people to help you You know if you ever get stuck you need people to help you have sensible names you know people aren’t going to be able to help if you have stupid names so once again we’re just going to create a deferred register here of type block and we’re going to call that blocks is Equal to the third register don’t create forge registries dot blocks this should already be fairly familiar to you tutorial mod dot mod id has a mod id then let’s just go ahead let’s define a block public static final registry object of type block and i’m going to call this example underscore block Is equal blocks dot register example under block a supplier of a new block this time it’s a little bit different so this time we’re going to have block behavior dot properties dot of and then we’re just going to pass in here a material for our block so in the Material i’m going to use um i’ll use amethyst i don’t know it doesn’t really matter and then once again you can just do your normal properties on the end here so for example um Let’s see what do we want i don’t know let’s say we want some friction of 0.5 okay just just a example and boom that is your block however this means you have a block that’s great but it means you won’t have an item for your block because you’re only Registering a block you’re not registering a block item so what i need to go ahead and do is register a block item as well so let’s come into item in it and all we need to do is go public static final registry object now this time instead of using item We’re going to use something called block item and i’m going to call this example underscore block underscore item is equal items.register i’m going to call this once again example underscore block so we we’re going to keep the item name the same name as what the block is called And instead of being a supplier of a new item it’s going to be a new block item and all we need to do here is pass in the block so we will do block init dot example block and then we’ll pass in our normal properties so a new item dot properties And we’ll just put it in tab creative mode tab dot building blocks so what on earth is happening here why do we have an error provided registry object we need a block how how on earth do we get a block from a registry object so if you recall back to the last Episode i explained that a registry object is simply just a supplier and obviously you should know what a supplier is that is just basic java knowledge so what do you do to get the object from a supplier you simply just call dot get now the important thing to notice if You’re ever to try and call dot get is you need to ensure that item or that object has actually been registered when you call dot to get because if you call dot get when it hasn’t been registered then it will be not so essentially this this is fine because blocks are Registered before items that’s just how it works so i know for a fact that at this stage that’ll be fine but you just need to be careful you know um that there isn’t really a definitive guide of when you can call it and when you can’t it’s just a matter of knowing When things are registered if you ever get confused about that feel free to ask in my discord server it is linked in the description uh i’m sure people there will be happy to explain uh in a little bit more detail which is a little harder to convey over video So yeah that’s our item now you may want to go ahead and actually create a method to do this for you so for example let’s just quickly try and make a method here and this might fail actually no we’ll cover this we’ll cover this in the next tutorial i’m going to make a Separate tutorial for creating a method to do this for us just uh something to make it a little bit simpler as registering both a block and a block item can be a little bit annoying sometimes for now we’ll leave it like this but in a later tutorial we’re going to want to Uh maybe make an alteration there now you may think that’s it with the code it’s not because as you remember in the last tutorial um essentially we had to go ahead and register our items and it’s the exact same with blocks we need to go ahead and Register that so if we come into tutorial mod we can just call block init dot blocks dot blocks dot register bus very very simple so we can just close all of those and that is it with the code um before we actually go ahead and close that actually let’s create another block Just to quickly show you once again how simple it is so example two block uh example two block i’ve literally just copy pasted it let’s change the material to um i don’t know dirt let’s remove the friction friction there you go just remove that fantastic let’s close that That’s it now i’ve added another block now we can do the resources so let’s come into our lang first so this time as we know instead of item it is block dot tutorial mod dot and this time it’s example underscore block and we’ll call that example block Very simple let’s do the same with our other one block dot tutorial mod dot example two underscore block example two block obviously these are dumb names but you would come up with proper names for your items then we need to come into models and actually we don’t come into models so You may think we need to come into models because that’s what we did for items but we don’t so we actually need to create a new directory here and we need to call this block states so this is just this basically defines where your models will be located And we need to do that because with some blocks we might want um multiple models depending on xyz you know so let’s go file and we’re just going to call this the exact name of our block so exampleblock.json okay and all we need to do in here is as before Uh well not as before we need to do something slightly different here so we actually need i don’t know that was right i don’t know why i don’t read that so we need to call this variance and this basically will define all of the different variants that our block could have So we’re not going to have any variance we’re just going to have the default sort of variant here and in here we don’t find a model and this points to the location of our model so where our model is located now for us that’s our mod id as usual And then we put colon and then it’s the package that is in so this is a block so it’s in the block package and then it’s just example underscore block which is the name of our json here as well let’s go ahead let’s now create the actual block model Which once again needs to be the exact same name you don’t want to put different names here i mean you could but it would get really confusing there’s a high chance you would mess stuff up so just keep stuff to the same name and you won’t have any problems there So all we need to know here is as we did with the item model in the previous episode we want to first specify the parent which is minecraft colon block or slash cube underscore all and that is just the model that allows you to do all sides there are different models so for Example there is a column model um which you might want to use for pillar blocks and you know logs all that stuff i will cover those different ones in separate tutorials for now we’re just going to stick with the cube all and we’re going to define the textures Now for cube all we need to say all instead of layer 0 and say tutorial mod colon blocks forward slash example underscore block because that’s where our texture will be located inside of textures blocks so as you can see this block slate here all this is doing is defining our mod id We already know it’s in assets and then it’s defining the block folder because it really knows it’s in this model folder here it just doesn’t know where so we need to say it’s in the block folder and then we need to say what it’s called which as we know is called Example underscore block and it already knows it’s a json so we don’t need to specify that there in here we just say the parent so we’re referring to the cube all model which says all sides will point to this texture that’s all it is really really Simple however since we have an item as well we have our block item so we need to actually make an item model as well so let’s create a new file in here just call this example underscore block.json as usual so they’re just keeping it the same as everything else We once again need to specify the parent and this is a little bit different so what we actually need to do is the parent is we need to point to the block model so we need to say tutorial mod column block four slash example underscore block so basically what we’re doing here Is we’re saying for the item model for the block items model we’re going to say the parent is this block model here and that just means the item will use the same model as the block if you wanted a 2d texture for the item you could You know it would be very simple you would just copy this and change it to what you need you know you can do that if you want it’s completely up to you but for majority of circumstances you’re obviously just going to want to have it look the same as the block model And that’s it so let’s just go ahead let’s copy paste these for our second example block so we just call it example two block example two block let’s do it for the block model as well example two block example two block and once again for the item model example two block Example two block and finally all we need to go ahead and do is make a texture and questions and i’m pretty sure we can run the game so here we are let’s go ahead and find our blocks so we should be able to find them both in here oh there’s only one of Them i guess we forgot to register the block item for the second example block didn’t we okay well that’s a very easy fix luckily example two block and yeah we’ll keep it in actually we’ll put it in decoration just to show that it’s different okay let’s rerun the game Let’s have a look so let’s go into decoration And there it is so we have our two blocks fantastic and obviously our two items as well if we just grab those out fantastic i actually didn’t intend for them to be the same color that is very much coincidence but uh yeah there you go so now you have a block What can i say um you won’t be able to mine it that is something to mention so if i go into survival you see that it just breaks instantly because we haven’t set any hardness we haven’t given it a loot table um we haven’t added it to any mineral tags Those things we will be doing uh not in the next tutorial but in the tutorial after that one we’ll cover those they’re really simple so that should hopefully be a very short tutorial but yeah i hope you guys did enjoy this one if you did please do be sure to smash Your face into that like button and subscribe if you really enjoyed please do be sure to share it around and um Commander brown do you really think you can defeat me let’s find out three two one let’s go okay take this i see how it is detroit impossible how did you do a perfect 90 degrees just like this Video Information
This video, titled ‘1.19 Minecraft Forge Modding Tutorial – Blocks’, was uploaded by TurtyWurty on 2022-06-23 15:47:18. It has garnered 4713 views and 137 likes. The duration of the video is 00:17:23 or 1043 seconds.
Hello everyone, in this video we will be creating our first blocks!
In the next video we will improve our block registry method to make it a little more streamline! Remember, if you have any problems, please join the discord that is linked below!
–Links– Patreon: https://www.patreon.com/turtywurty Discord: https://discord.gg/BAYB3A38wn Github: https://github.com/DaRealTurtyWurty/1.19TutorialMod Trello: WIP
For anyone confused: This is a re-upload as I uploaded the wrong video previously 😂.