Hello welcome back to the timber forge today i’m going to be showing you how to make custom blocks such as these two blocks right here there are two methods that you may need to use depending on if you are using a transparent base block or not And i will show you how to use both i’m going to go over everything that you need to know such as the place commands removal commands and how to customize it to make it your own as always there will be a table of contents down in the description below With time stamps for you to skip around to find exactly what you need to know if you have any questions feel free to leave a comment or join the discord down below where we have an active community of lots of helpful people who are very knowledgeable about data packs So here’s the basic rundown of how the system is going to work so first of all we’re going to be using an item frame in order to display the model we can’t actually have full-on custom blocks in minecraft so we have to use an entity to display our custom model that we add Through our resource pack if you don’t know how to make a basic model check out my blockbench video but i’ll show you the settings to be able to create an mc stacker command which will give you an item frame which will already have your custom model inside of it just like this So right now there’s an invisible item frame which has a custom model inside of it which is this block so once we generate that we will also have a command which will detect that we placed any of these item frames down and then we will set the block to Whatever block we want and then once we place it we’ll be able to detect when the player breaks that block and once that block is broken we will have our commands kill the display model item frame and then we will also have it drop the item for the Player to pick back up again depending on what block you’re using you may have to do a different method but i’ll show you two methods that you’ll use depending on what block you use so if you have a transparent block like glass you’ll see that the model has no errors if i Set it to glass however if i set it to stone you will notice that the model becomes all dark and we don’t want this so we have to have a workaround if you are using a full block model before we get on to creating the commands for our custom block Let’s first choose our base block since we can’t add true custom blocks we’re going to have to choose a base block that will act as the functionality and the hitbox for our custom block and there’s a list of things to consider starting with function for example you could use a dropper for Custom crafting by using its 3×3 grid or using a chest or barrels for its inventory if you’re doing custom storage remember you could always add more functionality later on but it is easier to sometimes use the built-in functionality like guis and crafting grids if function doesn’t limit you too much You could move on to size shape the base block that you choose will transfer its hitbox over to your custom block so just be careful that you choose something that matches you might also want to match the tool type slash level because if you’re making a stone type Block you want to make sure that a pickaxe is the appropriate tool something that isn’t too important but you might want to consider is explosion resistance choose something like obsidian or end stone for strong resistance and something like dirt or quartz for low resistance finally something to note is that the Destruction sound and particles of your base block will transfer over to your custom block so if you’re doing a dark glass block you probably don’t want to choose something like quartz which is bright and has a stone sound so first let’s generate the give command for your item frame So what you want to do is go to mcstacker.net click on slash give and then start putting in your settings so of course the item that we’re going to do in the give command is item frame and you can set the name to whatever you want so i’m just going to put lucky Block and of course as always you could customize the color and lore and everything like that but what you really want to make sure you have is custom model data i’ll show you how to configure the custom model at the end of the video but for now let’s get the functionality going So we have all of these numbers here this is just my random custom model data number that i happen to use and then after that we want to make sure that it has the item inside of it and this should be the same item because we’re going to be using the same model For the display in your hand as the display on the actual block so set the internal item as another item frame and set the custom model data to the same number and then after that you want to make sure that the item frame that you will place down Will be invisible and invulnerable so make sure you turn invulnerable to true invisible to true and turn on fixed and if you read this here it just means that if the block that it’s sitting on is destroyed it will still remain alive and we want to make sure that it Can survive independent of its surrounding blocks so we just have fixed to true and that should be it so now just copy this command so before you use it make sure you change this one thing so let’s paste it in here and as you’ll notice on mcstacker there isn’t a spot to put Your entity tags for your item frame so what you have to do is add it in yourself so go into entity tag and right after the first bracket of entity tag you have to add in your own entity tag for your commands to detect later on So capital t tags colon and make sure it’s plural tags and then two square brackets and then add a comma and then inside of here put quotation marks and add your own custom entity tag for me i’m just going to do lucky block and we will use this tag in order to detect The item frame when it is placed down you also want to add silent 1b to make sure that the entity is silent when you place it down so you don’t hear the squish of the item frame and you could use the custom sounds that you could add inside of your place Function so now that we have added that into the load json file what you’ll see is when you reload you should receive your lucky block and when you place it down it should display properly now yours might just look like some random thing sitting on the ground but I’ll show you how to properly configure it later on but as long as you place it down and you see your model sitting on the floor then that means you are good so now that we have it placed down we have to get the actual hitbox What you want to do is first create a folder and this goes for both methods if you’re using a full block or if you’re using a transparent block so create a folder and just name it as whatever your block is so i’ll just call it lucky block And then inside of lucky block we’re going to need two more files so we’re going to do place.mcfunction and as always you could add this through vs code or whatever code editor you’re using or you could manually create new files so we want place.mc function and remove.mc function So now that we have these two you could they’re pretty self-explanatory the first one is going to place the block and the second one is going to remove the item frame after the block has been destroyed now that we have the two functions set Up what we can do is run them from the main function so what we want to do is detect any fresh item frame so execute as all entities and then the type equals item frame because that’s what we’re trying to detect and we want it to have that custom tag That we just added so if your tag was lucky block you would put lucky block it just has to match whatever you put right here so i do tag equals lucky block and then you want to make sure the block has not been placed yet so i’m going to do Tag equals not exclamation mark means that it doesn’t have the tag and then placed and we’re going to add this tag to this item as soon as we place the block to make sure that we only run it once so execute on all of our custom item frames that have not been placed Yet or where the block has not been placed yet then at s which means at the position of the entity we’re executing as which is the custom item frame then we want to run function function and we want it to be whatever our function is so for me the name space Is custom blocks so function custom blocks colon and then lucky block lucky block slash place so now what should happen is as soon as we place it it should run place.mc function and inside of here what we want to do is set the block so we’ll do set block At the current position because place.mc function is being run as and at the position of custom item frame so set block at this position to whatever transparent block you’re using again i’ll show you the system if you’re not using a transparent block right after this so set the current position to glass and Then now we are going to do tag at s add placed so that’s why we were detecting if it has not been placed here yet because we only want to run this mcfunction file if the block has not been placed yet and inside of here of course you could Always add your own particles and sounds so let me just find some particles real quick so let’s see particle i’ll do like cloud or something and then we’ll do speed of 1 10 let’s say so i’ll just do that and we’ll get some particles so now what should happen if i reload is That it should place the block and it should do some particles see as you can see it placed the block and it did particles so now what we want to do is when we break the glass it should kill the item frame automatically so what we want to do is go back into Our main function and create something to run the removemc function so we want to do execute as all entities again we want to make sure it’s the type of item frame and we want the tag to be our custom tag that we have to identify our custom Block and then tag this time we want tag equals placed because we want to make sure that we’re only checking for the block if the block has already been placed by our commands so then at the position of the custom block and then unless the current block is minecraft Glass or whatever block that you chose inside of place.mc function then we will run function custom blocks lucky block remove oh lucky block slash remove so now that we have removed the mz function actually running properly we can focus on the actual commands so there are three main parts inside of Remove.mcfunction that we want first we want to summon the drops that we want the player to receive so in my case i’m doing a lucky block and i’m just going to do for the sake of example drop the lucky block itself then you want to kill the block drop so I’m doing a glass block so in case the player breaks it with silk touch i want to destroy the glass block because i don’t want them to receive that glass and then kill the item frame so if you’re just going to have the player receive the block that they placed Then you basically just copy over your give command and instead of giving the item you’re creating a summon command for an item entity and then just copying over all their information and nmc stacker just copy it over into the summon here and you probably want to summon it like Half a block up so it summons in the middle of the block instead of right on the floor and also don’t forget to copy over from your give command your silent 1b and your tags that should make sure that your item is identical so now you want to kill the block drop So for my example in case there is glass nearby from a player using silk touch so kill at e type equals equals item colon id minecraft class distance equals a distance of two sort equals nearest limit equals one now if you want you could also add a silk Touch detection but i’m too lazy to do that and it probably really doesn’t matter and then finally for killing off the item frame just kill at s so now if i go into the game and reload you should see that when this is placed and broken it actually destroys the model and Leaves our item on the ground for creating blocks that have a space block that is fully opaque such as stone furnaces or dispensers you’ll have to do a different method than using a normal item frame because like i showed earlier it’ll just get dark so instead of using an item frame what You want to do is use an invisible armor stand that is on fire because when entities are on fire they light up and as you can see this is a solid block of stone if i remove this and use the pick block you’ll see that i get a stone block in My inventory because this is a solid block so i’ll show you how to use a flaming armor stand instead of item frames wait the majority of this video was filmed before 1.16.2 and a change has been made which i need to go over regarding armor stands and their models The issue with using armor stands is that the block model completely lights up even when in the dark in 1.16.2 pre-release 3 the issue that caused the dark armor stands when in opaque blocks was supposed to have been fixed however there’s a bug preventing it from Being fixed properly i will leave a link to the bug tracker down in the description below if or when this bug gets fixed i will leave a comment down below and i will also edit the description so go down there to check if it has been fixed If it has been fixed then you do not need to use the fire tag and that means that the block model will properly match the surrounding lighting for the example opaque custom block i’m going to be creating a ruby ore block so the give command is practically the same thing of course Just changing the name and changing the tag making sure that you add the entity tags and the silent 1b and after that everything is basically the same then onto main.mc function i basically kept everything the same here however what you want to make sure you do is instead of detecting item frame both Times and detecting if it has been placed or not since we’re replacing the item frame with an armor stand we could detect that instead of having to bother with the placed tags so execute as the custom item frame that has a tag of ruby ore meaning we just placed it down Then we want to run the function for ruby or place and then after its place it will have been swapped with an armor stand so then we just execute as that custom armor stand that has the tag of ruby or unless the block has still been in place So it will only run if it has been destroyed then we will run the function of removal so inside of place.mcfunction we have a similar concept but different commands so what happens here is of course we set the block to stone after we place the item frame but instead of marking the Item frame as placed we are replacing it with the on fire armor stand so what you want to do is execute positioned 0.5 blocks forwards that that just means that it’s going to be aligned with the block because when you place an item frame It’s on the side of the block so if you go half a block forwards you’re going to be directly in the center of the block and that’s just to get a consistent position every time so that when you do a line x y z It’s just going to align on the x y and z axis when you can summon the armor stand and the whole point of this is just to make sure that you have a consistent point of summoning for any orientation of the item frame so that it will always orient The model properly so go to mcstacker’s summon section and create a summon command for the armor stand some of the settings that you want to make sure you have are make sure that small is true marker is true invisible is true and then also add in Your custom entity tag so for me it was ruby ore then in the head slot make sure you have the item frame with the custom model data it’s the same one that you were using for the placing of the custom block and then you also want to make sure that you have it On fire so go to fire here and keep it on ticks and just type in like 9 million and then after that you can just copy it over so you just copy and paste that here and you should be good so now what happens is it will set stone It will execute a little bit forwards and then align with the grid so you get a consistent summoning point and then summon your flaming armor stand that’s invisible with your proper model on its head and then it will kill off the item frame so just add kill at s So that should solve your dark model error when using opaque blocks now when i place down my ruby ores you’ll notice that they appear to be properly lit so you’ll also notice that they were silent when i placed them down and that’s because of the silent tag That we added so you don’t hear the squish of the item frame but of course you could go into your dot mc functions and just input whatever sounds you want into here so you could completely customize the place mc function and the remove mz function and it’s not limited to just custom Particles and sounds either maybe if you have a larger structure that you want instead of just a single block you could also use the play stylemc function in order to generate that larger structure now i’m going to show you the settings that i have for both the item frame and The flaming armor stand method of custom blocks so first of all i have a 16 by 16 basic cube here and this will work even if you don’t have a perfect cube all you have to do is make sure that it’s centered on this grid then in display for the item frame of Course you have to go to the frame slot because that’s the important display method and change this so that the translation is negative 16 on blue and negative 90 on red and then for scale go to 2.01 on all axes and then of course for ground and first Person and everything like that you can just change it to be however you like then for ruby ore it’s slightly different since we’re using an armor stand so again same thing 16 by 16 by 16 centered on the grid and then display go to head because that’s where we’re displaying it on the Armor stand and choose a small armor stand for the reference model just because you’ll be able to see how it works and as you can see it’s offset onto the corner because that is how the align xyz worked when we summoned the armor stand and then translation change it to negative 18.25 negative 14.75 negative 18.25 and then scale 2.3 on all axes and if you input all of those settings depending on which method of custom block you’re using it should properly display your model on the block as if it were a normal minecraft block the final thing i want to say is that The commands and methods that i’ve shown here today is just one way to create custom blocks i encourage you to expand on these ideas in order to fully customize your custom blocks into whatever you want it to be such as the anvil dropping lucky block from the beginning of the video which i Created by just adding three fill commands you can also combine the custom block system with many other data pack concepts such as loot tables predicates and advancements in order to create a very complex data pack [Applause] You Video Information
This video, titled ‘Easily Create CUSTOM BLOCKS! || Minecraft Data Pack Tutorial 1.16’, was uploaded by Timber Forge on 2020-08-18 16:58:45. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
Custom blocks are a really fun and useful feature that can be created with data packs. In this video, I go over two similar methods …