Let’s modify vanilla tables and add custom items to vanilla drops new topics added to the fortune fabric courses such as table and writable entities projectiles throwable projectiles and boats as well as first steps to biomes and dimensions courses Linked In the description below all right we found us back in each other Once more and in this tutorial we’re gonna be adding a custom drops to well vanilla loot tables and this is done via Global loot modifiers now one very important thing that we need to do is we need to navigate to the Gradle dot properties file and if you are on a version 47.0.45 or lower you need to update to at least 47.0.46 otherwise drops for entity systems are not going to work now we will actually update to 47.1.3 because from all I’ve heard is this is going to be the last version that neo4 is going to be compatible with Now I have not yet decided and because this is a development that’s still unfolding I’m gonna probably stick to just saying you know 47.1.3 is fine if you are higher than that you should be good to go as well in theory but I’m gonna stick with this version and yeah Let’s just update let’s hit the reload Gradle changes over here let us run through this might take you know once again a minute two minutes depending on how fast your PC is and all sorts of other things just let this run through and once you get a build successful we Can proceed from there there we go build successful in one minute 58 seconds and we can now proceed first of all in the tutorial mod package we’re gonna make a new package called Loot and inside there we’ll make a two Java classes the first one is the mod loot modifiers and the Second one is the add item modifier class there we go I’m going to start with the add item modifier this will extends the loot modifier from netminecraftforged common loot over here we’re gonna hover over this implement the methods over here hover over this again create Constructor matching super We don’t need the Java dock over here that’s going to be fine and also we need to make this public there we go that’s gonna be awesome and then we can proceed so first we need is a codec now I will just be copying over the codec over here The add item modifier is a custom class over here from me that basically just allows you to add one item to a specific loot table here in this case and this should always be the same in the Constructor you want to add an item parameter and then you want to say this Dot item is equal to the item parameter and that should be that in the codec you can then return codec dot get and then the most important things are happening in the do apply method because the idea is that when a specific loads table is generated the generated loot right here These are the item Stacks that are actually going to drop and you now want to return the exact same loot table right with maybe some changes along the way so for example what we could do is we could say hey generated Loot and because this is just a list we can say Hey add a new item stack of our item this start item and there we go and with this we’ve added the item that is specified over here to our loot we’re going to specify for what loot tables this happens in just a moment of course But that is one of the things what we also want to do and this is just a good idea is we want to make a for each Loop for each loot item condition over here that’s the condition for this dot conditions and we’ll say if the conditions test and then passing passing In the context over here if they’re false then we’re just going to return the generated loot this basically allows us to also add item conditions or loot item conditions to our Global modifier and then basically add things like the random chance or similar things like that and that’s actually the entire Class that we need right here we can then proceed to the model loot modifiers class where we will need a public static file deferred or register of type codec of type question mark extends extends iglobal Loop modifier this is the loot modifier serializers which is equal to a deferred register.create Forge Registries.keys dot Global Loop modifier serializers and then tutorial mod.mod ID and whether it’s the Deferred register there also is a public static void register method passing in an i event bus called event bus and we’ll say loot modifier serializers that register passing in the event bus parameter here There we go and let’s immediately call the register method right here and be mod loot modifiers.register passing in the mod event bus there we go and now we’ll make a public static final registry object of a type codec of type question mark extends I Global load modifier over here this is the add Underscore item equal to loot modifiers serializers register I’m going to call this the add underscore item and this is the add item modifier dot codec awesome that is it this is the modifier registered and now crazy enough we can do everything with custom datagen let’s go so basically in the datagen package We’re going to right click new Java class called the mod Global load modifiers provider an insanely long name for a pretty cool class this is going to extends the global Loop modifier provider hover over this implement the start method and then hover over this again create Constructor matching super We can delete the mod ID from The Constructor because of course we know our mod ID it is tutorial mode dot mod ID and now in the start method we can call the add over here we’re going to add a name for the modifier so let’s for Example say what do we want to do well how about we get the pine cone over here maybe from grass I mean it’s not like the most specific thing but why not pine cone from grass let’s say right and then for this we’re going to make a new a new Item modifier right here with the following loot conditions so we’re gonna make a new loot item condition array over here this is exactly correct and the way that this is going to look like is as follows so so inside of the curly brackets we’re going to build the Following we’re going to make a loot item block State approach property condition has block state property and we’re just going to say blocks.grass this is the grass where seeds drop from so keep that in mind that build and then we can add multiple ones right so after The build you can do a comma and then for example we want to say loot item random chance condition that a random chance and let’s say the probability is 35 that this drops that build again and then after the closing curly bracket you would then want to specify which item it Is so now we’re back in the add item modifier Constructor and there’s going to be moditems.pinecone.get and that is literally it this will now add a Json file that’s going to add our Pine code with a 35 chance to the grass block drop and we can do something similar let’s Copy this over and for example say maybe the Pinecone can also drop from a creeper because why not then what you want to do is instead of a a property over here what we’re going to do is we’re going to make this 100 percent so so we’ll not have the random chance over Here but what we will have is we will have a new loot table ID condition Builder with a new resource location the resource location is entities slash creeper and once again call Dot build over here and there we go now with a 100 certainty the pine cone is added to the Creeper where do I get this resource location from well once again you can go to the external libraries over here all the way down to net Microsoft client extra one a 20.1 or whatever your version might be data Minecraft loot tables and then right here this is the Root directory and you can see entities and then creeper is right here and you can add it for all of those basically so the similar thing would work for chests so let’s duplicate this again and let’s say this is not the pine cone but this is the metal underscore detector Underscore from underscore jungle underscore temples there we go and then instead of entities creeper this is now actually chess slash jungle underscore Temple people of course always double checking that the name over here the resource location is written correctly and then instead of the pine cone this Is going to be the metal detector and we’re going to do it with 100 certainty again because why not and that’s basically it this is the idea of the summer that you can add as many as you want and now we just need to make sure that the global modifier over here the Provider is also added but that is as simple as going once again to our data generators over here to the very bottom generator.adp provider event dot include server and then a new mod Global load modifiers provider passing in the pack output and that’s it if we now run our Data over here everything is going to get generated well basically automatically so we don’t have to do anything else but create that class and there we go if you want different modifiers so basically instead of an item you want to put in an item stack or Maybe instead of one item you want to add two items you can of course add your own custom modifiers over here you can also remove things from this I highly recommend against it this is a normal list so you can clear the list if you wanted to I just wanted to caution you Against that because you know changing too many things might make your mod not compatible with other mods so do keep that in mind but we can now see data and a data tutorial modifiers we have our modifiers over here and under Forge we have the loop modifiers basically all in There so that’s going to be fine so we can now jump into the game and see if it works all right finds us back in Minecraft and let’s just see if the creeper is going to spawn our pine cone and there it is a pine cone added right There and if we switch to survival mode and we break some grass you can see there we go we actually got a pretty luck in the first one because it’s only a 35 chance might be too high by the way but you can of course always change the Numbers that is a thing that you can always keep in mind and then let’s actually go and actually search for a jungle temple as well and in the jungle temple we can see the metal detector absolutely freaking awesome and that is a modifying vanilla loot tables as Always of course all of the code is available to you in the description below and next time we’ll actually add stuff to assist suspicious sand so go right ahead and take a look at it right here hope to see you there so yeah Video Information
This video, titled ‘Forge Modding Tutorial – Minecraft 1.20: Global Loot Modifiers | #18’, was uploaded by Modding by Kaupenjoe on 2023-08-30 14:59:50. It has garnered 426 views and 21 likes. The duration of the video is 00:10:02 or 602 seconds.
In this Minecraft Modding Tutorial, we are modifying Vanilla Loot Tables with Global Loot Modifiers (GLM) in Forge for Minecraft 1.20.X 🙂
== MODDING COURSES == FORGE ▶️ https://url.kaupenjoe.net/CourseForge120X FABRIC ▶️ https://url.kaupenjoe.net/CourseFabric120X
== COMPATIBILITY == ▶️ Compatible with 1.20 & 1.20.1
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.20.X/tree/18-globalLootModifiers
== SUPPORT ME ON PATREON == ▶️ https://url.kaupenjoe.net/patreon
== 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 ▶️ NEW Fabric Modding with Minecraft 1.20.X: https://url.kaupenjoe.net/CourseFabric120X ▶️ 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 *
== SUPPORT ME ON PATREON == ▶️ https://url.kaupenjoe.net/patreon
== 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.
== ADDITIONAL CREDITS ==
== 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