Splish slash and let’s add a custom fluid to minecraft oh right we find ourselves back and tell you once more and in this tutorial we’re gonna be adding a custom fluid to minecraft now this will involve quite a bit of copying and pasting over as sometimes happens in modding over here However i will try to explain each method that i copy over best of my ability and there are also some limitations with the fluid but hopefully those are going to be okay first of all in our tutorial more package we’re going to right click a new package called Fluid and inside of there we need two new classes one of them is the mod fluids class and the other one is going to be our custom fluid and that is going to be the soap water fluid first of all we want to make this an abstract class And then we want to extends the flowable fluid over here and you can see we don’t have to implement anything from the flowable fluid because this is actually an abstract class so we should be totally fine now what we do want is a two static classes in here but let’s Actually start at the very beginning we want to overwrite a few different methods the first one is the is infinite method that one simply is going to return false it should be fairly self-explanatory what this does right if it’s infinite then you could do a two by Two with this particular fluid and it’s going to become infinite then we might want to overwrite the before breaking block method now this one is very interesting because this one is basically called when this fluid flows into a block that could be broken so for example a torch right and this governs The behavior that then happens now what we can do is we can just do this one right here so this would basically just drop the block more or less so this would be the behavior that water has we can by the way also take a look at the Flowable fluid press control h and then take a look at the water fluid for example and you can see it’s doing exactly the same thing over here and you can also which is very important see all of the different things that the water fluid basically has inside of it so i Highly recommend taking a look at both the water fluid as well as the lava fluid classes so you get a better idea of what exactly the values might be whatever the case may be this is the second method and then let’s continue along let’s get the flow speed this is Gonna this is an integer now this should be if i recall correctly this is four for the water so we can just take another look at this slow speed right here you can see there’s a four right here and we can even take a look At the lava and i believe lava and you can see for lava actually the flow speed is dependent on whether or not it’s in the nether basically right so this would be an ultra warm dimension then it is four and if it’s in the overworld then It’s two so that’s the general idea here so hopefully that makes sense as well let’s get some of the other ones in and then we’ll see get level decrease per block we also have the get level we also have get tick rate and then lastly the get blast resistance Which are all the well maybe the different the integer ones or the number ones basically get level decrease per block i’m not a thousand percent sure what this is what i if i understand this correctly depending on your level right here right so maybe you have a level 15 Then this would have 15 different levels that it can take and then per block how many of those levels are you decreasing so if i were to do 15 over here and i have at level 15 the block would actually only flow one level i believe That that’s how it works i would stand corrected if someone has a better explanation for this let’s just put an eight here and a one over here the tick rate i’m just going to put at five once again we can take a look at the tick Rate over here as well so the tick rate right here is 10 in the nether and 30 in the overworld while in water it is five yes there you go five i’m unsure exactly what the tick rate does however once again highly recommend playing around with those numbers that Is always one thing that could be a good idea last resistance is just going to be 100 f i think that that’s going to be okay then we can also override the can be replaced with method which we’re just going to return false over here so it can’t be replaced with anything there’s Something crazy in the lava over here can be replaced with can be replaced with there you go so it’s like so it’s about if the water is at a certain height then it can be replaced with that i am i’m not sure what this really is about but whatever the case May be we’re just gonna say false and that’s gonna be okay then let’s continue with the get still method over here now we’re gonna actually not return null we’re actually going to make a deliberate error over here this is where we actually have to register something And then return it once again but we’re just going to do that instead we’re also going to have the same thing with the get flowing over here same thing applies just making a deliberate error we also gonna do the same thing with the get bucket item once again a deliberate Error over here and then last but not least we also need to do this with the to block state method and that will also return an error and then we should be fine with those methods lastly we also want to override the is still method and We just want to return false i believe that should be fine and then we need two different static classes so we’re gonna have a public static class called flowing this is going to extend the soap water fluid so the class we’re actually in is going to be extending This and then we’re just going to copy this and the other one is going to called be called still there you go let’s then make do the following we’re going to append properties so this is going to call the super that’s fine and then we’re going to say builder dot add And then level over here that’s important we also want to overwrite the get level method and this will return the state dot get level there you go and then lastly is still here is going to be false well in the still class we’re just going to override The get level over here but we’re going to return eight so this is actually going to be the actual level of this particular fluid and it still in this case is true because well this is the still fluid but this might be a little bit complicated right it’s like all Sorts of craziness we have like two static classes well this is pretty much modeled after the vanilla way of doing it you can see we have the flowing class over here we have the still class over here so that’s pretty much all that we’re doing i highly recommend checking Out both of those classes and now we can actually go into our mod fluids class and start to all register some stuff we’re going to need four fields public static flowable fluid this is going to be the still soap water and then let’s duplicate this and this is going to be the Blowing soap water we then need a public static look this is going to be the soap underscore water underscore block let’s import this making sure that we import the correct block class from night mic from minecraft block block of course and then we also need a item class and then We also need an item that is going to be soap water bucket now we’re going to register all of them in the mod fluids class because if i register them in the blocks and the item class then there are some issues with the ordering that’s why i basically Wanted to register them all in here we’re going to have the register method and i will actually just copy over the registration all of this is of course available to you in the description below get up apart from individual just as well but this shouldn’t be anything too crazy you Can see the still soap water is just registry.register make sure when importing the registry class that you register that you get the correct registry class from minecraft net util registry registry make sure of that this is going to be in the fluid registry of course just called soap water and then We’re making a new still soap water but the flowing one interestingly enough it’s called flowing soap water and here we’re just creating a new flowing soap water fluid for the soap water block you can see we’re passing in to the new fluid block here a still soap water so We’re just adding the still soap water it’s called soap water block and we’re just copying all of the settings from the water block lastly we have the soap water bucket where we also just pass in the still soap water here and making sure that we have the recipe remainder Bucket and then we stack it to only one item and that is pretty much it now we can go into the soap water fluid over here and return everything so we can say mod fluids that also water for the flowing we can say mod fluids we can say Mod fluid start blowing soap water for the bucket we can also say mod fluids dot soap water bucket and then last but not least here we actually want to do something a little bit different and that’s going to be the mod fluids dot soap water block that get default state with the properties Dot level 15 this would be the in property and then we’ll just say get get block state level over here and then passing it and then passing in the state and that should be pretty much all that we need to do in this case lastly of course Let’s call mod fluids dot register over here and that is almost everything done there’s one last thing that we want to do and that is register the actual textures for the fluids and then also of course we need to add the translation as well as the model and the texture for The bucket but let’s first of all go into our tutorial mod client over here and what we’re going to have once again i will actually copy this over as well it won’t be too complicated you can see we have a fluid render handler registry over here calling the instance and then Registering both the still fluid as well as the flowing fluid with a simple renderer handler and we’re just using the water textures over here as you can see now i’ve already created here a tint the tint works the following way the first two numbers are actually the alpha Value so how transparent this is and then the rest is just rgb so that’s the idea so this is a rgb so you can just use a color picker to change your color over here and then it’s very important that we also add the translucent render Layer for both the still as well as the flowing fluid so that it actually becomes transparent right it shouldn’t be anything crazy changing this to your own custom texture if you have one it should be fairly self-explanatory that you just have to change this to your own textures identifier here shouldn’t be anything Crazy right let’s add the translation this is going to be the soap water bucket over here of course and then also the soap water bucket json file over here nothing too crazy just points to a normal item texture and the normal item texture is also right here so once again nothing Too crazy over here something that we’ve seen plenty of times before right and that should be all of the things that we need to do so let’s go into the game and see if it flows all right he finds us back in minecraft and there we go the Soapy water bucket or the soap water bucket has been added so let’s also see if i can right click and indeed i can now this is well if that’s not a crazy behavior i don’t know what is but that that’s actually hilarious i don’t know what the Frick is going on right here but that is really really cool okay so let’s go back and uh let’s see what uh why this would be the case right i believe the issue being that the level over here is actually eight this has to be zero while The level in the actual flowing fluid here right this is where it gets this level so this this should be half level zero i believe something like that and this is where the actual level should be set so this one has to be zero i believe this should fix it let’s hope because That one was absolutely crazy and then you also saw that it didn’t have any physics associated with it so if you want physics then you can add it to the to a fluid tag in your data minecraft tags folder now this is semi-optional in that if you plan your fluid to be used In some sort of machine and stuff like that and maybe some other mods add machines as well that use water then it might be the case that they’re using the water tag which in turn means that your fluid will be handled the same as water which might not be something that you Want so there pretty much is a trade-off between having in-world physics versus it not being treated as water in some sort of a machine basically but if you do want it then you can go to the tags folder right click directory called fluids and then inside of there i’m just Going to copy it over it’s just called water.json and you can see i’ve just added both of the fluids over here once again this is semi-optional only if you really want it to behave exactly like water if that’s not important to you then you can leave this out and if it’s More important to you that it basically is not treated as water by other mods just keep that in mind as well all right it actually is the case that the get level might not be the issue the issues that i forgot one method to override and that is the matches type method over Here well it can happen even to me so you can see there you go but if we do this now i am incredibly confident that it’s finally going to work so let’s see all right he finds us in minecraft and now let’s see and there we go looks much Better than before i mean what with that craziness before that was actually insane but we can see you know that it’s basically flowing over and it even flows into there that’s really cool and that’s just like as you can see so it pretty much behaves like water i believe if i Go in there there you go let’s just get a bucket if i’m in survival mode i can pick it up you can see it turns into a soap bucket and it also places down so pretty much exactly what you expect it to and i believe that If we actually try to get this to well be infinite it probably won’t work because we’ve set it to infinite false and you can see it is not infinite exactly what we want it to so that’s pretty awesome and that’s how easy it can be to add a custom fluid to Minecraft and as always of course all of the code is in the description below get up a positive individual just as well but that would be it for this tutorial right here hope you found this useful and you learned something new and i’ll see you all in the next tutorial oh yeah Video Information
This video, titled ‘Minecraft 1.19.1 Fabric Modding Tutorial | CUSTOM FLUIDS | #18’, was uploaded by Modding by Kaupenjoe on 2022-08-10 13:59:49. It has garnered 3911 views and 88 likes. The duration of the video is 00:13:14 or 794 seconds.
In this Minecraft Modding Tutorial, we are adding a CUSTOM FLUID with Fabric in Minecraft 1.19.1
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Fabric-Tutorial-1.19/tree/19-fluids Gist: https://url.kaupenjoe.net/yt388/gist Assets: https://url.kaupenjoe.net/yt388/textures
== TIMESTAMPS == 0:00 Intro 0:30 Creating the SoapWaterFluid Class 5:57 Registering the fluid in the ModFluids class 8:31 Registering the Textures for the custom Fluid 9:59 Demonstration (With Bug) 10:26 Fixing the Bug 10:55 (Optional) Adding the fluid to the Water Tag 12:12 Demonstration (Working) 13:01 Outro
== 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 *
== 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.
== ADDITIONAL CREDITS == Outro Musik by Kevin MacLeod: “That’s a Wrap” Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0
== 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