Let’s generate some data with data generators back intelligence more and in this tutorial we’re going to be talking about data generation and the data generators here in fabric 119 3 and this is actually a very important topic because this is a prerequisite to I would say properly do World gen in 193 and Probably above so this is very important so please do go through this because the next tutorials are going to be the World Generation stuff and this is a prerequisite for this you will not be able to do the world generation without this tutorial or by making a new package Over here called data and instead of there we need a bunch of classes the first one is the mod loot table generator there we go and then we’re gonna create another class and that is going to be the mod model provider and then a third class which is the mod Recipe generator and then last but not least this is the mod world generator now we will be generating loot tables we will be generating the models so this includes block States and item models and we’re also going to generate some recipes the mod world generator we will Sort of introduce but will not actually do anything with it so this will not do anything but we’ll basically lay the groundwork the skeleton for the model world generator as well right starting with the loot tables this is actually fairly straightforward this extends the fabric block loot table provider this One right here from the API just hit tab to autocomplete hover overall this Implement methods we’ll implement the generate method hit OK we’re going to hover over this again create the Constructor matching super and then inside of this generate method we can now add drops so how does this work well We can think back to our data folder right and we have inside of tutorial mode loot table so we have the citrine block the citrine ore and the Deep slate or block so we can do add drop you can see these are methods that are suggested To us and what you can do is you can also do or so you can see if you start typing in or you can do or drops and you can even say well this is a copper ore drops and a Lapis or drop so this is I Believe it’s with the specific one so if I go in here you can see this is a specifically lapis lazuli but if you just take a normal or one right you can just do or drop and then for example you can say what well what actually drops With silk touch well that’s going to be mod blocks dot citrine ore right that because that’s going to drop there and what drops if we don’t have stock touch well that’s going to be mod items that are citri done that’s it this thing will generate the entire citrine or Json file This whole mess over here now of course if you want to make some adjustments right what type of enchantment level do you need how many how many different raw citrine are going to drop yeah then you need to go into this and actually look at you know what happens here so this or Drops quotes the drops with silk touch method and you can see see this makes a loot pool entry Builder so here you can see here you can change a lot of stuff and you can go further down right like what does this do and it’s like okay This calls the drops method and this creates a roll of a certain number so and so and so forth so this basically you can go down as far as you want just middle Mouse button click on the or drops method and then you can go into This class and take a look at everything but in general you probably want your ores to behave pretty much like vanilla Wars so then this is going to be fine now the same thing just press Ctrl D to duplicate this and this is going to be The Deep slate citrine orb and this also drops draw citrine absolutely fine and then we can add another method and that’s the add a drop over here and we’re just going to say modblocks.citrine block and that’s just going to drop itself and that’s it another mod loot table generators class Is actually completely done this is all the way that we need to do we need to actually make this public that’s actually also quite important and then after that we just need to register it but we’re going to do that at the end after we’re done with all three of them Next is the mod model provider let’s zoom in here a little bit and let’s say extends this will extends the fabric Model provider once again tap to autocomplete implement the two methods over here and we of course also want a Constructor matching super now we have the generate block States model method Over here this one works as follows we take the parameter over here so we stick block State model generator Dot and then here we can generate all sorts of crazy stuff right bamboo block State variant add jigsaw orientation fire floor turtle egg axis rotated so this would be for Things like logs for example right beds we pretty much have everything we even have a crop where was the crop right here look at this this is an insanity right you can put the crop in here you can put the property the age property in here and then you can put different age Texture indices in here depending on the integer absolute Madness everything is in here it is absolutely amazing now in our case we actually only have the cube all model texture pool which we want and this is going to be modblocks.citrine block and we can just duplicate this for both oars as well Because the oars are all Cube all once so this should basically generate the same block State’s Json file that we’ve seen before so this one right here and in terms of item models we want to do item model generator so once again the parameter and we’re just registering mod Items start citrine and this is just models.generated once again we can duplicate this with Ctrl D and then raw citrine also generated and I don’t know what you’re saying this it can be this simple it actually is it is indeed this symbol doing it like this will generate All the Json files that you need for the assets folder this is why the new fabric data gen API is actually just it’s golden it’s absolutely amazing right next to the mod recipe generator now this is a little more complicated but absolutely no worries this extends the fabric recipe provider we’re going to Hover over this again Implement methods the generate method over here once again create Constructor matching super making sure this is public and then we have the generate method now the generate method there’s a bunch of things that we can do let’s take a look at what that is so if We start to do offer you can see there’s an insane amount of methods that we can use now let’s say we want a smelting method right offer smelting you can see this needs a consumer of recipe Json provider well luckily that’s actually what we have here so we’re just going to Pass in the exporter you can see the second parameter that we need to put in is a list of inputs here we’re going to do lists.of right press tab to auto complete this that’s then it’s going to immediately import the list over here we’re going to put in here mod items dot Raw citrine because we want to smelt raw citrine we’re going to say recipe category this would be I’m actually unsure what this would go to be honest with you I’m just going to put this under miscellaneous that’s going to be okay this is the result this is mod Items raw citrine then we’re going to say how much experience you get what is the cooking time and then what group this is so this would be citrine and this is now a smelting recipe akin to let’s see exactly this one so this is in theory now just the experience and the Cooking time is different but that that’s fine so let’s do this 0.7 and 200 and now in theory this right here should pretty much do exactly the same as this which is absolutely amazing there’s another thing that’s absolutely awesome and that is the offer reversible compact Recipe and you can see there’s a bunch of different things and what this does is basically just the idea of taking nine of the same item turning it into a block and then having the block also be turned into nine of those items so once again we’re putting in the exporter the Recipe category is going to be building blocks mod items dot citrine so this is what actually you need line of instead of the crafting table to be turned into the block then this is the recipe category of let’s say decorations because why not and then this is the Result and that is the mod blocks that citrine block and there we go if we want to go into this once again we can just middle Mouse button click and we can go well all the way down until we get to exactly this shapeless recipe Json Builder so you can also use the these builders for yourself so those would be just like anything that you can basically think of so if we do that if we just we’re just going to make a crude example but it will work so we can do shapes shape recipe Builder right here Or shapeless recipe Builder either one so we can use this and we can say dot create we need to first of all pass in a recipe category let’s say miscellaneous over here this is going to be the result yeah this is going to be the output so The next thing we’re going to put in is the output so let’s say we’re getting mod items.raw citrine once again this is this is just just an example right this is not necessarily like an example that’s applicable but it’s just to show you how this works and then this is a Builder so we can just do Dot and we can see we can do all sorts of different things so for example we can put in a pattern now this pattern is actually going to be exactly the same pattern if we go right here nope absolutely not right here though this is this pattern Right here and we want to create this pattern three times so we’re just going to duplicate this and now it’s going to be three strings and this is exactly the same pattern as we’ve seen right here so this is the pattern right now that we’re making so let’s say for example how do We get a raw citrine let’s just say it’s like SSS c s and then SSS and then we have to map this so to map this we’re going to say input and the character of s is actually going to be item start Stone and the input of character C is Actually going to be item start is no mod items mod items start citrine right so if we put citrine in the middle and Surround it with stone we’re going to get a raw citrine once again it’s definitely a you know crude example but it’s still going to hopefully sort of Show how you can make a shape recipe as well and then we can also add criterions so the Criterion the idea there is that you know when you get a new item at the top right you’re gonna see like new recipe has unlocked and that’s basically What this is for so what we can do is we can say fabric recipe provider that has item we can put this an item in there so for example item start Stone right so and then comma and then we’re going to say fabric recipe provider.conditions from item and then The same item as well item start Stone and then we’re going to do a completely the same one so we’re just going to copy this and instead of stone we’re going to say mod item start citrine so basically what I’m usually doing is every different oh mod items there you go so Every single one of the items that I have are going to have their own Criterion so basically if I have stone then we’re going to unlock this and if I have citrine then I’m going to unlock this and after I have done this I can then say offer to Pass in the exporter again make a new identifier of The Following also important fabric recipe provider dot get recipe name and then put in what items dot res dot raw citrine this is always the one that you are creating so this is always the output that you should in Here because then the recipe name is going to be well basically just done properly so you can see it it gets the name of the recipe and then does you know something something from something something so that is the general idea of how the recipe name is then going to be Created and that is a entire shape recipe created like this now you might say well wouldn’t it be easier if I just copy this well yes but once you’ve set this up once you know you can just like duplicate this change a few things there and now it gets generated for you Automatically so I would say that this can be much easier especially if you maybe have a lot of recipes like this right where you let’s just say you have like 20 magic rings and the Rings are basically always created the same just this the middle part of the string is The different or you can just make a you know custom method that literally creates all of those recipes very easily so that’s why this can be like really really useful right and last but not least we have the model world generator like I said we’re not going to generate Anything in the world but we will start with this so this is going to extend the fabric Dynamic registry provider and we’re going to implement the two methods configure and get name and we’ll hover over this again construct matching super absolutely now this should all be fine This is okay we can just change this to tutorial mod.mod ID I’m actually unsure what this get name here does I’ve tried this out and I’ve always gotten the same response so I don’t know and then later in this here here goes future world gen but like I said in this tutorial we’re Not doing this but in the next tutorial we’ll actually need this because we’re going to do tree generation and or generation in the next two tutorials now we have basically the three things that we want to use the loose tables the models and the recipes how do we use Them when we go to our tutorial mod data generator if we downloaded the fabric example mod from the generator website then well there we go now we can use this data generator over here and the way that we use this is we need a fabric data generator that packed and this is Called pack this is equal to a fabric data generator.create pack and then we’re going to say pac.adp provider we’re going to put in mod loot tables colon code new exactly like this and then pack.adp provider model recipe generator colon colon new and then last but not least pack dot add provider mod Model provider colon colon new there we go and that is all that we need for the time being now how does this work how is this going to continue well first of all we can make sure that inside of our fabric Model Json file we have the Fabric data gen to pointing to tutorial mode data generator class this should all be done exactly like this and set up exactly like this if you’ve downloaded the example mod from fabric so that should be fine and now what we can do is we can go to the Gradle tab at the top Right and run datagen and we’ll just see what happens for the time being I we might run into an error which is absolutely fine that can happen and and as actually sometimes even required for this so let’s just let this run through and see what happens all right so we Actually got the one thing that worked so we’ve got to build successful and the most important thing here is all providers took however many milliseconds is basically always the thing that you’re looking out for and now what has happened is that instead of main generated if we open this you can see There’s an assets folder block States models blocks item everything is in here that we’ve generated and if we look at this it is exactly the thing that we had before and even in the data generator you can see in the recipes at loot tables the advancements are just here Because of the recipes basically but if we look at the recipes right we wouldn’t want a citrine so this is citrine from a citrine block generated perfectly we got citrine block absolutely nine citrine yes and you get a citrine block how do you get raw citrine let’s remember we Put Stone surrounding this and in the middle we put good citrine this is exactly what we have done and then here we even got the smelting recipe which is exactly the same as the other recipe that we’ve done manually absolutely freaking awesome and everything works Same with the loot table so you can see this is the citrine block loot table let me actually double check that’s actually very interesting let me double check something so the ore drops for whatever reason did not generate something so that one is very interesting to me I Would expect there to be something there but apparently they did not like that interesting so this is actually correct because those just generate the actual loot table Builder we actually do have to do add drop and we have to say modblocks Dot citrinor and then actually Do this or drops inside of here and that should throw no errors and it absolutely does not perfect then we can do the same thing here let’s just do it like this and then at the front we need the Deep slate ore so this is mod blocks dot deep Slate Citron ore and now it’s generated perfectly fine let’s run this again and now as you can see we run into an issue and the reason is because we have duplicate Json files because we have the same Json file the block State citrine block once right here and ones in our Self-made now what I’m going to do is I’m just going to delete the block States folder and the models folder and we’re also going to delete the loot tables folder and the recipes folder that means I can actually delete the entire data folder for me here so that’s Not the not the fabric and the microphone but the tutorial mode one and just keep the Lang and the textures because this is going to complain for all of the Json files that are doubled and if we we were to run this now now we should have no duplicate anymore so it Should be fine and it should run through totally okay and generate the two new Json files which is going to be exactly the citrine or and the Deep State Citroen ore and you can see exactly how you would expect the two or drops absolutely perfect but I do want to keep In mind when you delete this highly recommend just don’t don’t delete this because you know sometimes there might be an error or an issue here and then you delete it like 20 Json files best case is just like copy them outside of the project and save them somewhere back Them up don’t just delete them now at the top here you can switch back to run client and if you then press the press the Run button then you’re gonna be back in the game with everything working and that’s actually how easy it is to add some custom data generators they can be Extremely useful especially if you have a boatload of items and Json files that you just don’t want to do by hand and also as I said they are a prerequisite for 119 3 plus World Generation which we’re going to see in the next tutorial anyway that’s gonna be it thank you so Much for watching and I’ll see you next time so Video Information
This video, titled ‘Minecraft 1.19.3 – Fabric Modding Tutorial: Data Generation | #6’, was uploaded by Modding by Kaupenjoe on 2023-02-20 16:00:00. It has garnered 6668 views and 144 likes. The duration of the video is 00:17:11 or 1031 seconds.
In this Minecraft Modding Tutorial, we are using the new Fabric Data Generation API to create some Data Generated JSON files. This is incredible useful, and actually needed for further World Generation!
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== COMPATIBILITY == ▶️ Compatible with 1.19.3 and 1.19.4 ⏹️ Somewhat Compatible with 1.20.X
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19.3/tree/6-datagen
== 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