Let’s add a full armor effect to our mod 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 oh really fences by consider once more and In this tutorial we’re gonna be adding a custom full armor effect to our mod what does that mean basically if you’re wearing a full suit of armor of all of the same material then you’re gonna get an armor effect applied to your character and to do this we’re going to Make a custom new class that’s going to be in the item custom package and this is going to be the mod armor item here in this case and will extend the armor item class so this is the armor item class there you go I’m gonna hover over this quick Constructor matching super And now the implementing when it comes to the implementing I’m going to copy over sort of method by Method All the code here is of course Link in the description below and the mod armor item class is also linked as a gist for easy access it is fairly straightforward and Is actually not that complicated and we’re going to go through and explain everything so first of all we have a material to effect map what does that mean well here we put in the custom or material that we have and then here we make a new status effect instance of Whatever effect we want to apply with the duration its amplifier than ambient particles and true basically just whether or not you want to well basically show the particles if you want to show the icon you might might also be like actually I don’t even want to show The icon you can also turn this to false that’s totally fine whatever you basically want to do here and once again this is a normal map so if you have a second armor material literally just do another put over here with the other armored material this only works with Custom materials it is not work with vanilla ones very important thing to know right so very straightforward All Things Considered and then let’s continue we’re going to go sort of in reverse order so we’re gonna go in order of logic so every time I’m going to basically copy something over there’s Going to be an error in there but we’re then going to fix it by adding the other next method that is in there basically the first method to override in here is the inventory tick method and that method gets called every tick that you have this particular item in your Inventory the first thing we’re going to check hey are we on the server right so if we’re not on the client and whether or not the entity that has this particular armor item in their inventory is that a layer entity if this is true then we’re going to cast it to a player And we’re also going to ask does the player have a full suit of armor on in the has full suit armor on in that method we’re actually only checking whether or not the player has all of their armor items while basically filled out so we can take a look at this right Here has full suit of armor on basically we’re just checking whether or not that that the helmet breastplate leggings and boots item Stacks are all not empty and if this is the case then we can continue to the evaluate armor facts method that method looks like this and it basically Goes through the entirety of the material to effect map in this case it’s just one entry however if you had like 12 different armor sets right 12 different armor materials then you of course want to go through this we’re getting the armor material right here as well as the status effect and basically Then just asking hey do we also have the correct armor on basically now we’re checking whether or not all of the different materials of the armor that we have on Match and that method looks like this now the both the has full suit of armor on as well as the has correct Armor on methods could in theory also be done with streams however I personally think that this is totally fine and the logic here should be fairly sound now this is extremely important this for Loop right here you have to have this if you don’t have this then your game is Going to crash if you ever have one of your mod armor items on in your inventory or in your in your helmet slot for example when you for example add an elytra because an elytra is not an armor item and then casting it to an armor Item is going to throw an exception so please pay attention this is needed otherwise it’s going to crash your game and when we basically are sure that the player has the correct armor on then we can confirm and we can basically add the effect material to the player and you Could basically see right here we’re basically taking the player and asking hey do they already have this particular status effect right and if this is not the case over here then we’re going to apply that effect and the effect is applied by making a new status effect Instance and passing in the old status effect instance right there you cannot just use the old one if you use this one then you’re going to get the issue that it’s going to work once and then never again please be sure to copy over this basically by passing it into a new Instance rather than taking the same and that is actually everything that there is to it it really isn’t that complicated you might have to go through this class once or twice more to fully understand it but overall this is fairly you know basic to maybe intermediate Java over here it’s nothing too insane And then the last thing that we need to do we can see that this is great because we’re not using it so any more items one of our custom items over here is going to be now the mod armor item so it’s for example to say the helmet over here is Going to be the mod armor item because we have to have all of them equipped anyway we can designate any one of them you can also designate all of them but usually in theory one of them should be fine because in this case inventory tick Method is going to take for each of them so it’s just going to waste resources if we have this for all of them we actually have added everything that we need so let’s jump into the game and see our custom armor item effect for the first time our offenses are back in Minecraft As you can see the haste effect has been applied to us so that works totally fine and basically if I were to go in and take out I mean any of them right I can also take out the chestplate over here you can see we’re no longer getting the Haste applied again and if I put on the red breastplate you can see bam there we freaking go and we have no particles because well we’ve turned that off and you can also turn off the icon as I’ve previously mentioned so there you go that is the custom full armor effect Added to Minecraft and that’s already for this tutorial right here next time in this video we’ll modify some vanilla loot tables I hope to see you there so yeah Video Information
This video, titled ‘Fabric Modding Tutorial – Minecraft 1.20: Full Armor Effect | #17’, was uploaded by Modding by Kaupenjoe on 2023-08-29 15:01:18. It has garnered 1263 views and 30 likes. The duration of the video is 00:05:41 or 341 seconds.
In this Minecraft Modding Tutorial, we are adding a Full Armor Effect, basically adding an effect when a Player wears the full armor 🙂
== MODDING COURSES == FORGE ▶️ https://url.kaupenjoe.net/CourseForge120X FABRIC ▶️ https://url.kaupenjoe.net/CourseFabric120X
== COMPATIBILITY == ✅ Compatible with 1.20, 1.20.1, 1.20.2
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.20.X/tree/17-fullArmorEffect Gist: https://url.kaupenjoe.net/mbkj79/gist
== 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