Let’s add drops to our blocks with loot tables Minecraft modding courses with close to 100 topics ranging from Custom tools and armor to custom block entities all the way to custom mobs Linked In the description below oh really fences back until everyone’s more and in this tutorial we’re gonna be adding a custom Loot tables to Minecraft and our mod and loot tables basically determine what is going to be dropped for example when you destroy a block or they can also determine other things like what types of items are going to be inside of luge chests right in certain structures what Different entities drop all of those things governed by loot tables and in this tutorial we’re first of all going to add the loot table to our custom blocks and then there’s a second part of this tutorial where we’ll actually have to also add our blocks to a certain tag In order for the blocks to actually drop something but one step after the other first of all you need tutorial mode data folder we can right click new directory called loot underscore tables make sure that this is written correctly loot underscore tables exactly like this nothing else and inside of that folder Another folder called blocks please make sure that this is done correctly I’ve seen Every Which Way that this has been written wrong it has to be data folder tutorial mode or your mod ID load underscore tables and then blocks and then here in this case the name of the Json file actually once again has to match the name given right here in the modblocks class so Ruby underscore block and raw Ruby underscore block let’s start with the Ruby blocks let’s create a new file over here Ruby underscore block dot Json here in this case there You go and once again I will just type out the contents here and then we’ll go through and see what all of this craziness is so first of all this is of course once again a type and the type here is a Minecraft colon block because This is a block loot table we then Define some pools so pools is once again a list here in this case or an array and in this case we will only Define one pool and the pool has zero bonus rules bonus rolls of zero and then conditions Are going to be a standard condition and that is going to be condition Minecraft colon survives underscore explosion after the list of the conditions you then Define entries in this case we have an entries list over here we’re going to have a one entry that is going to be of type Minecraft Colon item and the name of this item is going to be tutorial mod colon Ruby underscore block and this whole thing is done with the number of rolls of one awesome the first question you might ask is what the frick is this condition well the condition basically just means that the Ruby block Will also fall when an explosion destroys this block should be fairly self-explanatory and what is going to drop is exactly what we Define in this entry over here and that’s the Ruby block I highly recommend checking out either the loot table fandom Wiki article over here or the loot table Generator for misode which is going to be very useful indeed as long as we don’t have the data generation that’s going to make the loot tables about a million times easier those basically tell you a bunch of stuff that the loot tables can contain and what everything Means I will link those in the description below but just like the recipes of course give access to all of the loot tables in the external libraries which is going to go down all the way here to the Minecraft merge project and we will look in the data Folder Minecraft loot tables we are going to go into the blocks folder and here we go every single loot table for every single block that exists in Minecraft it couldn’t be easier how to Planck’s drop well I mean they literally drop exactly the same way as the Ruby Over here they just drop themselves right so most of this stuff is going to look very similar the only things that might look a little bit different are ore blocks let’s cover first of all the raw Ruby block for this we’re just going to drag the same adjacent file into the Same folder while holding Ctrl and we’re just going to rename this to Raw Ruby block and similar here this is just the raw Ruby block as of right now your blocks will still not drop something because they have the block setting inherited from the iron block that is Called requires tool and if requires tool is called on your particular block that means that it can only be mined or it only will drop something if the correct tool is going to be used for this and for that you need to add this to a tag now in the highest level Overview tags are simply collections of blocks items or sometimes some other things that have a similar purpose and in our case we need to add our blocks to a minable tag that’s going to determine whether or not it can be mined with a pickaxe an ax a shovel or a hoe and we Can also add it to a needs extrude tag which basically determines whether or not it has to have a certain tier of tool to be minable this happens in the data folder again but this time instead of the Minecraft directory inside they will make a new directory called Tags And inside of there once again we want to make a new directory called blocks and lastly we also want to make another new directory called minable now in the mindable folder we’ll create four Json files this is going to be the ax.json I’ll already put the Json file contents In here so you can see a Json file is very very straightforward it’s just the curly brackets then a replace faults and then a list of values this time it’s empty because I just wanted to copy over this Json file for all the other tags that we need because it’s quite a few Actually so when you have this you can of course also take a look at all the Json files in the description below in the GitHub repository and what you can do is we can just drag this into the same folder and we can call this the pickaxe.json and then we can drag this Into the same folder again once again while holding Ctrl we can call this the shovel and then lastly the whole and then there’s extremely important the other ones traded in the locks folder not the minable folder so we drag this into the blocks folder this time I’m Going to call this the needs underscore iron underscore tool and then once again dragging this into the blocks folder needs Diamond Tool and this actually also needs Stone tool so those are the different levels if you want to require nether right or higher what you have to do is You have to do this in another folder is a little annoying but it is what it is so in the data folder right click new directory called Fabric and then inside of there we want to make a new directory called Tags and then another new directory called the blocks and then Inside there we can make the following Json file and that’s the needs underscore tool underscore level underscore 4. and the needs underscore tool underscore level underscore for Json file under the fabric folder here that’s quite important that one basically allows you to make your block only minable with netherrite let’s start With the pickaxe Json because in our case well obviously the Ruby block in the Raw Ruby block should only be minable with a pickaxe here so we’re going to add those tutorial mod colon Ruby underscore block and then similarly the second one is just going to be the Raw Ruby block there we go in this case if we leave it like this now our Ruby block and our raw Ruby block can be mined with any pickaxe including it will wooden pickaxe if we then say you know what I actually want my raw Ruby block To only be mineable with an iron pickaxe then we just add it right here and then for example maybe we say you know what and then I only want my Ruby block to be minable with a stone pickaxe let’s say there we go now this is going to be done Do keep in mind that when you have the need Stone tool for example your Ruby block now would also be minable with iron diamond and netherride and anything above it so it always is basically this particular two level or higher I do not believe there is an easy way to make This function a different way just keep that in mind and with this way the Ruby Rock and the raw Ruby block given the correct tools will now drop something and we’ll actually take a look at this and then we’ll take a look at the ores As well but first of all let’s go into the game and see our blocks drop something all right fine stuff in Minecraft and I’ve prepared all of our blocks over here and I’ve also prepared well some of my pickaxes so in this case neither the Ruby block nor the raw Ruby Block should be mindable with a well normal pickaxe here in this case a wooden pickaxe and you can see it already takes a really long time and there’s a very good indication that this is probably not going to work but we’ll just let this run through and there we Go nothing dropped if I use a stone pickaxe however let’s see this is a little bit faster and there we go a Ruby block drop awesome now the raw Ruby we defined only being able to be mindable with a iron pickaxe so if we use Stone Right here it is okay in terms of speed but you will see it is not going to drop anything there we go got nothing however with an iron pickaxe it is going to drop awesome and of course also with an ax this does not work you can see it is already Taking way too long like you would probably never do this similar with this one right here even with the never light ax doesn’t work however higher tiers such as Diamond that works totally fine and then similar netherride also works totally fine for all of our blocks here As I’ve said the tools here that you define is always the one that it needs or higher than that and now let’s also take a look at some ore so for this I will be copying over four different blocks that we’re going to need and what I mean by copying over is I’m going to create one of them and then the other three I’m just going to well basically copy over all of the code is of course available to you in the description below so no worries at all so you should Be totally fine all right so to add ore we’re just going to do a public static final and there’s going to be a block once again this is going to be the Ruby underscore or this will be equal to the register block method I’m going to call This the Ruby underscore or right here now instead of a new block this is going to be a new experience dropping block here in this case and the first parameter of which is just going to be fabric block settings dot copy of and we’re going to copy block start Stone we Can then also Define the strength over here this is just going to be how long it’s going to take to actually break this particular Block in this case so maybe we want this to be you know taking a little bit longer than stone stone for reference over here we can take a look At this has a strength of 1.5 so maybe we say that this has a strength of two and then after the first closing parenthesis after the strength over here we then also wanted to add a uniformind provider dot create and this is going to determine how much experience this block Will drop when you actually destroy it so for example we’re just going to choose between two and five over here ended with a semicolon here at the end and then your Ruby or has been created to double check the vanilla values of the ore blocks just middle Mouse one Click on the experience dropping block over here middle Mouse one click here again and in the blocks class you will be able to find lapis for example or Diamond let’s just take a look at lapis at the very end over here we’ll be able to find that lapis drops between 2 and 5 As well and we can take a look at the other ore blocks as well so for example emerald ore that’s going to be in 628 in see that one drops between three and seven the numbers those are always things that you have to take a look at yourself and basically change in Whatever which way you like to balance your mod properly but that’s going to be a good idea here for the moment I don’t want to end with Ruby or no no I want to duplicate this four times so just select it press Ctrl D to duplicate and I also Want the Deep slate Ruby ore of course very important that we change the name right here if you do not change the name inside of the register block method that you give it then we will run into an error and the actual game will not start Here we of course want to copy the blocks.deep slate in order to get the Deep slight sounds and the strength might be 4 because it’s a little bit hard we are also going to get the nether Ruby ore this is going to be the nether Ruby ore there we go And this is of course going to copy well Netherrack and maybe this is actually a little bit of a lesser strength because Netherrack is not really that strong and then lastly we have end we have end stone ruby ore and of course changing the name here as well and stone ruby ore And this is going to be copying the end stone block and here once again maybe with a little bit more strength because why not you can of course also play around with the in providers over here so for example oh the end or that’s going to give you way More experience because the wall is way crazier and way more harder way harder to get to the end to actually mine this ore so there you go that could be one of the reasons why you would do that there we go I’ve added all of the oars to the Creative mode tab this really shouldn’t be anything crazy let’s just add the translation all of this should be fairly self-explanatory at the end of the day it literally is just changing the name right here and then changing whatever the translation is it should be pretty trivial at this point then of course now To have the blocks properly added yes we do need to add all of the Json files that is a little bit of annoying thing but like I said just give it a few more tutorials and then we’re going to add this in record speed yes in this case we Do need to copy them over now I’m going to cheat and I have already prepared them and I’m just going to copy them over like this but you can see the contents of them are literally exactly the same compared to the Ruby block and the raw Ruby block so really it Shouldn’t be any issue at all and of course the contents you can always take a look at those in the GitHub repository as well alright the textures here as well and those are of course always going to be available to you for download in the description below and Now to the interesting thing and that is adding all of them to the tags so of course we can just add all of them to the pickaxe tag because all of those four ores would be minable with the pickaxe so there we go basically just Add it to the pickaxe Json file and now let’s just play around with this a little bit so let’s for example say that the End Stone can only be mined with netherrite here so we’re going to add this to the neat underscore tool underscore level underscore for Json File in the data fabric tags blocks folder over here very important and we will be able to see that we can only ever mine this with a netherride pickaxe or higher if we add custom levels and see that in a future tutorial as well and then let’s say for example that the Deep State can only be mined with diamond here for example and now while they can be mined well they won’t drop anything yet because we still haven’t added the loot tables so you can see there is a little bit of a process over here but like I said once we go through This once you understand you have to understand sort of what the process is right what are loot tables what are they good for what are tags what are they good for what do they do especially the minable and the he needs you know X tool tag after you’ve understood what all of Those do then we’re going to be able to make them way easier with datagen but for the time being it’s a little bit more of an involved process and for the ore blocks what I recommend is you go to the external libraries once again down to the emerge project over here to data Loot tables blocks and you just take a look at for example the copper ore one now this one will actually shock you I’m gonna open this and you’re gonna be like oh my Lord what is all of this craziness absolutely not to worry we’re just going To copy this over so select it press Ctrl C to copy it and then Ctrl V pasting it into the correct folder over here I’m going to rename this to the Ruby or and then we just need to make sure that we change everything in the correct places so for example here where It drops the copper ore when we use silk touch we want it to drop tutorial mode colon Ruby underscore or and then down here instead of raw copper we wanted to drop raw Ruby of course making sure we also change Minecraft over here to tutorial mode this is extremely Important and then down here we’re just going to call this the tutorial mode blocks Ruby orb awesome and now we can just duplicate this a couple of times this is going to be the Deep slate underscore Ruby ore and then there’s going to be the Deep slate Ruby ore and For the raw Ruby that’s still going to drop and then here you can of course see this is a uniform distribution so it will drop between two and five you can of course change this you know so for example you might say oh for the website it should drop between three and six Something like that you can always of course change the numbers highly recommended to try this out and and just play around with this a little bit alright and just for the sake of argument I’ve also added the Nether and the end stone ruby or block loot tables Once again you can take a look at those in the GitHub repository and now we can go into the game we can see our ore and we can see them drop something when we mine them alright here we are in Minecraft and let’s just try and mine Our ores and you can see there we go so that works no worries at all diamond pickaxe or the Deep slight also works for the nether also works but here it should not work because the N Stone should only be minable exactly with netherrite and let’s take a look and Then we go so absolutely Works no worries at all absolutely amazing we got our ore drops they drop our raw Ruby they drop experience absolutely freaking fantastic right that’s gonna be it for this tutorial right here next time we’re gonna do an advanced item very cool Stuff take a look at it here and I hope to see you there so yeah Video Information
This video, titled ‘Fabric Modding Tutorial – Minecraft 1.20: Custom Loot Tables | #5’, was uploaded by Modding by Kaupenjoe on 2023-07-18 14:59:47. It has garnered views and [vid_likes] likes. The duration of the video is or seconds.
In this Minecraft Modding Tutorial for Fabric, we are adding Custom Loot Tables to Minecraft 1.20 🙂 == MODDING COURSES …