Let’s make an animated gecko lib block in Minecraft oh right we found stuff back in each other ones more and in this tutorial we’re going to be adding a custom block that is animated with gecko lip to Minecraft right here in Forge 119 4 and For this we of course once again need a blockbench so this is going to be our animated block as you can see it has a you know pedestal and a gold block and if we look at the animation tab or the anime tab you can see the gold block Just goes up and down for the first part here we’re just going to export all of the Json files and the PNG file and I’m going to add that to IntelliJ and then we’re going to go through all the craziness because this time we actually need a lot of things once again of Course to use this you need the gecko Loop animation neutils plugin right here very important that you have this installed and then the blockbench file and all the other files and the code will always be available in the description below so no worries at all So we’re going to start by going to file export and then we want to export the gecko lib model right here that’s going to give us the geojson file over here that’s exactly right then we want to go to export again and Export the display settings this is going to be the Animated underscore block.json file this is going to be the block model Json file that we also will need then we can go to the animate Tab and go to animation export animations and we’re just going to make sure that all of them are selected in this case the idle animation Hit confirm and this one we need to rename to be the animated underscore block.animation.json there you go and then last but not least we want to right click on the PNG file save as and this is the animated underscore block.png that is exactly right and there you go Those are the four files that we need and now we can go back to IntelliJ and continue right here so in the resources folder we just want to add the different files so we already have the animations in the Geo folder here so we want to add The griof Json file right here this is the animated block Geo and then the animated block animation Json file the block texture we want to add to the textures block folder and then the model file we want to add to the block models folder so we’re going to create that in This case because well this is once again one of the you know non-stand nut block models in this case you can really well recreate this with datagen right that doesn’t really work and just because while we’re in the assets folder we’re just going to create all of the Rest as well so I’m just going to copy over the item model for this uh the item model file is well I mean it literally just points back to the block model file nothing crazy going on right here and then there’s also a block States file That we need but you will see that once I cut rated this over here this is a standard block State Json file now this one in theory you could create via datagen for the purposes of Simplicity I’m just going to copy it over like I Said this should be like I think we even have some that look exactly like this because this is just a normal one right so you can see this is the exact same as this is just a little bit differently formatted so you could in theory also Just add that but for the time being I think we’re going to be fine with this and just because I will forget it let’s just add the Lang as well and then we have all of the Json files and all the you know asset stuff done and we can Proceed to go into of the code the first thing I just noticed is that in the tournament Constructor we should actually do the following you should say Gecko lib.initialize and we should call this because otherwise you know there might be some issues with gecko lib I’m unsure if this is like strictly Necessary but it’s better to have this than not when we have this we first of all need a block for now for the block to be animated we actually also need a block entity now I won’t go through you know insane detail on block entities in this tutorial however I have previous Tutorials that should be completely fine to use in 119 3 and 119 4 as well so I will link that in the top right corner I will link that in the top right corner but for the time being we’re just going to go through what we need so the first Thing we are going to need in the block package we want a new package and we’re going to call that the entity package so this is for the block entities and before we put anything in there we’re going to make a new custom block and that is going to be the animated block There you go now the animated block will extend the base entity block right here we’re going to hover over this implement the new block entity method over here hover over this again create Constructor matching super making sure that the Constructor here is public and once again if the things here annoy you click On this press shift F6 and then we can rename this or you can also use parchment mappings that is also possible we’re going to make a deliberate error right here in the new block entity method because we don’t have anything here and extremely important this is extremely important please pay attention We want to add the get render shape method as an overwrite and we’re just going to change the state here as well and we want to return this is also important render shape dot entity block animated this is extremely important if we don’t have this right if we do not Override this then our block is going to be invisible so if your block is invisible then the reason is because you haven’t overridden the render shape method right here so that’s very important and that is pretty much the animated block done until we can add the Block entity right here but what we can already do is we can register our block so in the modblocks class let’s just copy over the ebony sampling this is going to be be our animated underscore block and this is very important we don’t want to use the register block Method we actually want to use blocks.register so we want to take the Deferred registry here directly we want to register the animated underscore block and then of course a new animated block we then don’t need that and we also want don’t want to copy the sapling we maybe want to say of Material.stone let’s say and then also very important we want to add the no occlusion call over here and that should be that nice with that done we can proceed to add the entity so in the entity package we’re going to right click new package called client we’re Going to need that in just a moment and then first in the entity package we want to add a new class and that is the animated block entity class so this is going to be the actual block entity and the idea of block entities is basically that they are specifically for adding Additional data to blocks so you know furnaces and things like that then now this will extend the block ND class and implement the Geo block entity we’re going to hover over this implement the methods over here this is the Geo these are the gecko methods and then also Constructor matching super of course We’re going to delete the first parameter and then once again change the two other parameters shift F6 to rename them and a deliberate Arrow will be present right here for the time being now all of the rest when it comes to gecko lift is pretty much almost the Same as we’ve seen I mean now a couple of times so this is once again the animatable instance cache called cache and this is going to be equal to a new single and animable instance cache passing into this we’re going to return it right here we want to overwrite the Get tick method and this should return the render utils dot get current tick there you go and then in the register controllers we once again have exactly the same thing that we have in the item or in the entity so this is just going to be registercontrollers dot add a new Animation controller passing in this then a new name here controller zero transition takes and then this colon colon predicate now this one doesn’t exist of course so we’re going to hover over this create the new method and then instead of here the animation State getcontroller set animation raw Animation.begin dot then idle this is the name of our animation animation type dot Loop and there you go and then here afterwards we just want to return the play state DOT continue and that’s pretty much it this is the exact same thing that we’ve done two times now and You know this is pretty much always the same idea for playing the animations now once we’ve done this we can make a new class in the entity package and that is going to be the mod block entities and right here this is going to be very interesting this is going to first of All have a public static final deferred register of type block entity type of type question mark called block entities this is going to be equal to a deferred register dot create forward Registries dot block entity types tutorial tutorial mod.mod ID there you go and of course when the weather is a deferred register There also is a public void register method event bus with a cold event bus here and we’re going to call block entities that register passing in the event bus and this register method we want to immediately call right here under the block entities modblock entities dot register passing in the Event bus right here and there you go and then we want to register our actual block entity to do that we’re going to say make a public static final registry object of type block entity type of type animated blog entity that’s going to be the animated underscore block underscore Entity and this is going to be equal to blog entity start register it’s going to be the animated underscore block underscore entity name right here then a supplier of block entity type dot Builder dot of passing an animated block entity colon called new right after the new comma and then mod block start Animatedblock dot get and then after the second closing parenthesis a build passing in null over here and then ending it with a semicolon there you go if this is a little bit complicated over here don’t worry of course all of the code as always is available to you in The description role in the GitHub repository so you can double check if there’s any errors or you know maybe you’ve missed closing parentheses and something is wrong you can always double check that with the GitHub repository now that we have the animator block entity registered we can now go back to The block over here and we can basically add it right here so this is going to be the new animated block entity passing in the position and the state no not the properties the block pause there you go I don’t know where it got the properties From but there you go so that should be fine the animator block is then done and then the same thing goes in the animated block entity over here this is just going to be the modblock entities.animatedblock dot get and with that this class is also done so we can Close that and this is also done that’s amazing this is also done absolutely amazing and now we can proceed to the client stuff so this is going to be the model and the render against this is the animated block model in this case and then also the animated block renderer There you go and we’ll go to course going to start with the model in this case so there’s going to be the this is going to extends Geo model of type animated block entity and we’re going to hover all this implement the methods and now in this case I will actually copy Over the returns because those are just normal resource locations pointing back to the Json files that we’ve copied over in the beginning of the tutorial so this should really be absolutely understandable and there should be no you know issues for you to basically do that right it just points back to the PNG file the Json file the animation Json file and the geojson file nothing crazy going on here and then inside of the renderer we wanted to extend this with the Geo block render over here and this is the animated block entity hovering over this create Constructor matching super and then instead of the Geo model we actually want the block entity renderer provider right here dot context calling this context and then the model here is just going to be a new animated block model and there you go that is what we need in this case and the render needs to be used in our event At the very bottom here the client motive and so we want to call the block entity rendra start register passing in mod block entities Dot animatedblog entity.get and then the second one is going to be the animated block entity renderer animator block render cone called new there you go and with that The actual block itself if we were to spawn the block would actually already work that’s really nice however the item is not yet done because we actually need to make a custom item this is why we register the work like this so that no item is added because we actually want To add a custom item to it and this is what we do next so in the item package in the custom package we’re gonna make a new Java class called The Animated block item make sure we write this correctly there you go and this will extend the Block item class and it will implement the Geo item there you go so I’m going to hover over this implement the methods this is going to be the gecko lit methods again and then create Constructor matching super once again here we can just rename this by clicking On this shift F6 and there you go now this is going to be almost the same with for gecko lip the as we’ve seen previously an animatable instance cache over here called Cash which is going to be equal to a new single animatable instance cache with passing in this Instead of the Constructor very important we also want to say single and Geo animatable register synced animatable and then passing in this now you might ask where does all of this come from well this is actually a really good tip as well if you you can actually Go into all of the gecko plus as well right middle Mouse one click and you can see I’m now in the Geo item class and if I press Ctrl H over here you can see these are all of the classes that already exist so for example how does The Jack in the Box work well you can see right these are the basic things that are overridden over here and how they work and what happens here and you can basically take a look at the examples right and you can see for example the register sync animator is Here in here as well and you can see there’s even some comments over here on what certain things do so I cannot recommend it enough to basically go into the gecko lip classes as well to understand some of how things work but we’re just going to continue and Actually return the cache right here there you go we also want to overridly get tick method and this is is going to once again return render utils.getcurrent tick there you go and then for the controllers I’m just going to copy this over because this is going To be exactly the same thing that we have inside of the block entity right so we can literally copy over this right we’re going to select it Ctrl C and then Ctrl V to paste it and you can see there’s no errors because there’s exactly the same thing now there’s one More method that we want to override and that is the initialize client method right here with this consumer now we want to make a deliberate error so we’re just going to you know put in an X so that we don’t forget to add this because For the block item well we also need a block item model and a block item renderer so in the client what we can do is new animated block item model and a new animated block item renderer there you go now the model is going to Be well pretty much just a Geo model of type animated block item very important hover over this implement the methods now once again for ease I’m just going to copy over the methods here because once again this is just resource location so nothing crazy and also you Should have all of this available in the description below as well so that is also fine the render itself is going to be a Geo item renderer of type animated block item and we’re going to hover all this again create Constructor matching super we don’t need a model we actually Don’t need anything in here and we’re gonna make a new animated block item model very important that we choose the correct one by the way right not the block model this is this is why you need to be cognizant of which one you’re using but that is fine and then in the Item right here we can now proceed to fix this as well in the initialize client method we can say consumer.accept and then we’re going to make a new I client item extend mentioned this is going to be an anonymous class I’m going to override not the get font method but We want to override the get custom render method right here instead of the anonymous class we’re going to make a private animated block item renderer or renderer and then inside of the method here we’re going to say if the this dot renderer if this start renderer is equal To null then what we’re going to do is we’re going to say this that renderer equals a new animated block item rendra and if it’s already done then we can just go in here and we can just return the stud renderer there you go and that’s going to use our custom renderer For this particular item now last but not least we also want to register the item so that’s going to be right here this is going to be the animated underscore block item and this is extremely important this has to be the same name as our block right so this is Animated underscore block and inside of the modblocks class animated block those two have to match otherwise this will not work this is very important and this is of course an animated block item and then the first parameter is going to be the block that it Associates with so This is going to be the modblock start animated block that get there you go and I I can’t believe it myself but these should be all of the steps that we need to do in order to add this you can clearly see that the animated block is a Little bit more complicated than I think even the entity in my mind at least because there’s so many you know different steps that you have to go through but yeah that should be it now let’s not forget to add this to the creative mode tab because I always Forget that so let’s do the animated block item there you go and now it’s also added there we’ve already done all of the Json files and I mean that should be it so let’s go into the game and see if it works all right Francis back in Minecraft and let’s just take a look and there we are the animator block and you can see it already animates inside of the inventory and we can set it down and it animates here as well absolutely amazing so I mean that’s pretty much all that we need in this case uh really cool Really awesome and that’s pretty much how like crazy and convoluted it can be to add an animated gecko block over here to Minecraft right but that’s pretty much everything that we need to do like always of course all of the code is available in the GitHub repository in The description below and thank you so much for watching hope you found this useful and you learned on the new one I’ll see you all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19.4 – Forge Modding Tutorial: Geckolib 4 – Animated Block | #13’, was uploaded by Modding by Kaupenjoe on 2023-04-19 15:00:00. It has garnered 2804 views and 37 likes. The duration of the video is 00:16:49 or 1009 seconds.
In this Minecraft Modding Tutorial, we are making a custom Animated Block with Geckolib 4 in Minecraft Forge 1.19.4.
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== COMPATIBILITY == ▶️ Compatible with 1.19.3 and 1.19.4 ✅ SHOULD BE Compatible with 1.20.X
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19.3/tree/13-geckolibAnimatedBlock Assets: https://url.kaupenjoe.net/mbkj33/assets
== 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.
== 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